Skip to content

Commit edc2e69

Browse files
alexvanyotabatsky
authored andcommitted
Support non-mobile targets (Wear OS, TV) (ReactiveCircus#180)
* Add non-mobile targets to allowlist * Add new targets to input validator tests * Update built input-validator.js * Update README with new targets * Update action.yml with new targets
1 parent bc41abc commit edc2e69

File tree

5 files changed

+33
-5
lines changed

5 files changed

+33
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ jobs:
143143
| **Input** | **Required** | **Default** | **Description** |
144144
|-|-|-|-|
145145
| `api-level` | Required | N/A | API level of the platform system image - e.g. 23 for Android Marshmallow, 29 for Android 10. **Minimum API level supported is 15**. |
146-
| `target` | Optional | `default` | Target of the system image - `default`, `google_apis` or `playstore`. |
146+
| `target` | Optional | `default` | Target of the system image - `default`, `google_apis`, `google_apis_playstore`, `android-wear`, `android-wear-cn`, `android-tv` or `google-tv`. |
147147
| `arch` | Optional | `x86` | CPU architecture of the system image - `x86`, `x86_64` or `arm64-v8a`. Note that `x86_64` image is only available for API 21+. `arm64-v8a` images require Android 4.2+ and are limited to fewer API levels (e.g. 30). |
148148
| `profile` | Optional | N/A | Hardware profile used for creating the AVD - e.g. `Nexus 6`. For a list of all profiles available, run `avdmanager list` and refer to the results under "Available Android Virtual Devices". |
149149
| `cores` | Optional | 2 | Number of cores to use for the emulator (`hw.cpu.ncore` in config.ini). |

__tests__/input-validator.test.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,29 @@ describe('target validator tests', () => {
5555
expect(func2).not.toThrow();
5656

5757
const func3 = () => {
58-
validator.checkTarget('google_apis');
58+
validator.checkTarget('google_apis_playstore');
5959
};
6060
expect(func3).not.toThrow();
61+
62+
const func4 = () => {
63+
validator.checkTarget('android-wear');
64+
};
65+
expect(func4).not.toThrow();
66+
67+
const func5 = () => {
68+
validator.checkTarget('android-wear-cn');
69+
};
70+
expect(func5).not.toThrow();
71+
72+
const func6 = () => {
73+
validator.checkTarget('android-tv');
74+
};
75+
expect(func6).not.toThrow();
76+
77+
const func7 = () => {
78+
validator.checkTarget('google-tv');
79+
};
80+
expect(func7).not.toThrow();
6181
});
6282
});
6383

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ inputs:
99
description: 'API level of the platform and system image - e.g. 23 for Android Marshmallow, 29 for Android 10'
1010
required: true
1111
target:
12-
description: 'target of the system image - default, google_apis or playstore'
12+
description: 'target of the system image - default, google_apis, google_apis_playstore, android-wear, android-wear-cn, android-tv or google-tv'
1313
default: 'default'
1414
arch:
1515
description: 'CPU architecture of the system image - x86, x86_64 or arm64-v8a'

lib/input-validator.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22
Object.defineProperty(exports, "__esModule", { value: true });
33
exports.checkEmulatorBuild = exports.checkDisableLinuxHardwareAcceleration = exports.checkDisableSpellchecker = exports.checkDisableAnimations = exports.checkForceAvdCreation = exports.checkArch = exports.checkTarget = exports.checkApiLevel = exports.VALID_ARCHS = exports.VALID_TARGETS = exports.MIN_API_LEVEL = void 0;
44
exports.MIN_API_LEVEL = 15;
5-
exports.VALID_TARGETS = ['default', 'google_apis', 'google_apis_playstore'];
5+
exports.VALID_TARGETS = [
6+
'default',
7+
'google_apis',
8+
'google_apis_playstore',
9+
'android-wear',
10+
'android-wear-cn',
11+
'android-tv',
12+
'google-tv'
13+
];
614
exports.VALID_ARCHS = ['x86', 'x86_64', 'arm64-v8a'];
715
function checkApiLevel(apiLevel) {
816
if (isNaN(Number(apiLevel)) || !Number.isInteger(Number(apiLevel))) {

src/input-validator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const MIN_API_LEVEL = 15;
2-
export const VALID_TARGETS: Array<string> = ['default', 'google_apis', 'google_apis_playstore'];
2+
export const VALID_TARGETS: Array<string> = ['default', 'google_apis', 'google_apis_playstore', 'android-wear', 'android-wear-cn', 'android-tv', 'google-tv'];
33
export const VALID_ARCHS: Array<string> = ['x86', 'x86_64', 'arm64-v8a'];
44

55
export function checkApiLevel(apiLevel: string): void {

0 commit comments

Comments
 (0)