fix: allow google_apis_ps16k as a valid target (#440)

* test: remove target validator test

these appear to have too much maintenance burden as they only ever
add more over time

* fix: allow google_apis_ps16k and google_apis_playstore_ps16k as valid targets

Fixes #403

Co-authored-by: Yang <reactivecircus@gmail.com>

* fix: remove target validation entirely, any valid sdkmanager target will work

no longer requires code changes here to access new targets

---------

Co-authored-by: Yang <reactivecircus@gmail.com>
This commit is contained in:
Mike Hardy
2025-07-01 20:45:42 -05:00
committed by GitHub
parent f2bf410054
commit 66283c0319
7 changed files with 21 additions and 118 deletions
+10 -20
View File
@@ -1,31 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkDiskSize = exports.checkEmulatorBuild = exports.checkEnableHardwareKeyboard = exports.checkDisableLinuxHardwareAcceleration = exports.checkDisableSpellchecker = exports.checkDisableAnimations = exports.checkPort = exports.checkForceAvdCreation = exports.checkChannel = exports.checkArch = exports.checkTarget = exports.MAX_PORT = exports.MIN_PORT = exports.VALID_CHANNELS = exports.VALID_ARCHS = exports.VALID_TARGETS = exports.MIN_API_LEVEL = void 0;
exports.checkDiskSize = exports.checkEmulatorBuild = exports.checkEnableHardwareKeyboard = exports.checkDisableLinuxHardwareAcceleration = exports.checkDisableSpellchecker = exports.checkDisableAnimations = exports.checkPort = exports.checkForceAvdCreation = exports.checkChannel = exports.checkArch = exports.playstoreTargetSubstitution = exports.MAX_PORT = exports.MIN_PORT = exports.VALID_CHANNELS = exports.VALID_ARCHS = exports.MIN_API_LEVEL = void 0;
exports.MIN_API_LEVEL = 15;
exports.VALID_TARGETS = [
'default',
'google_apis',
'aosp_atd',
'google_atd',
'google_apis_playstore',
'android-wear',
'android-wear-cn',
'android-tv',
'google-tv',
'android-automotive',
'android-automotive-playstore',
'android-desktop',
];
exports.VALID_ARCHS = ['x86', 'x86_64', 'arm64-v8a'];
exports.VALID_CHANNELS = ['stable', 'beta', 'dev', 'canary'];
exports.MIN_PORT = 5554;
exports.MAX_PORT = 5584;
function checkTarget(target) {
if (!exports.VALID_TARGETS.includes(target)) {
throw new Error(`Value for input.target '${target}' is unknown. Supported options: ${exports.VALID_TARGETS}.`);
}
function playstoreTargetSubstitution(target) {
// "playstore" is an allowed shorthand for "google_apis_playstore" images
// this is idempotent - return same even if run multiple times on same target
if (target === 'playstore')
return 'google_apis_playstore';
if (target === 'playstore_ps16k')
return 'google_apis_playstore_ps16k';
return target;
}
exports.checkTarget = checkTarget;
exports.playstoreTargetSubstitution = playstoreTargetSubstitution;
function checkArch(arch) {
if (!exports.VALID_ARCHS.includes(arch)) {
throw new Error(`Value for input.arch '${arch}' is unknown. Supported options: ${exports.VALID_ARCHS}.`);
+1 -3
View File
@@ -70,9 +70,7 @@ function run() {
}
console.log(`System image API level: ${systemImageApiLevel}`);
// target of the system image
const targetInput = core.getInput('target');
const target = targetInput == 'playstore' ? 'google_apis_playstore' : targetInput;
(0, input_validator_1.checkTarget)(target);
const target = (0, input_validator_1.playstoreTargetSubstitution)(core.getInput('target'));
console.log(`target: ${target}`);
// CPU architecture of the system image
const arch = core.getInput('arch');