From 883b8114b1d4481e8aab9d9a7ea8761568114639 Mon Sep 17 00:00:00 2001 From: Yang Chen Date: Wed, 26 Feb 2020 18:33:53 +1100 Subject: [PATCH 1/5] Update to AGP 3.6.0 and Gradle 6.2.1 for test-fixture project. --- test-fixture/build.gradle | 2 +- test-fixture/gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test-fixture/build.gradle b/test-fixture/build.gradle index 81605cb64..1239604b9 100644 --- a/test-fixture/build.gradle +++ b/test-fixture/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.3' + classpath 'com.android.tools.build:gradle:3.6.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong diff --git a/test-fixture/gradle/wrapper/gradle-wrapper.properties b/test-fixture/gradle/wrapper/gradle-wrapper.properties index 0da9e6d4a..cadd08a3f 100644 --- a/test-fixture/gradle/wrapper/gradle-wrapper.properties +++ b/test-fixture/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.1-all.zip From e1015a487bb3d785dae2fd14507ab1298ecf4bea Mon Sep 17 00:00:00 2001 From: Yang Chen Date: Thu, 5 Mar 2020 13:23:39 +1100 Subject: [PATCH 2/5] Update test-fixture dependencies. Drop minSdkVersion to 15. --- test-fixture/app/build.gradle | 6 +++--- test-fixture/build.gradle | 2 +- test-fixture/gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test-fixture/app/build.gradle b/test-fixture/app/build.gradle index 080555165..20a46a05e 100644 --- a/test-fixture/app/build.gradle +++ b/test-fixture/app/build.gradle @@ -8,7 +8,7 @@ android { defaultConfig { applicationId "com.example.testapp" - minSdkVersion 21 + minSdkVersion 15 targetSdkVersion 29 versionCode 1 versionName "1.0" @@ -28,9 +28,9 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation 'androidx.appcompat:appcompat:1.1.0' - implementation 'androidx.core:core-ktx:1.1.0' + implementation 'androidx.core:core-ktx:1.2.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' - testImplementation 'junit:junit:4.12' + testImplementation 'junit:junit:4.13' androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' } diff --git a/test-fixture/build.gradle b/test-fixture/build.gradle index 1239604b9..99387dbdf 100644 --- a/test-fixture/build.gradle +++ b/test-fixture/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.3.61' + ext.kotlin_version = '1.3.70' repositories { google() jcenter() diff --git a/test-fixture/gradle/wrapper/gradle-wrapper.properties b/test-fixture/gradle/wrapper/gradle-wrapper.properties index cadd08a3f..4ed78cd63 100644 --- a/test-fixture/gradle/wrapper/gradle-wrapper.properties +++ b/test-fixture/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-all.zip From 4a949058e288d4d4fd74f4c01c139d4cabf2c49e Mon Sep 17 00:00:00 2001 From: Yang Chen Date: Thu, 5 Mar 2020 14:05:05 +1100 Subject: [PATCH 3/5] Use new cmdline-tools with support for running sdkmanager and avdmanager with Java 8+. --- .github/workflows/workflow.yml | 1 + lib/emulator-manager.js | 18 +++++----- lib/java-version-manager.js | 60 ---------------------------------- lib/main.js | 6 ---- lib/sdk-installer.js | 16 ++++++--- src/emulator-manager.ts | 18 +++++----- src/java-version-manager.ts | 39 ---------------------- src/main.ts | 8 ----- src/sdk-installer.ts | 18 +++++++--- 9 files changed, 43 insertions(+), 141 deletions(-) delete mode 100644 lib/java-version-manager.js delete mode 100644 src/java-version-manager.ts diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 338710661..5833f8383 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -45,5 +45,6 @@ jobs: working-directory: ./test-fixture/ script: | echo $GITHUB_REPOSITORY + adb devices ./gradlew help ./gradlew connectedDebugAndroidTest diff --git a/lib/emulator-manager.js b/lib/emulator-manager.js index d2ef920a5..2b7910c73 100644 --- a/lib/emulator-manager.js +++ b/lib/emulator-manager.js @@ -17,8 +17,6 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); const exec = __importStar(require("@actions/exec")); const EMULATOR_BOOT_TIMEOUT_SECONDS = 300; -const AVD_MANAGER_PATH = `${process.env.ANDROID_HOME}/tools/bin/avdmanager`; -const ADB_PATH = `${process.env.ANDROID_HOME}/platform-tools/adb`; /** * Creates and launches a new AVD instance with the specified configurations. */ @@ -27,11 +25,11 @@ function launchEmulator(apiLevel, target, arch, profile, emulatorOptions, disabl // create a new AVD if (profile.trim() !== '') { console.log(`Creating AVD with custom profile ${profile}`); - yield exec.exec(`${AVD_MANAGER_PATH} create avd --force -n test --abi "${target}/${arch}" --package "system-images;android-${apiLevel};${target};${arch}" --device "${profile}"`); + yield exec.exec(`avdmanager create avd --force -n test --abi "${target}/${arch}" --package "system-images;android-${apiLevel};${target};${arch}" --device "${profile}"`); } else { console.log(`Creating AVD without custom profile.`); - yield exec.exec(`sh -c \\"echo no | ${AVD_MANAGER_PATH} create avd --force -n test --abi '${target}/${arch}' --package 'system-images;android-${apiLevel};${target};${arch}'"`); + yield exec.exec(`sh -c \\"echo no | avdmanager create avd --force -n test --abi '${target}/${arch}' --package 'system-images;android-${apiLevel};${target};${arch}'"`); } // start emulator console.log('Starting emulator.'); @@ -46,13 +44,13 @@ function launchEmulator(apiLevel, target, arch, profile, emulatorOptions, disabl }); // wait for emulator to complete booting yield waitForDevice(); - yield exec.exec(`${ADB_PATH} shell input keyevent 82`); + yield exec.exec(`adb shell input keyevent 82`); // disable animations if (disableAnimations) { console.log('Disabling animations.'); - yield exec.exec(`${ADB_PATH} shell settings put global window_animation_scale 0.0`); - yield exec.exec(`${ADB_PATH} shell settings put global transition_animation_scale 0.0`); - yield exec.exec(`${ADB_PATH} shell settings put global animator_duration_scale 0.0`); + yield exec.exec(`adb shell settings put global window_animation_scale 0.0`); + yield exec.exec(`adb shell settings put global transition_animation_scale 0.0`); + yield exec.exec(`adb shell settings put global animator_duration_scale 0.0`); } }); } @@ -63,7 +61,7 @@ exports.launchEmulator = launchEmulator; function killEmulator() { return __awaiter(this, void 0, void 0, function* () { try { - yield exec.exec(`${ADB_PATH} -s emulator-5554 emu kill`); + yield exec.exec(`adb -s emulator-5554 emu kill`); } catch (error) { console.log(error.message); @@ -83,7 +81,7 @@ function waitForDevice() { while (!booted) { try { let result = ''; - yield exec.exec(`${ADB_PATH} shell getprop sys.boot_completed`, [], { + yield exec.exec(`adb shell getprop sys.boot_completed`, [], { listeners: { stdout: (data) => { result += data.toString(); diff --git a/lib/java-version-manager.js b/lib/java-version-manager.js deleted file mode 100644 index d7c6fdc73..000000000 --- a/lib/java-version-manager.js +++ /dev/null @@ -1,60 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const core = __importStar(require("@actions/core")); -const exec = __importStar(require("@actions/exec")); -/** - * Returns the current $JAVA_HOME path. - */ -function getCurrentJavaHome() { - return __awaiter(this, void 0, void 0, function* () { - let defaultJavaHome = ''; - yield exec.exec(`sh -c \\"echo $JAVA_HOME"`, [], { - listeners: { - stdout: (data) => { - defaultJavaHome += data.toString(); - } - } - }); - return defaultJavaHome.trim(); - }); -} -exports.getCurrentJavaHome = getCurrentJavaHome; -/** - * Returns the Java 8 $JAVA_HOME path. - */ -function getJavaHomeV8() { - return __awaiter(this, void 0, void 0, function* () { - let javaHomeV8 = ''; - yield exec.exec(`/usr/libexec/java_home -v 1.8`, [], { - listeners: { - stdout: (data) => { - javaHomeV8 += data.toString(); - } - } - }); - return javaHomeV8.trim(); - }); -} -exports.getJavaHomeV8 = getJavaHomeV8; -/** - * Sets $JAVA_HOME to the specified path. - */ -function setJavaHome(path) { - core.exportVariable('JAVA_HOME', path); -} -exports.setJavaHome = setJavaHome; diff --git a/lib/main.js b/lib/main.js index ff851be1e..597ea20cf 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,6 @@ const input_validator_1 = require("./input-validator"); const emulator_manager_1 = require("./emulator-manager"); const exec = __importStar(require("@actions/exec")); const script_parser_1 = require("./script-parser"); -const java_version_manager_1 = require("./java-version-manager"); function run() { return __awaiter(this, void 0, void 0, function* () { try { @@ -73,9 +72,6 @@ function run() { scripts.forEach((script) => __awaiter(this, void 0, void 0, function* () { console.log(`${script}`); })); - // use Java 8 for sdkmanager and avdmanager - const defaultJavaHome = yield java_version_manager_1.getCurrentJavaHome(); - java_version_manager_1.setJavaHome(yield java_version_manager_1.getJavaHomeV8()); // install SDK yield sdk_installer_1.installAndroidSdk(apiLevel, target, arch, emulatorBuild); try { @@ -85,8 +81,6 @@ function run() { catch (error) { core.setFailed(error.message); } - // use default JAVA_HOME for running custom script - java_version_manager_1.setJavaHome(defaultJavaHome); // execute the custom script try { // move to custom working directory if set diff --git a/lib/sdk-installer.js b/lib/sdk-installer.js index ab03a0c76..a0974a4aa 100644 --- a/lib/sdk-installer.js +++ b/lib/sdk-installer.js @@ -15,17 +15,25 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", { value: true }); +const core = __importStar(require("@actions/core")); const exec = __importStar(require("@actions/exec")); const BUILD_TOOLS_VERSION = '29.0.3'; +const CMDLINE_TOOLS_URL = 'https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip'; /** * Installs & updates the Android SDK for the macOS platform, including SDK platform for the chosen API level, latest build tools, platform tools, Android Emulator, * and the system image for the chosen API level, CPU arch, and target. */ function installAndroidSdk(apiLevel, target, arch, emulatorBuild) { return __awaiter(this, void 0, void 0, function* () { - const sdkmanagerPath = `${process.env.ANDROID_HOME}/tools/bin/sdkmanager`; + console.log('Installing new cmdline-tools.'); + yield exec.exec(`mkdir ${process.env.ANDROID_HOME}/cmdline-tools`); + yield exec.exec(`curl -fo commandlinetools.zip ${CMDLINE_TOOLS_URL}`); + yield exec.exec(`unzip -q commandlinetools.zip -d ${process.env.ANDROID_HOME}/cmdline-tools`); + yield exec.exec(`rm -f commandlinetools.zip`); + // add paths for commandline-tools and platform-tools + core.addPath(`${process.env.ANDROID_HOME}/cmdline-tools/tools:${process.env.ANDROID_HOME}/cmdline-tools/tools/bin:${process.env.ANDROID_HOME}/platform-tools`); console.log('Installing latest build tools, platform tools, and platform.'); - yield exec.exec(`sh -c \\"${sdkmanagerPath} --install 'build-tools;${BUILD_TOOLS_VERSION}' platform-tools 'platforms;android-${apiLevel}' > /dev/null"`); + yield exec.exec(`sh -c \\"sdkmanager --install 'build-tools;${BUILD_TOOLS_VERSION}' platform-tools 'platforms;android-${apiLevel}' > /dev/null"`); if (emulatorBuild) { console.log(`Installing emulator build ${emulatorBuild}.`); yield exec.exec(`curl -fo emulator.zip https://dl.google.com/android/repository/emulator-darwin-${emulatorBuild}.zip`); @@ -35,10 +43,10 @@ function installAndroidSdk(apiLevel, target, arch, emulatorBuild) { } else { console.log('Installing latest emulator.'); - yield exec.exec(`sh -c \\"${sdkmanagerPath} --install emulator > /dev/null"`); + yield exec.exec(`sh -c \\"sdkmanager --install emulator > /dev/null"`); } console.log('Installing system images.'); - yield exec.exec(`sh -c \\"${sdkmanagerPath} --install 'system-images;android-${apiLevel};${target};${arch}' > /dev/null"`); + yield exec.exec(`sh -c \\"sdkmanager --install 'system-images;android-${apiLevel};${target};${arch}' > /dev/null"`); }); } exports.installAndroidSdk = installAndroidSdk; diff --git a/src/emulator-manager.ts b/src/emulator-manager.ts index 49a33f3f3..727fc2658 100644 --- a/src/emulator-manager.ts +++ b/src/emulator-manager.ts @@ -1,8 +1,6 @@ import * as exec from '@actions/exec'; const EMULATOR_BOOT_TIMEOUT_SECONDS = 300; -const AVD_MANAGER_PATH = `${process.env.ANDROID_HOME}/tools/bin/avdmanager`; -const ADB_PATH = `${process.env.ANDROID_HOME}/platform-tools/adb`; /** * Creates and launches a new AVD instance with the specified configurations. @@ -11,10 +9,10 @@ export async function launchEmulator(apiLevel: number, target: string, arch: str // create a new AVD if (profile.trim() !== '') { console.log(`Creating AVD with custom profile ${profile}`); - await exec.exec(`${AVD_MANAGER_PATH} create avd --force -n test --abi "${target}/${arch}" --package "system-images;android-${apiLevel};${target};${arch}" --device "${profile}"`); + await exec.exec(`avdmanager create avd --force -n test --abi "${target}/${arch}" --package "system-images;android-${apiLevel};${target};${arch}" --device "${profile}"`); } else { console.log(`Creating AVD without custom profile.`); - await exec.exec(`sh -c \\"echo no | ${AVD_MANAGER_PATH} create avd --force -n test --abi '${target}/${arch}' --package 'system-images;android-${apiLevel};${target};${arch}'"`); + await exec.exec(`sh -c \\"echo no | avdmanager create avd --force -n test --abi '${target}/${arch}' --package 'system-images;android-${apiLevel};${target};${arch}'"`); } // start emulator @@ -31,14 +29,14 @@ export async function launchEmulator(apiLevel: number, target: string, arch: str // wait for emulator to complete booting await waitForDevice(); - await exec.exec(`${ADB_PATH} shell input keyevent 82`); + await exec.exec(`adb shell input keyevent 82`); // disable animations if (disableAnimations) { console.log('Disabling animations.'); - await exec.exec(`${ADB_PATH} shell settings put global window_animation_scale 0.0`); - await exec.exec(`${ADB_PATH} shell settings put global transition_animation_scale 0.0`); - await exec.exec(`${ADB_PATH} shell settings put global animator_duration_scale 0.0`); + await exec.exec(`adb shell settings put global window_animation_scale 0.0`); + await exec.exec(`adb shell settings put global transition_animation_scale 0.0`); + await exec.exec(`adb shell settings put global animator_duration_scale 0.0`); } } @@ -47,7 +45,7 @@ export async function launchEmulator(apiLevel: number, target: string, arch: str */ export async function killEmulator(): Promise { try { - await exec.exec(`${ADB_PATH} -s emulator-5554 emu kill`); + await exec.exec(`adb -s emulator-5554 emu kill`); } catch (error) { console.log(error.message); } @@ -64,7 +62,7 @@ async function waitForDevice(): Promise { while (!booted) { try { let result = ''; - await exec.exec(`${ADB_PATH} shell getprop sys.boot_completed`, [], { + await exec.exec(`adb shell getprop sys.boot_completed`, [], { listeners: { stdout: (data: Buffer) => { result += data.toString(); diff --git a/src/java-version-manager.ts b/src/java-version-manager.ts deleted file mode 100644 index 0998428cf..000000000 --- a/src/java-version-manager.ts +++ /dev/null @@ -1,39 +0,0 @@ -import * as core from '@actions/core'; -import * as exec from '@actions/exec'; - -/** - * Returns the current $JAVA_HOME path. - */ -export async function getCurrentJavaHome(): Promise { - let defaultJavaHome = ''; - await exec.exec(`sh -c \\"echo $JAVA_HOME"`, [], { - listeners: { - stdout: (data: Buffer) => { - defaultJavaHome += data.toString(); - } - } - }); - return defaultJavaHome.trim(); -} - -/** - * Returns the Java 8 $JAVA_HOME path. - */ -export async function getJavaHomeV8(): Promise { - let javaHomeV8 = ''; - await exec.exec(`/usr/libexec/java_home -v 1.8`, [], { - listeners: { - stdout: (data: Buffer) => { - javaHomeV8 += data.toString(); - } - } - }); - return javaHomeV8.trim(); -} - -/** - * Sets $JAVA_HOME to the specified path. - */ -export function setJavaHome(path: string) { - core.exportVariable('JAVA_HOME', path); -} diff --git a/src/main.ts b/src/main.ts index d20255c09..7aa10e753 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,7 +4,6 @@ import { checkApiLevel, checkTarget, checkArch, checkDisableAnimations, checkEmu import { launchEmulator, killEmulator } from './emulator-manager'; import * as exec from '@actions/exec'; import { parseScript } from './script-parser'; -import { getCurrentJavaHome, getJavaHomeV8, setJavaHome } from './java-version-manager'; async function run() { try { @@ -66,10 +65,6 @@ async function run() { console.log(`${script}`); }); - // use Java 8 for sdkmanager and avdmanager - const defaultJavaHome = await getCurrentJavaHome(); - setJavaHome(await getJavaHomeV8()); - // install SDK await installAndroidSdk(apiLevel, target, arch, emulatorBuild); @@ -80,9 +75,6 @@ async function run() { core.setFailed(error.message); } - // use default JAVA_HOME for running custom script - setJavaHome(defaultJavaHome); - // execute the custom script try { // move to custom working directory if set diff --git a/src/sdk-installer.ts b/src/sdk-installer.ts index f182ea24c..343e8ad8e 100644 --- a/src/sdk-installer.ts +++ b/src/sdk-installer.ts @@ -1,15 +1,25 @@ +import * as core from '@actions/core'; import * as exec from '@actions/exec'; const BUILD_TOOLS_VERSION = '29.0.3'; +const CMDLINE_TOOLS_URL = 'https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip'; /** * Installs & updates the Android SDK for the macOS platform, including SDK platform for the chosen API level, latest build tools, platform tools, Android Emulator, * and the system image for the chosen API level, CPU arch, and target. */ export async function installAndroidSdk(apiLevel: number, target: string, arch: string, emulatorBuild?: string): Promise { - const sdkmanagerPath = `${process.env.ANDROID_HOME}/tools/bin/sdkmanager`; + console.log('Installing new cmdline-tools.'); + await exec.exec(`mkdir ${process.env.ANDROID_HOME}/cmdline-tools`); + await exec.exec(`curl -fo commandlinetools.zip ${CMDLINE_TOOLS_URL}`); + await exec.exec(`unzip -q commandlinetools.zip -d ${process.env.ANDROID_HOME}/cmdline-tools`); + await exec.exec(`rm -f commandlinetools.zip`); + + // add paths for commandline-tools and platform-tools + core.addPath(`${process.env.ANDROID_HOME}/cmdline-tools/tools:${process.env.ANDROID_HOME}/cmdline-tools/tools/bin:${process.env.ANDROID_HOME}/platform-tools`); + console.log('Installing latest build tools, platform tools, and platform.'); - await exec.exec(`sh -c \\"${sdkmanagerPath} --install 'build-tools;${BUILD_TOOLS_VERSION}' platform-tools 'platforms;android-${apiLevel}' > /dev/null"`); + await exec.exec(`sh -c \\"sdkmanager --install 'build-tools;${BUILD_TOOLS_VERSION}' platform-tools 'platforms;android-${apiLevel}' > /dev/null"`); if (emulatorBuild) { console.log(`Installing emulator build ${emulatorBuild}.`); await exec.exec(`curl -fo emulator.zip https://dl.google.com/android/repository/emulator-darwin-${emulatorBuild}.zip`); @@ -18,8 +28,8 @@ export async function installAndroidSdk(apiLevel: number, target: string, arch: await exec.exec(`rm -f emulator.zip`); } else { console.log('Installing latest emulator.'); - await exec.exec(`sh -c \\"${sdkmanagerPath} --install emulator > /dev/null"`); + await exec.exec(`sh -c \\"sdkmanager --install emulator > /dev/null"`); } console.log('Installing system images.'); - await exec.exec(`sh -c \\"${sdkmanagerPath} --install 'system-images;android-${apiLevel};${target};${arch}' > /dev/null"`); + await exec.exec(`sh -c \\"sdkmanager --install 'system-images;android-${apiLevel};${target};${arch}' > /dev/null"`); } From ede514c8c2cb982ef8004d78443c7d2a08ae5144 Mon Sep 17 00:00:00 2001 From: Yang Chen Date: Thu, 5 Mar 2020 14:43:58 +1100 Subject: [PATCH 4/5] Add support for API 15-19 system images. --- .github/workflows/workflow.yml | 4 ++-- README.md | 4 ++-- __tests__/input-validator.test.ts | 4 ++-- lib/input-validator.js | 2 +- src/input-validator.ts | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 5833f8383..e90ab2ba1 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -13,7 +13,7 @@ jobs: timeout-minutes: 10 strategy: matrix: - api-level: [21, 23, 29] + api-level: [16, 21, 23, 29] steps: - name: checkout uses: actions/checkout@v2 @@ -37,7 +37,7 @@ jobs: uses: ./ with: api-level: ${{ matrix.api-level }} - target: google_apis + target: default arch: x86 profile: Nexus 6 emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none diff --git a/README.md b/README.md index 019dc7682..7dcf0a39c 100644 --- a/README.md +++ b/README.md @@ -69,9 +69,9 @@ jobs: | | **Required** | **Default** | **Description** | |----------------------|--------------|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `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 21**. | +| `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**. | | `target` | Optional | `default` | Target of the system image - `default` or `google_apis`. | -| `arch` | Optional | `x86` | CPU architecture of the system image - `x86` or `x86_64`. | +| `arch` | Optional | `x86` | CPU architecture of the system image - `x86` or `x86_64`. Note that `x86_64` image is only available for API 21+. | | `profile` | Optional | N/A | Hardware profile used for creating the AVD - e.g. `Nexus 6`. For a list of all profiles available, run `$ANDROID_HOME/tools/bin/avdmanager list` and refer to the results under "Available Android Virtual Devices". | | `emulator-options` | Optional | See below | Command-line options used when launching the emulator (replacing all default options) - e.g. `-no-window -no-snapshot -camera-back emulated`. | | `disable-animations` | Optional | `true` | Whether to disable animations - `true` or `false`. | diff --git a/__tests__/input-validator.test.ts b/__tests__/input-validator.test.ts index baffc0f23..812177edc 100644 --- a/__tests__/input-validator.test.ts +++ b/__tests__/input-validator.test.ts @@ -17,14 +17,14 @@ describe('api-level validator tests', () => { it('Throws if api-level is lower than min API supported', () => { const func = () => { - validator.checkApiLevel('20'); + validator.checkApiLevel('14'); }; expect(func).toThrowError(`Minimum API level supported is ${validator.MIN_API_LEVEL}.`); }); it('Validates successfully with valid api-level', () => { const func1 = () => { - validator.checkApiLevel('21'); + validator.checkApiLevel('15'); }; expect(func1).not.toThrow(); diff --git a/lib/input-validator.js b/lib/input-validator.js index 32a59bd4e..65fcaa0db 100644 --- a/lib/input-validator.js +++ b/lib/input-validator.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.MIN_API_LEVEL = 21; +exports.MIN_API_LEVEL = 15; exports.VALID_TARGETS = ['default', 'google_apis']; exports.VALID_ARCHS = ['x86', 'x86_64']; function checkApiLevel(apiLevel) { diff --git a/src/input-validator.ts b/src/input-validator.ts index 176f7b756..b125ebe64 100644 --- a/src/input-validator.ts +++ b/src/input-validator.ts @@ -1,4 +1,4 @@ -export const MIN_API_LEVEL = 21; +export const MIN_API_LEVEL = 15; export const VALID_TARGETS: Array = ['default', 'google_apis']; export const VALID_ARCHS: Array = ['x86', 'x86_64']; From da846ad45b72662762207466587f7da2092a01fc Mon Sep 17 00:00:00 2001 From: Yang Chen Date: Thu, 5 Mar 2020 14:54:33 +1100 Subject: [PATCH 5/5] Prepare for release 2.5.0. --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20bd80afd..032d264c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## v2.5.0 + +* Added support for API 15-19 system images. +* Switched to the new SDK command-line tools which supports running `sdkmanager` and `avdmanager` with Java 9+. + ## v2.4.0 * Added support for setting custom `working-directory` - e.g. `./android` if your root Gradle project is under the `./android` sub-directory within your repository.