Compare commits

...

7 Commits

Author SHA1 Message Date
Yang b390b0e116 Merge branch 'main' into release/v2
* main:
  Prepare for release 2.25.0.
  Check in missing compiled js file.
  Auto detect hardware acceleration on Linux (#254)
  Build tools 33.0.0. Update test fixture dependencies.
  Update Kotlin and AGP in test-fixture.
  SDK command-line tools 7.0.
2022-07-12 18:48:20 +10:00
Yang 402c25e52e Prepare for release 2.25.0. 2022-07-12 18:43:26 +10:00
Yang cd41888947 Check in missing compiled js file. 2022-07-12 18:38:58 +10:00
notbigdata 7809d88d54 Auto detect hardware acceleration on Linux (#254) 2022-07-12 18:32:26 +10:00
Yang a9c993651c Build tools 33.0.0. Update test fixture dependencies. 2022-06-17 23:54:56 +10:00
Yang f1d9765a2a Update Kotlin and AGP in test-fixture. 2022-05-26 11:29:00 +10:00
Yang eb6b0c0524 SDK command-line tools 7.0. 2022-05-14 17:17:56 +10:00
12 changed files with 60 additions and 28 deletions
+6
View File
@@ -1,5 +1,11 @@
# Change Log # Change Log
## v2.25.0
* Auto detect hardware acceleration on Linux. - [#254](https://github.com/ReactiveCircus/android-emulator-runner/pull/254) @notbigdata.
* Update build tools to `33.0.0`.
* Update SDK command-line tools to `7.0`.
## v2.24.0 ## v2.24.0
* Add option to specify `heap-size` for the AVD. - [#245](https://github.com/ReactiveCircus/android-emulator-runner/pull/245) @timusus. * Add option to specify `heap-size` for the AVD. - [#245](https://github.com/ReactiveCircus/android-emulator-runner/pull/245) @timusus.
+7 -2
View File
@@ -211,10 +211,10 @@ describe('disable-linux-hw-accel validator tests', () => {
const func = () => { const func = () => {
validator.checkDisableLinuxHardwareAcceleration('yes'); validator.checkDisableLinuxHardwareAcceleration('yes');
}; };
expect(func).toThrowError(`Input for input.disable-linux-hw-accel should be either 'true' or 'false'.`); expect(func).toThrowError(`Input for input.disable-linux-hw-accel should be either 'true' or 'false' or 'auto'.`);
}); });
it('Validates successfully if disable-linux-hw-accel is either true or false', () => { it('Validates successfully if disable-linux-hw-accel is either true or false or auto', () => {
const func1 = () => { const func1 = () => {
validator.checkDisableLinuxHardwareAcceleration('true'); validator.checkDisableLinuxHardwareAcceleration('true');
}; };
@@ -224,6 +224,11 @@ describe('disable-linux-hw-accel validator tests', () => {
validator.checkDisableLinuxHardwareAcceleration('false'); validator.checkDisableLinuxHardwareAcceleration('false');
}; };
expect(func2).not.toThrow(); expect(func2).not.toThrow();
const func3 = () => {
validator.checkDisableLinuxHardwareAcceleration('auto');
};
expect(func3).not.toThrow();
}); });
}); });
+2 -2
View File
@@ -43,8 +43,8 @@ inputs:
description: 'whether to disable spellchecker - `true` or `false`' description: 'whether to disable spellchecker - `true` or `false`'
default: 'false' default: 'false'
disable-linux-hw-accel: disable-linux-hw-accel:
description: 'whether to disable hardware acceleration on Linux machines - `true` or `false`' description: 'whether to disable hardware acceleration on Linux machines - `true` or `false` or `auto`'
default: 'true' default: 'auto'
enable-hw-keyboard: enable-hw-keyboard:
description: 'whether to enable hardware keyboard - `true` or `false`.' description: 'whether to enable hardware keyboard - `true` or `false`.'
default: 'false' default: 'false'
+2 -2
View File
@@ -51,8 +51,8 @@ function checkDisableSpellchecker(disableSpellchecker) {
} }
exports.checkDisableSpellchecker = checkDisableSpellchecker; exports.checkDisableSpellchecker = checkDisableSpellchecker;
function checkDisableLinuxHardwareAcceleration(disableLinuxHardwareAcceleration) { function checkDisableLinuxHardwareAcceleration(disableLinuxHardwareAcceleration) {
if (!isValidBoolean(disableLinuxHardwareAcceleration)) { if (!(isValidBoolean(disableLinuxHardwareAcceleration) || disableLinuxHardwareAcceleration === 'auto')) {
throw new Error(`Input for input.disable-linux-hw-accel should be either 'true' or 'false'.`); throw new Error(`Input for input.disable-linux-hw-accel should be either 'true' or 'false' or 'auto'.`);
} }
} }
exports.checkDisableLinuxHardwareAcceleration = checkDisableLinuxHardwareAcceleration; exports.checkDisableLinuxHardwareAcceleration = checkDisableLinuxHardwareAcceleration;
+13 -2
View File
@@ -35,14 +35,22 @@ 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"); const channel_id_mapper_1 = require("./channel-id-mapper");
const fs_1 = require("fs");
function run() { function run() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
try { try {
console.log(`::group::Configure emulator`); console.log(`::group::Configure emulator`);
let linuxSupportKVM = false;
// only support running on macOS or Linux // only support running on macOS or Linux
if (process.platform !== 'darwin') { if (process.platform !== 'darwin') {
if (process.platform === 'linux') { if (process.platform === 'linux') {
console.warn(`You're running a Linux VM where hardware acceleration is not available. Please consider using a macOS VM instead to take advantage of native hardware acceleration support provided by HAXM.`); try {
fs_1.accessSync('/dev/kvm', fs_1.constants.R_OK | fs_1.constants.W_OK);
linuxSupportKVM = true;
}
catch (_a) {
console.warn(`You're running a Linux VM where hardware acceleration is not available. Please consider using a macOS VM instead to take advantage of native hardware acceleration support provided by HAXM.`);
}
} }
else { else {
throw new Error('Unsupported virtual machine: please use either macos or ubuntu VM.'); throw new Error('Unsupported virtual machine: please use either macos or ubuntu VM.');
@@ -102,8 +110,11 @@ function run() {
const disableSpellchecker = disableSpellcheckerInput === 'true'; const disableSpellchecker = disableSpellcheckerInput === 'true';
console.log(`disable spellchecker: ${disableSpellchecker}`); console.log(`disable spellchecker: ${disableSpellchecker}`);
// disable linux hardware acceleration // disable linux hardware acceleration
const disableLinuxHardwareAccelerationInput = core.getInput('disable-linux-hw-accel'); let disableLinuxHardwareAccelerationInput = core.getInput('disable-linux-hw-accel');
input_validator_1.checkDisableLinuxHardwareAcceleration(disableLinuxHardwareAccelerationInput); input_validator_1.checkDisableLinuxHardwareAcceleration(disableLinuxHardwareAccelerationInput);
if (disableLinuxHardwareAccelerationInput === 'auto' && process.platform === 'linux') {
disableLinuxHardwareAccelerationInput = linuxSupportKVM ? 'false' : 'true';
}
const disableLinuxHardwareAcceleration = disableLinuxHardwareAccelerationInput === 'true'; const disableLinuxHardwareAcceleration = disableLinuxHardwareAccelerationInput === 'true';
console.log(`disable Linux hardware acceleration: ${disableLinuxHardwareAcceleration}`); console.log(`disable Linux hardware acceleration: ${disableLinuxHardwareAcceleration}`);
// enable hardware keyboard // enable hardware keyboard
+3 -3
View File
@@ -34,9 +34,9 @@ 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 = '32.0.0'; const BUILD_TOOLS_VERSION = '33.0.0';
const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-8092744_latest.zip'; const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-8512546_latest.zip';
const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-8092744_latest.zip'; const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-8512546_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.
+2 -2
View File
@@ -49,8 +49,8 @@ export function checkDisableSpellchecker(disableSpellchecker: string): void {
} }
export function checkDisableLinuxHardwareAcceleration(disableLinuxHardwareAcceleration: string): void { export function checkDisableLinuxHardwareAcceleration(disableLinuxHardwareAcceleration: string): void {
if (!isValidBoolean(disableLinuxHardwareAcceleration)) { if (!(isValidBoolean(disableLinuxHardwareAcceleration) || disableLinuxHardwareAcceleration === 'auto')) {
throw new Error(`Input for input.disable-linux-hw-accel should be either 'true' or 'false'.`); throw new Error(`Input for input.disable-linux-hw-accel should be either 'true' or 'false' or 'auto'.`);
} }
} }
+14 -4
View File
@@ -17,16 +17,23 @@ 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'; import { getChannelId } from './channel-id-mapper';
import { accessSync, constants } from 'fs';
async function run() { async function run() {
try { try {
console.log(`::group::Configure emulator`); console.log(`::group::Configure emulator`);
let linuxSupportKVM = false;
// only support running on macOS or Linux // only support running on macOS or Linux
if (process.platform !== 'darwin') { if (process.platform !== 'darwin') {
if (process.platform === 'linux') { if (process.platform === 'linux') {
console.warn( try {
`You're running a Linux VM where hardware acceleration is not available. Please consider using a macOS VM instead to take advantage of native hardware acceleration support provided by HAXM.` accessSync('/dev/kvm', constants.R_OK | constants.W_OK);
); linuxSupportKVM = true;
} catch {
console.warn(
`You're running a Linux VM where hardware acceleration is not available. Please consider using a macOS VM instead to take advantage of native hardware acceleration support provided by HAXM.`
);
}
} else { } else {
throw new Error('Unsupported virtual machine: please use either macos or ubuntu VM.'); throw new Error('Unsupported virtual machine: please use either macos or ubuntu VM.');
} }
@@ -100,8 +107,11 @@ async function run() {
console.log(`disable spellchecker: ${disableSpellchecker}`); console.log(`disable spellchecker: ${disableSpellchecker}`);
// disable linux hardware acceleration // disable linux hardware acceleration
const disableLinuxHardwareAccelerationInput = core.getInput('disable-linux-hw-accel'); let disableLinuxHardwareAccelerationInput = core.getInput('disable-linux-hw-accel');
checkDisableLinuxHardwareAcceleration(disableLinuxHardwareAccelerationInput); checkDisableLinuxHardwareAcceleration(disableLinuxHardwareAccelerationInput);
if (disableLinuxHardwareAccelerationInput === 'auto' && process.platform === 'linux') {
disableLinuxHardwareAccelerationInput = linuxSupportKVM ? 'false' : 'true';
}
const disableLinuxHardwareAcceleration = disableLinuxHardwareAccelerationInput === 'true'; const disableLinuxHardwareAcceleration = disableLinuxHardwareAccelerationInput === 'true';
console.log(`disable Linux hardware acceleration: ${disableLinuxHardwareAcceleration}`); console.log(`disable Linux hardware acceleration: ${disableLinuxHardwareAcceleration}`);
+3 -3
View File
@@ -4,9 +4,9 @@ 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 = '32.0.0'; const BUILD_TOOLS_VERSION = '33.0.0';
const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-8092744_latest.zip'; const CMDLINE_TOOLS_URL_MAC = 'https://dl.google.com/android/repository/commandlinetools-mac-8512546_latest.zip';
const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-8092744_latest.zip'; const CMDLINE_TOOLS_URL_LINUX = 'https://dl.google.com/android/repository/commandlinetools-linux-8512546_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,
+3 -3
View File
@@ -2,13 +2,13 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
android { android {
compileSdkVersion 32 compileSdkVersion 33
buildToolsVersion "32.0.0" buildToolsVersion "33.0.0"
defaultConfig { defaultConfig {
applicationId "com.example.testapp" applicationId "com.example.testapp"
minSdkVersion 15 minSdkVersion 15
targetSdkVersion 32 targetSdkVersion 33
versionCode 1 versionCode 1
versionName "1.0" versionName "1.0"
+4 -4
View File
@@ -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.6.10' ext.kotlin_version = '1.7.0'
repositories { repositories {
google() google()
jcenter() mavenCentral()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.1.2' classpath 'com.android.tools.build:gradle:7.2.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
@@ -18,7 +18,7 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
google() google()
jcenter() mavenCentral()
} }
} }
+1 -1
View File
@@ -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.4.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip