mirror of
https://github.com/reactivecircus/android-emulator-runner.git
synced 2026-09-03 19:09:32 +00:00
Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2b2ebf2e51 | |||
| d203cdc3fb | |||
| 8896ab3615 | |||
| 8f0c30aea2 | |||
| d1f5d2c017 | |||
| d0dfd56912 | |||
| 7f2c89a896 | |||
| 1424075cfd | |||
| 0bc3ba22b5 | |||
| acdb69812b | |||
| f71c6d1f84 | |||
| 511d462729 | |||
| d83fb3d4fb | |||
| 1427331a62 | |||
| 1ded27b164 | |||
| 217e44e3c5 | |||
| 31d8d4204a | |||
| a5bc682448 | |||
| 4d1a61ed38 | |||
| 1bf9f17bc6 | |||
| 5de26e4bd2 | |||
| 5e487dbdfe | |||
| 08852ad83b | |||
| 25bcfbab74 |
@@ -1,6 +1,8 @@
|
|||||||
name: Main workflow
|
name: Main workflow
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
@@ -18,6 +20,7 @@ jobs:
|
|||||||
os: [macos-latest, ubuntu-latest]
|
os: [macos-latest, ubuntu-latest]
|
||||||
api-level: [16, 23, 29]
|
api-level: [16, 23, 29]
|
||||||
target: [default, google_apis]
|
target: [default, google_apis]
|
||||||
|
arch: [x86]
|
||||||
exclude:
|
exclude:
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
api-level: 23
|
api-level: 23
|
||||||
@@ -30,15 +33,18 @@ jobs:
|
|||||||
- target: google_apis
|
- target: google_apis
|
||||||
api-level: 29
|
api-level: 29
|
||||||
include:
|
include:
|
||||||
- os: macos-11.0
|
|
||||||
api-level: 30
|
|
||||||
target: google_apis
|
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
api-level: 24
|
api-level: 24
|
||||||
target: playstore
|
target: playstore
|
||||||
|
arch: x86
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
api-level: 28
|
api-level: 30
|
||||||
|
target: aosp_atd
|
||||||
|
arch: x86
|
||||||
|
- os: macos-11
|
||||||
|
api-level: 31
|
||||||
target: google_apis
|
target: google_apis
|
||||||
|
arch: x86_64
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
@@ -84,7 +90,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
api-level: ${{ matrix.api-level }}
|
api-level: ${{ matrix.api-level }}
|
||||||
target: ${{ matrix.target }}
|
target: ${{ matrix.target }}
|
||||||
arch: x86
|
arch: ${{ matrix.arch }}
|
||||||
profile: Galaxy Nexus
|
profile: Galaxy Nexus
|
||||||
cores: 2
|
cores: 2
|
||||||
sdcard-path-or-size: 100M
|
sdcard-path-or-size: 100M
|
||||||
@@ -93,6 +99,7 @@ jobs:
|
|||||||
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
|
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
|
||||||
disable-animations: false
|
disable-animations: false
|
||||||
working-directory: ./test-fixture/
|
working-directory: ./test-fixture/
|
||||||
|
channel: canary
|
||||||
script: echo "Generated AVD snapshot for caching."
|
script: echo "Generated AVD snapshot for caching."
|
||||||
|
|
||||||
- name: run action
|
- name: run action
|
||||||
@@ -100,7 +107,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
api-level: ${{ matrix.api-level }}
|
api-level: ${{ matrix.api-level }}
|
||||||
target: ${{ matrix.target }}
|
target: ${{ matrix.target }}
|
||||||
arch: x86
|
arch: ${{ matrix.arch }}
|
||||||
profile: Galaxy Nexus
|
profile: Galaxy Nexus
|
||||||
cores: 2
|
cores: 2
|
||||||
ram-size: 2048M
|
ram-size: 2048M
|
||||||
@@ -110,6 +117,7 @@ jobs:
|
|||||||
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
|
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
|
||||||
disable-animations: true
|
disable-animations: true
|
||||||
working-directory: ./test-fixture/
|
working-directory: ./test-fixture/
|
||||||
|
channel: canary
|
||||||
script: |
|
script: |
|
||||||
echo $GITHUB_REPOSITORY
|
echo $GITHUB_REPOSITORY
|
||||||
adb devices
|
adb devices
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
name: Manually triggered workflow
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
os:
|
||||||
|
description: 'OS'
|
||||||
|
required: true
|
||||||
|
default: 'macos-latest'
|
||||||
|
api-level:
|
||||||
|
description: 'API level of the platform and system image'
|
||||||
|
required: true
|
||||||
|
default: '30'
|
||||||
|
target:
|
||||||
|
description: 'target of the system image - default, google_apis, google_apis_playstore, aosp_atd, google_atd, android-wear, android-wear-cn, android-tv or google-tv'
|
||||||
|
required: true
|
||||||
|
default: 'default'
|
||||||
|
arch:
|
||||||
|
description: 'CPU architecture of the system image - x86, x86_64 or arm64-v8a'
|
||||||
|
default: 'x86'
|
||||||
|
emulator-options:
|
||||||
|
description: 'command-line options used when launching the emulator'
|
||||||
|
default: '-no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim'
|
||||||
|
emulator-build:
|
||||||
|
description: 'build number of a specific version of the emulator binary to use'
|
||||||
|
channel:
|
||||||
|
description: 'Channel to download the SDK components from - `stable`, `beta`, `dev`, `canary`'
|
||||||
|
default: 'stable'
|
||||||
|
script:
|
||||||
|
description: 'custom script to run - e.g. `./gradlew connectedCheck`'
|
||||||
|
required: true
|
||||||
|
default: './gradlew connectedDebugAndroidTest'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ${{ github.event.inputs.os }}
|
||||||
|
env:
|
||||||
|
JAVA_TOOL_OPTIONS: -Xmx4g
|
||||||
|
timeout-minutes: 15
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: validate gradle wrapper
|
||||||
|
uses: gradle/wrapper-validation-action@v1
|
||||||
|
|
||||||
|
- name: build, test and lint
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
npm run lint
|
||||||
|
npm test
|
||||||
|
|
||||||
|
- name: Java 15
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 15
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.gradle/caches
|
||||||
|
~/.gradle/wrapper
|
||||||
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
|
||||||
|
|
||||||
|
- name: run action
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
api-level: ${{ github.event.inputs.api-level }}
|
||||||
|
target: ${{ github.event.inputs.target }}
|
||||||
|
arch: ${{ github.event.inputs.arch }}
|
||||||
|
profile: Galaxy Nexus
|
||||||
|
emulator-options: ${{ github.event.inputs.emulator-options }}
|
||||||
|
emulator-build: ${{ github.event.inputs.emulator-build }}
|
||||||
|
channel: ${{ github.event.inputs.channel }}
|
||||||
|
working-directory: ./test-fixture/
|
||||||
|
script: ${{ github.event.inputs.script }}
|
||||||
@@ -1,5 +1,23 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## v2.21.0
|
||||||
|
|
||||||
|
* Support new [ATD](https://developer.android.com/studio/preview/features#gmd-atd) targets optimized to reduce CPU and memory resources when running instrumented tests: `aosp_atd`, `google_atd`. - [#198](https://github.com/ReactiveCircus/android-emulator-runner/pull/198). Note that currently these targets require the following:
|
||||||
|
* `api-level: 30`
|
||||||
|
* `arch: x86` or `arch: arm64-v8a`
|
||||||
|
* `channel: canary`
|
||||||
|
|
||||||
|
## v2.20.0
|
||||||
|
|
||||||
|
* Support non-mobile targets: `android-wear`, `android-wear-cn`, `android-tv` and `google-tv`. - [#180](https://github.com/ReactiveCircus/android-emulator-runner/pull/180) @alexvanyo.
|
||||||
|
* Update SDK command-line tools to `5.0`. - [#174](https://github.com/ReactiveCircus/android-emulator-runner/pull/174)
|
||||||
|
* Update build tools to `31.0.0`. - [#174](https://github.com/ReactiveCircus/android-emulator-runner/pull/174)
|
||||||
|
* Add option to specify the `channel` to download SDK components from: `stable` (default), `beta`, `dev` and `canary`. - [#185](https://github.com/ReactiveCircus/android-emulator-runner/pull/185)
|
||||||
|
|
||||||
|
## v2.19.1
|
||||||
|
|
||||||
|
* Accept all Android SDK Licenses to fix `sdkmanager` installation. - [#172](https://github.com/ReactiveCircus/android-emulator-runner/pull/172) @marcuspridham.
|
||||||
|
|
||||||
## v2.19.0
|
## v2.19.0
|
||||||
|
|
||||||
* Add option to specify `ram-size` for the AVD. - [#165](https://github.com/ReactiveCircus/android-emulator-runner/pull/165).
|
* Add option to specify `ram-size` for the AVD. - [#165](https://github.com/ReactiveCircus/android-emulator-runner/pull/165).
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ jobs:
|
|||||||
| `working-directory` | Optional | `./` | A custom working directory - e.g. `./android` if your root Gradle project is under the `./android` sub-directory within your repository. |
|
| `working-directory` | Optional | `./` | A custom working directory - e.g. `./android` if your root Gradle project is under the `./android` sub-directory within your repository. |
|
||||||
| `ndk` | Optional | N/A | Version of NDK to install - e.g. `21.0.6113669` |
|
| `ndk` | Optional | N/A | Version of NDK to install - e.g. `21.0.6113669` |
|
||||||
| `cmake` | Optional | N/A | Version of CMake to install - e.g. `3.10.2.4988404` |
|
| `cmake` | Optional | N/A | Version of CMake to install - e.g. `3.10.2.4988404` |
|
||||||
|
| `channel` | Optional | stable | Channel to download the SDK components from - `stable`, `beta`, `dev`, `canary` |
|
||||||
| `script` | Required | N/A | Custom script to run - e.g. to run Android instrumented tests on the emulator: `./gradlew connectedCheck` |
|
| `script` | Required | N/A | Custom script to run - e.g. to run Android instrumented tests on the emulator: `./gradlew connectedCheck` |
|
||||||
|
|
||||||
Default `emulator-options`: `-no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim`.
|
Default `emulator-options`: `-no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim`.
|
||||||
@@ -200,5 +201,8 @@ These are some of the open-source projects using (or used) **Android Emulator Ru
|
|||||||
- [wikimedia/apps-android-wikipedia](https://github.com/wikimedia/apps-android-wikipedia/blob/master/.github/workflows)
|
- [wikimedia/apps-android-wikipedia](https://github.com/wikimedia/apps-android-wikipedia/blob/master/.github/workflows)
|
||||||
- [google/android-fhir](https://github.com/google/android-fhir/tree/master/.github/workflows)
|
- [google/android-fhir](https://github.com/google/android-fhir/tree/master/.github/workflows)
|
||||||
- [google/accompanist](https://github.com/google/accompanist/blob/main/.github/workflows)
|
- [google/accompanist](https://github.com/google/accompanist/blob/main/.github/workflows)
|
||||||
|
- [dotanuki-labs/norris](https://github.com/dotanuki-labs/norris/blob/master/.github/workflows/main.yml)
|
||||||
|
- [tinylog-org/tinylog](https://github.com/tinylog-org/tinylog/blob/v3.0/.github/workflows/build.yaml)
|
||||||
|
- [hzi-braunschweig/SORMAS-Project](https://github.com/hzi-braunschweig/SORMAS-Project/blob/development/.github/workflows/sormas_app_ci.yml)
|
||||||
|
|
||||||
If you are using **Android Emulator Runner** and want your project included in the list, please feel free to create an issue or open a pull request.
|
If you are using **Android Emulator Runner** and want your project included in the list, please feel free to create an issue or open a pull request.
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import * as mapper from '../src/channel-id-mapper';
|
||||||
|
|
||||||
|
describe('channel id mapper tests', () => {
|
||||||
|
it('Throws if channelName is unknown', () => {
|
||||||
|
const func = () => {
|
||||||
|
mapper.getChannelId('unknown-channel');
|
||||||
|
};
|
||||||
|
expect(func).toThrowError(`Unexpected channel name: 'unknown-channel'.`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Returns expected channelId from channelName', () => {
|
||||||
|
expect(mapper.getChannelId('stable')).toBe(0);
|
||||||
|
expect(mapper.getChannelId('beta')).toBe(1);
|
||||||
|
expect(mapper.getChannelId('dev')).toBe(2);
|
||||||
|
expect(mapper.getChannelId('canary')).toBe(3);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -55,9 +55,39 @@ describe('target validator tests', () => {
|
|||||||
expect(func2).not.toThrow();
|
expect(func2).not.toThrow();
|
||||||
|
|
||||||
const func3 = () => {
|
const func3 = () => {
|
||||||
validator.checkTarget('google_apis');
|
validator.checkTarget('aosp_atd');
|
||||||
};
|
};
|
||||||
expect(func3).not.toThrow();
|
expect(func3).not.toThrow();
|
||||||
|
|
||||||
|
const func4 = () => {
|
||||||
|
validator.checkTarget('google_atd');
|
||||||
|
};
|
||||||
|
expect(func4).not.toThrow();
|
||||||
|
|
||||||
|
const func5 = () => {
|
||||||
|
validator.checkTarget('google_apis_playstore');
|
||||||
|
};
|
||||||
|
expect(func5).not.toThrow();
|
||||||
|
|
||||||
|
const func6 = () => {
|
||||||
|
validator.checkTarget('android-wear');
|
||||||
|
};
|
||||||
|
expect(func6).not.toThrow();
|
||||||
|
|
||||||
|
const func7 = () => {
|
||||||
|
validator.checkTarget('android-wear-cn');
|
||||||
|
};
|
||||||
|
expect(func7).not.toThrow();
|
||||||
|
|
||||||
|
const func8 = () => {
|
||||||
|
validator.checkTarget('android-tv');
|
||||||
|
};
|
||||||
|
expect(func8).not.toThrow();
|
||||||
|
|
||||||
|
const func9 = () => {
|
||||||
|
validator.checkTarget('google-tv');
|
||||||
|
};
|
||||||
|
expect(func9).not.toThrow();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -82,6 +112,37 @@ describe('arch validator tests', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('channel validator tests', () => {
|
||||||
|
it('Throws if channel is unknown', () => {
|
||||||
|
const func = () => {
|
||||||
|
validator.checkChannel('some-channel');
|
||||||
|
};
|
||||||
|
expect(func).toThrowError(`Value for input.channel 'some-channel' is unknown. Supported options: ${validator.VALID_CHANNELS}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Validates successfully with valid channel', () => {
|
||||||
|
const func1 = () => {
|
||||||
|
validator.checkChannel('stable');
|
||||||
|
};
|
||||||
|
expect(func1).not.toThrow();
|
||||||
|
|
||||||
|
const func2 = () => {
|
||||||
|
validator.checkChannel('beta');
|
||||||
|
};
|
||||||
|
expect(func2).not.toThrow();
|
||||||
|
|
||||||
|
const func3 = () => {
|
||||||
|
validator.checkChannel('dev');
|
||||||
|
};
|
||||||
|
expect(func3).not.toThrow();
|
||||||
|
|
||||||
|
const func4 = () => {
|
||||||
|
validator.checkChannel('canary');
|
||||||
|
};
|
||||||
|
expect(func4).not.toThrow();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('force-avd-creation validator tests', () => {
|
describe('force-avd-creation validator tests', () => {
|
||||||
it('Throws if force-avd-creation is not a boolean', () => {
|
it('Throws if force-avd-creation is not a boolean', () => {
|
||||||
const func = () => {
|
const func = () => {
|
||||||
|
|||||||
+4
-1
@@ -9,7 +9,7 @@ inputs:
|
|||||||
description: 'API level of the platform and system image - e.g. 23 for Android Marshmallow, 29 for Android 10'
|
description: 'API level of the platform and system image - e.g. 23 for Android Marshmallow, 29 for Android 10'
|
||||||
required: true
|
required: true
|
||||||
target:
|
target:
|
||||||
description: 'target of the system image - default, google_apis or playstore'
|
description: 'target of the system image - default, google_apis, google_apis_playstore, aosp_atd, google_atd, android-wear, android-wear-cn, android-tv or google-tv'
|
||||||
default: 'default'
|
default: 'default'
|
||||||
arch:
|
arch:
|
||||||
description: 'CPU architecture of the system image - x86, x86_64 or arm64-v8a'
|
description: 'CPU architecture of the system image - x86, x86_64 or arm64-v8a'
|
||||||
@@ -49,6 +49,9 @@ inputs:
|
|||||||
description: 'version of NDK to install - e.g. 21.0.6113669'
|
description: 'version of NDK to install - e.g. 21.0.6113669'
|
||||||
cmake:
|
cmake:
|
||||||
description: 'version of CMake to install - e.g. 3.10.2.4988404'
|
description: 'version of CMake to install - e.g. 3.10.2.4988404'
|
||||||
|
channel:
|
||||||
|
description: 'Channel to download the SDK components from - `stable`, `beta`, `dev`, `canary`'
|
||||||
|
default: 'stable'
|
||||||
script:
|
script:
|
||||||
description: 'custom script to run - e.g. `./gradlew connectedCheck`'
|
description: 'custom script to run - e.g. `./gradlew connectedCheck`'
|
||||||
required: true
|
required: true
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.getChannelId = void 0;
|
||||||
|
function getChannelId(channelName) {
|
||||||
|
if (channelName === 'stable') {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if (channelName === 'beta') {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else if (channelName === 'dev') {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
else if (channelName === 'canary') {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new Error(`Unexpected channel name: '${channelName}'.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.getChannelId = getChannelId;
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
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;
|
exports.checkEmulatorBuild = exports.checkDisableLinuxHardwareAcceleration = exports.checkDisableSpellchecker = exports.checkDisableAnimations = exports.checkForceAvdCreation = exports.checkChannel = exports.checkArch = exports.checkTarget = exports.checkApiLevel = exports.VALID_CHANNELS = exports.VALID_ARCHS = exports.VALID_TARGETS = exports.MIN_API_LEVEL = void 0;
|
||||||
exports.MIN_API_LEVEL = 15;
|
exports.MIN_API_LEVEL = 15;
|
||||||
exports.VALID_TARGETS = ['default', 'google_apis', 'google_apis_playstore'];
|
exports.VALID_TARGETS = ['default', 'google_apis', 'aosp_atd', 'google_atd', 'google_apis_playstore', 'android-wear', 'android-wear-cn', 'android-tv', 'google-tv'];
|
||||||
exports.VALID_ARCHS = ['x86', 'x86_64', 'arm64-v8a'];
|
exports.VALID_ARCHS = ['x86', 'x86_64', 'arm64-v8a'];
|
||||||
|
exports.VALID_CHANNELS = ['stable', 'beta', 'dev', 'canary'];
|
||||||
function checkApiLevel(apiLevel) {
|
function checkApiLevel(apiLevel) {
|
||||||
if (isNaN(Number(apiLevel)) || !Number.isInteger(Number(apiLevel))) {
|
if (isNaN(Number(apiLevel)) || !Number.isInteger(Number(apiLevel))) {
|
||||||
throw new Error(`Unexpected API level: '${apiLevel}'.`);
|
throw new Error(`Unexpected API level: '${apiLevel}'.`);
|
||||||
@@ -25,6 +26,12 @@ function checkArch(arch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.checkArch = checkArch;
|
exports.checkArch = checkArch;
|
||||||
|
function checkChannel(channel) {
|
||||||
|
if (!exports.VALID_CHANNELS.includes(channel)) {
|
||||||
|
throw new Error(`Value for input.channel '${channel}' is unknown. Supported options: ${exports.VALID_CHANNELS}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.checkChannel = checkChannel;
|
||||||
function checkForceAvdCreation(forceAvdCreation) {
|
function checkForceAvdCreation(forceAvdCreation) {
|
||||||
if (!isValidBoolean(forceAvdCreation)) {
|
if (!isValidBoolean(forceAvdCreation)) {
|
||||||
throw new Error(`Input for input.force-avd-creation should be either 'true' or 'false'.`);
|
throw new Error(`Input for input.force-avd-creation should be either 'true' or 'false'.`);
|
||||||
|
|||||||
+7
-1
@@ -34,6 +34,7 @@ const input_validator_1 = require("./input-validator");
|
|||||||
const emulator_manager_1 = require("./emulator-manager");
|
const emulator_manager_1 = require("./emulator-manager");
|
||||||
const exec = __importStar(require("@actions/exec"));
|
const exec = __importStar(require("@actions/exec"));
|
||||||
const script_parser_1 = require("./script-parser");
|
const script_parser_1 = require("./script-parser");
|
||||||
|
const channel_id_mapper_1 = require("./channel-id-mapper");
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
@@ -123,6 +124,11 @@ function run() {
|
|||||||
console.log(`version of CMake to install: ${cmakeInput}`);
|
console.log(`version of CMake to install: ${cmakeInput}`);
|
||||||
}
|
}
|
||||||
const cmakeVersion = !cmakeInput ? undefined : cmakeInput;
|
const cmakeVersion = !cmakeInput ? undefined : cmakeInput;
|
||||||
|
// channelId (up to and including) to download the SDK packages from
|
||||||
|
const channelName = core.getInput('channel');
|
||||||
|
input_validator_1.checkChannel(channelName);
|
||||||
|
const channelId = channel_id_mapper_1.getChannelId(channelName);
|
||||||
|
console.log(`Channel: ${channelId} (${channelName})`);
|
||||||
// custom script to run
|
// custom script to run
|
||||||
const scriptInput = core.getInput('script', { required: true });
|
const scriptInput = core.getInput('script', { required: true });
|
||||||
const scripts = script_parser_1.parseScript(scriptInput);
|
const scripts = script_parser_1.parseScript(scriptInput);
|
||||||
@@ -131,7 +137,7 @@ function run() {
|
|||||||
console.log(`${script}`);
|
console.log(`${script}`);
|
||||||
}));
|
}));
|
||||||
// install SDK
|
// install SDK
|
||||||
yield sdk_installer_1.installAndroidSdk(apiLevel, target, arch, emulatorBuild, ndkVersion, cmakeVersion);
|
yield sdk_installer_1.installAndroidSdk(apiLevel, target, arch, channelId, emulatorBuild, ndkVersion, cmakeVersion);
|
||||||
// launch an emulator
|
// launch an emulator
|
||||||
yield emulator_manager_1.launchEmulator(apiLevel, target, arch, profile, cores, ramSize, sdcardPathOrSize, avdName, forceAvdCreation, emulatorOptions, disableAnimations, disableSpellchecker, disableLinuxHardwareAcceleration);
|
yield emulator_manager_1.launchEmulator(apiLevel, target, arch, profile, cores, ramSize, sdcardPathOrSize, avdName, forceAvdCreation, emulatorOptions, disableAnimations, disableSpellchecker, disableLinuxHardwareAcceleration);
|
||||||
// execute the custom script
|
// execute the custom script
|
||||||
|
|||||||
+10
-21
@@ -34,14 +34,14 @@ const exec = __importStar(require("@actions/exec"));
|
|||||||
const io = __importStar(require("@actions/io"));
|
const io = __importStar(require("@actions/io"));
|
||||||
const tc = __importStar(require("@actions/tool-cache"));
|
const tc = __importStar(require("@actions/tool-cache"));
|
||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const BUILD_TOOLS_VERSION = '30.0.3';
|
const BUILD_TOOLS_VERSION = '31.0.0';
|
||||||
const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-6858069_latest.zip';
|
const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-7583922_latest.zip';
|
||||||
const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip';
|
const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-7583922_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,
|
* 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.
|
* and the system image for the chosen API level, CPU arch, and target.
|
||||||
*/
|
*/
|
||||||
function installAndroidSdk(apiLevel, target, arch, emulatorBuild, ndkVersion, cmakeVersion) {
|
function installAndroidSdk(apiLevel, target, arch, channelId, emulatorBuild, ndkVersion, cmakeVersion) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const isOnMac = process.platform === 'darwin';
|
const isOnMac = process.platform === 'darwin';
|
||||||
if (!isOnMac) {
|
if (!isOnMac) {
|
||||||
@@ -59,20 +59,12 @@ function installAndroidSdk(apiLevel, target, arch, emulatorBuild, ndkVersion, cm
|
|||||||
core.addPath(`${cmdlineToolsPath}/latest:${cmdlineToolsPath}/latest/bin:${process.env.ANDROID_SDK_ROOT}/platform-tools`);
|
core.addPath(`${cmdlineToolsPath}/latest:${cmdlineToolsPath}/latest/bin:${process.env.ANDROID_SDK_ROOT}/platform-tools`);
|
||||||
// set standard AVD path
|
// set standard AVD path
|
||||||
core.exportVariable('ANDROID_AVD_HOME', `${process.env.HOME}/.android/avd`);
|
core.exportVariable('ANDROID_AVD_HOME', `${process.env.HOME}/.android/avd`);
|
||||||
// additional permission and license requirements for Linux
|
// accept all Android SDK licenses
|
||||||
const sdkPreviewLicensePath = `${process.env.ANDROID_SDK_ROOT}/licenses/android-sdk-preview-license`;
|
yield exec.exec(`sh -c \\"yes | sdkmanager --licenses > /dev/null"`);
|
||||||
if (!isOnMac && !fs.existsSync(sdkPreviewLicensePath)) {
|
|
||||||
fs.writeFileSync(sdkPreviewLicensePath, '\n84831b9409646a918e30573bab4c9c91346d8abd');
|
|
||||||
}
|
|
||||||
// license required for API 30 and non-default API 28 system images
|
|
||||||
const sdkArmDbtLicensePath = `${process.env.ANDROID_SDK_ROOT}/licenses/android-sdk-arm-dbt-license`;
|
|
||||||
if (requiresArmDbtLicense(apiLevel, target) && !fs.existsSync(sdkArmDbtLicensePath)) {
|
|
||||||
fs.writeFileSync(sdkArmDbtLicensePath, '\n859f317696f67ef3d7f30a50a5560e7834b43903');
|
|
||||||
}
|
|
||||||
console.log('Installing latest build tools, platform tools, and platform.');
|
console.log('Installing latest build tools, platform tools, and platform.');
|
||||||
yield exec.exec(`sh -c \\"sdkmanager --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"`);
|
||||||
console.log('Installing latest emulator.');
|
console.log('Installing latest emulator.');
|
||||||
yield exec.exec(`sh -c \\"sdkmanager --install emulator > /dev/null"`);
|
yield exec.exec(`sh -c \\"sdkmanager --install emulator --channel=${channelId} > /dev/null"`);
|
||||||
if (emulatorBuild) {
|
if (emulatorBuild) {
|
||||||
console.log(`Installing emulator build ${emulatorBuild}.`);
|
console.log(`Installing emulator build ${emulatorBuild}.`);
|
||||||
// TODO find out the correct download URLs for all build ids
|
// TODO find out the correct download URLs for all build ids
|
||||||
@@ -82,18 +74,15 @@ function installAndroidSdk(apiLevel, target, arch, emulatorBuild, ndkVersion, cm
|
|||||||
yield io.rmRF('emulator.zip');
|
yield io.rmRF('emulator.zip');
|
||||||
}
|
}
|
||||||
console.log('Installing system images.');
|
console.log('Installing system images.');
|
||||||
yield exec.exec(`sh -c \\"sdkmanager --install 'system-images;android-${apiLevel};${target};${arch}' > /dev/null"`);
|
yield exec.exec(`sh -c \\"sdkmanager --install 'system-images;android-${apiLevel};${target};${arch}' --channel=${channelId} > /dev/null"`);
|
||||||
if (ndkVersion) {
|
if (ndkVersion) {
|
||||||
console.log(`Installing NDK ${ndkVersion}.`);
|
console.log(`Installing NDK ${ndkVersion}.`);
|
||||||
yield exec.exec(`sh -c \\"sdkmanager --install 'ndk;${ndkVersion}' > /dev/null"`);
|
yield exec.exec(`sh -c \\"sdkmanager --install 'ndk;${ndkVersion}' --channel=${channelId} > /dev/null"`);
|
||||||
}
|
}
|
||||||
if (cmakeVersion) {
|
if (cmakeVersion) {
|
||||||
console.log(`Installing CMake ${cmakeVersion}.`);
|
console.log(`Installing CMake ${cmakeVersion}.`);
|
||||||
yield exec.exec(`sh -c \\"sdkmanager --install 'cmake;${cmakeVersion}' > /dev/null"`);
|
yield exec.exec(`sh -c \\"sdkmanager --install 'cmake;${cmakeVersion}' --channel=${channelId} > /dev/null"`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.installAndroidSdk = installAndroidSdk;
|
exports.installAndroidSdk = installAndroidSdk;
|
||||||
function requiresArmDbtLicense(apiLevel, target) {
|
|
||||||
return apiLevel === 30 || (apiLevel === 28 && target !== 'default');
|
|
||||||
}
|
|
||||||
|
|||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright 2019 GitHub
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright 2019 GitHub
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
Generated
+463
-360
File diff suppressed because it is too large
Load Diff
+10
-9
@@ -21,24 +21,25 @@
|
|||||||
"author": "Reactive Circus",
|
"author": "Reactive Circus",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.5.0",
|
||||||
"@actions/exec": "^1.0.4",
|
"@actions/exec": "^1.1.0",
|
||||||
"@actions/tool-cache": "^1.6.1",
|
"@actions/tool-cache": "^1.7.1",
|
||||||
"minimist": "^1.2.5"
|
"minimist": "^1.2.5",
|
||||||
|
"set-value": "^4.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^24.9.1",
|
"@types/jest": "^24.9.1",
|
||||||
"@types/node": "^12.19.11",
|
"@types/node": "^12.20.25",
|
||||||
"@typescript-eslint/eslint-plugin": "^2.34.0",
|
"@typescript-eslint/eslint-plugin": "^2.34.0",
|
||||||
"@typescript-eslint/parser": "^2.34.0",
|
"@typescript-eslint/parser": "^2.34.0",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"eslint-config-prettier": "^6.15.0",
|
"eslint-config-prettier": "^6.15.0",
|
||||||
"eslint-plugin-import": "^2.22.1",
|
"eslint-plugin-import": "^2.24.2",
|
||||||
"eslint-plugin-prettier": "^3.3.0",
|
"eslint-plugin-prettier": "^3.4.1",
|
||||||
"jest": "^26.6.3",
|
"jest": "^26.6.3",
|
||||||
"jest-circus": "^25.5.4",
|
"jest-circus": "^25.5.4",
|
||||||
"prettier": "^1.19.1",
|
"prettier": "^1.19.1",
|
||||||
"ts-jest": "^26.4.4",
|
"ts-jest": "^26.5.6",
|
||||||
"typescript": "^3.9.7"
|
"typescript": "^3.9.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
export function getChannelId(channelName: string): number {
|
||||||
|
if (channelName === 'stable') {
|
||||||
|
return 0;
|
||||||
|
} else if (channelName === 'beta') {
|
||||||
|
return 1;
|
||||||
|
} else if (channelName === 'dev') {
|
||||||
|
return 2;
|
||||||
|
} else if (channelName === 'canary') {
|
||||||
|
return 3;
|
||||||
|
} else {
|
||||||
|
throw new Error(`Unexpected channel name: '${channelName}'.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
export const MIN_API_LEVEL = 15;
|
export const MIN_API_LEVEL = 15;
|
||||||
export const VALID_TARGETS: Array<string> = ['default', 'google_apis', 'google_apis_playstore'];
|
export const VALID_TARGETS: Array<string> = ['default', 'google_apis', 'aosp_atd', 'google_atd', 'google_apis_playstore', 'android-wear', 'android-wear-cn', 'android-tv', 'google-tv'];
|
||||||
export const VALID_ARCHS: Array<string> = ['x86', 'x86_64', 'arm64-v8a'];
|
export const VALID_ARCHS: Array<string> = ['x86', 'x86_64', 'arm64-v8a'];
|
||||||
|
export const VALID_CHANNELS: Array<string> = ['stable', 'beta', 'dev', 'canary'];
|
||||||
|
|
||||||
export function checkApiLevel(apiLevel: string): void {
|
export function checkApiLevel(apiLevel: string): void {
|
||||||
if (isNaN(Number(apiLevel)) || !Number.isInteger(Number(apiLevel))) {
|
if (isNaN(Number(apiLevel)) || !Number.isInteger(Number(apiLevel))) {
|
||||||
@@ -23,6 +24,12 @@ export function checkArch(arch: string): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function checkChannel(channel: string): void {
|
||||||
|
if (!VALID_CHANNELS.includes(channel)) {
|
||||||
|
throw new Error(`Value for input.channel '${channel}' is unknown. Supported options: ${VALID_CHANNELS}.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function checkForceAvdCreation(forceAvdCreation: string): void {
|
export function checkForceAvdCreation(forceAvdCreation: string): void {
|
||||||
if (!isValidBoolean(forceAvdCreation)) {
|
if (!isValidBoolean(forceAvdCreation)) {
|
||||||
throw new Error(`Input for input.force-avd-creation should be either 'true' or 'false'.`);
|
throw new Error(`Input for input.force-avd-creation should be either 'true' or 'false'.`);
|
||||||
|
|||||||
+10
-2
@@ -8,11 +8,13 @@ import {
|
|||||||
checkEmulatorBuild,
|
checkEmulatorBuild,
|
||||||
checkDisableSpellchecker,
|
checkDisableSpellchecker,
|
||||||
checkDisableLinuxHardwareAcceleration,
|
checkDisableLinuxHardwareAcceleration,
|
||||||
checkForceAvdCreation
|
checkForceAvdCreation,
|
||||||
|
checkChannel
|
||||||
} from './input-validator';
|
} from './input-validator';
|
||||||
import { launchEmulator, killEmulator } from './emulator-manager';
|
import { launchEmulator, killEmulator } from './emulator-manager';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
import { parseScript } from './script-parser';
|
import { parseScript } from './script-parser';
|
||||||
|
import { getChannelId } from './channel-id-mapper';
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
@@ -121,6 +123,12 @@ async function run() {
|
|||||||
}
|
}
|
||||||
const cmakeVersion = !cmakeInput ? undefined : cmakeInput;
|
const cmakeVersion = !cmakeInput ? undefined : cmakeInput;
|
||||||
|
|
||||||
|
// channelId (up to and including) to download the SDK packages from
|
||||||
|
const channelName = core.getInput('channel');
|
||||||
|
checkChannel(channelName);
|
||||||
|
const channelId = getChannelId(channelName);
|
||||||
|
console.log(`Channel: ${channelId} (${channelName})`);
|
||||||
|
|
||||||
// custom script to run
|
// custom script to run
|
||||||
const scriptInput = core.getInput('script', { required: true });
|
const scriptInput = core.getInput('script', { required: true });
|
||||||
const scripts = parseScript(scriptInput);
|
const scripts = parseScript(scriptInput);
|
||||||
@@ -130,7 +138,7 @@ async function run() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// install SDK
|
// install SDK
|
||||||
await installAndroidSdk(apiLevel, target, arch, emulatorBuild, ndkVersion, cmakeVersion);
|
await installAndroidSdk(apiLevel, target, arch, channelId, emulatorBuild, ndkVersion, cmakeVersion);
|
||||||
|
|
||||||
// launch an emulator
|
// launch an emulator
|
||||||
await launchEmulator(
|
await launchEmulator(
|
||||||
|
|||||||
+10
-23
@@ -4,15 +4,15 @@ import * as io from '@actions/io';
|
|||||||
import * as tc from '@actions/tool-cache';
|
import * as tc from '@actions/tool-cache';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|
||||||
const BUILD_TOOLS_VERSION = '30.0.3';
|
const BUILD_TOOLS_VERSION = '31.0.0';
|
||||||
const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-6858069_latest.zip';
|
const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-7583922_latest.zip';
|
||||||
const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip';
|
const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-7583922_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,
|
* 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.
|
* 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, ndkVersion?: string, cmakeVersion?: string): Promise<void> {
|
export async function installAndroidSdk(apiLevel: number, target: string, arch: string, channelId: number, emulatorBuild?: string, ndkVersion?: string, cmakeVersion?: string): Promise<void> {
|
||||||
const isOnMac = process.platform === 'darwin';
|
const isOnMac = process.platform === 'darwin';
|
||||||
|
|
||||||
if (!isOnMac) {
|
if (!isOnMac) {
|
||||||
@@ -34,24 +34,15 @@ export async function installAndroidSdk(apiLevel: number, target: string, arch:
|
|||||||
// set standard AVD path
|
// set standard AVD path
|
||||||
core.exportVariable('ANDROID_AVD_HOME', `${process.env.HOME}/.android/avd`);
|
core.exportVariable('ANDROID_AVD_HOME', `${process.env.HOME}/.android/avd`);
|
||||||
|
|
||||||
// additional permission and license requirements for Linux
|
// accept all Android SDK licenses
|
||||||
const sdkPreviewLicensePath = `${process.env.ANDROID_SDK_ROOT}/licenses/android-sdk-preview-license`;
|
await exec.exec(`sh -c \\"yes | sdkmanager --licenses > /dev/null"`);
|
||||||
if (!isOnMac && !fs.existsSync(sdkPreviewLicensePath)) {
|
|
||||||
fs.writeFileSync(sdkPreviewLicensePath, '\n84831b9409646a918e30573bab4c9c91346d8abd');
|
|
||||||
}
|
|
||||||
|
|
||||||
// license required for API 30 and non-default API 28 system images
|
|
||||||
const sdkArmDbtLicensePath = `${process.env.ANDROID_SDK_ROOT}/licenses/android-sdk-arm-dbt-license`;
|
|
||||||
if (requiresArmDbtLicense(apiLevel, target) && !fs.existsSync(sdkArmDbtLicensePath)) {
|
|
||||||
fs.writeFileSync(sdkArmDbtLicensePath, '\n859f317696f67ef3d7f30a50a5560e7834b43903');
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('Installing latest build tools, platform tools, and platform.');
|
console.log('Installing latest build tools, platform tools, and platform.');
|
||||||
|
|
||||||
await exec.exec(`sh -c \\"sdkmanager --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"`);
|
||||||
|
|
||||||
console.log('Installing latest emulator.');
|
console.log('Installing latest emulator.');
|
||||||
await exec.exec(`sh -c \\"sdkmanager --install emulator > /dev/null"`);
|
await exec.exec(`sh -c \\"sdkmanager --install emulator --channel=${channelId} > /dev/null"`);
|
||||||
|
|
||||||
if (emulatorBuild) {
|
if (emulatorBuild) {
|
||||||
console.log(`Installing emulator build ${emulatorBuild}.`);
|
console.log(`Installing emulator build ${emulatorBuild}.`);
|
||||||
@@ -62,18 +53,14 @@ export async function installAndroidSdk(apiLevel: number, target: string, arch:
|
|||||||
await io.rmRF('emulator.zip');
|
await io.rmRF('emulator.zip');
|
||||||
}
|
}
|
||||||
console.log('Installing system images.');
|
console.log('Installing system images.');
|
||||||
await exec.exec(`sh -c \\"sdkmanager --install 'system-images;android-${apiLevel};${target};${arch}' > /dev/null"`);
|
await exec.exec(`sh -c \\"sdkmanager --install 'system-images;android-${apiLevel};${target};${arch}' --channel=${channelId} > /dev/null"`);
|
||||||
|
|
||||||
if (ndkVersion) {
|
if (ndkVersion) {
|
||||||
console.log(`Installing NDK ${ndkVersion}.`);
|
console.log(`Installing NDK ${ndkVersion}.`);
|
||||||
await exec.exec(`sh -c \\"sdkmanager --install 'ndk;${ndkVersion}' > /dev/null"`);
|
await exec.exec(`sh -c \\"sdkmanager --install 'ndk;${ndkVersion}' --channel=${channelId} > /dev/null"`);
|
||||||
}
|
}
|
||||||
if (cmakeVersion) {
|
if (cmakeVersion) {
|
||||||
console.log(`Installing CMake ${cmakeVersion}.`);
|
console.log(`Installing CMake ${cmakeVersion}.`);
|
||||||
await exec.exec(`sh -c \\"sdkmanager --install 'cmake;${cmakeVersion}' > /dev/null"`);
|
await exec.exec(`sh -c \\"sdkmanager --install 'cmake;${cmakeVersion}' --channel=${channelId} > /dev/null"`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function requiresArmDbtLicense(apiLevel: number, target: string): boolean {
|
|
||||||
return apiLevel === 30 || (apiLevel === 28 && target !== 'default');
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ apply plugin: 'com.android.application'
|
|||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 31
|
||||||
buildToolsVersion "30.0.3"
|
buildToolsVersion "31.0.0"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.example.testapp"
|
applicationId "com.example.testapp"
|
||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
targetSdkVersion 30
|
targetSdkVersion 31
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
|
||||||
@@ -26,10 +26,7 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
implementation 'androidx.appcompat:appcompat:1.3.0'
|
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||||
implementation 'androidx.core:core-ktx:1.5.0'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||||
testImplementation 'junit:junit:4.13'
|
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,9 @@
|
|||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity android:name="com.example.testapp.MainActivity">
|
<activity
|
||||||
|
android:name="com.example.testapp.MainActivity"
|
||||||
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -10,9 +10,6 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Hello World!"
|
android:text="Hello World!"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:layout_gravity="center" />
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</FrameLayout>
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.5.10'
|
ext.kotlin_version = '1.5.30'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:4.2.1'
|
classpath 'com.android.tools.build:gradle:7.0.1'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
|||||||
+1
-1
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||||
|
|||||||
Reference in New Issue
Block a user