Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ubuntu): specify all avd-related environment variables #410

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions lib/sdk-installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,25 @@ function installAndroidSdk(apiLevel, target, arch, channelId, emulatorBuild, ndk
}
// add paths for commandline-tools and platform-tools
core.addPath(`${cmdlineToolsPath}/latest:${cmdlineToolsPath}/latest/bin:${process.env.ANDROID_HOME}/platform-tools`);
// set standard AVD path
yield io.mkdirP(`${process.env.HOME}/.android/avd`);
core.exportVariable('ANDROID_AVD_HOME', `${process.env.HOME}/.android/avd`);
// There are several environment variables that determine where AVD config and disk images go:
// https://developer.android.com/tools/variables#envar
// Users may set these for various reasons (self-hosted runners with specific disk space situations)
// so only set them if they are not already set.
// "user preferences directory for tools that are part of the Android SDK. Defaults to $HOME/.android/."
if (!process.env.ANDROID_USER_HOME) {
core.exportVariable('ANDROID_USER_HOME', `${process.env.HOME}/.android`);
}
yield io.mkdirP(`${process.env.ANDROID_USER_HOME}`);
// "user-specific emulator configuration directory. Defaults to $ANDROID_USER_HOME"
if (!process.env.ANDROID_EMULATOR_HOME) {
core.exportVariable('ANDROID_EMULATOR_HOME', process.env.ANDROID_USER_HOME);
}
yield io.mkdirP(`${process.env.ANDROID_EMULATOR_HOME}`);
// "all AVD-specific files, which mostly consist of very large disk images. Default is $ANDROID_EMULATOR_HOME/avd/"
if (!process.env.ANDROID_AVD_HOME) {
core.exportVariable('ANDROID_AVD_HOME', `${process.env.ANDROID_EMULATOR_HOME}/avd`);
}
yield io.mkdirP(`${process.env.ANDROID_AVD_HOME}`);
// accept all Android SDK licenses
yield exec.exec(`sh -c \\"yes | sdkmanager --licenses > /dev/null"`);
console.log('Installing latest build tools, platform tools, and platform.');
Expand Down
25 changes: 22 additions & 3 deletions src/sdk-installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,28 @@ export async function installAndroidSdk(apiLevel: string, target: string, arch:
// add paths for commandline-tools and platform-tools
core.addPath(`${cmdlineToolsPath}/latest:${cmdlineToolsPath}/latest/bin:${process.env.ANDROID_HOME}/platform-tools`);

// set standard AVD path
await io.mkdirP(`${process.env.HOME}/.android/avd`);
core.exportVariable('ANDROID_AVD_HOME', `${process.env.HOME}/.android/avd`);
// There are several environment variables that determine where AVD config and disk images go:
// https://developer.android.com/tools/variables#envar
// Users may set these for various reasons (self-hosted runners with specific disk space situations)
// so only set them if they are not already set.

// "user preferences directory for tools that are part of the Android SDK. Defaults to $HOME/.android/."
if (!process.env.ANDROID_USER_HOME) {
core.exportVariable('ANDROID_USER_HOME', `${process.env.HOME}/.android`);
}
await io.mkdirP(`${process.env.ANDROID_USER_HOME}`);

// "user-specific emulator configuration directory. Defaults to $ANDROID_USER_HOME"
if (!process.env.ANDROID_EMULATOR_HOME) {
core.exportVariable('ANDROID_EMULATOR_HOME', process.env.ANDROID_USER_HOME);
}
await io.mkdirP(`${process.env.ANDROID_EMULATOR_HOME}`);

// "all AVD-specific files, which mostly consist of very large disk images. Default is $ANDROID_EMULATOR_HOME/avd/"
if (!process.env.ANDROID_AVD_HOME) {
core.exportVariable('ANDROID_AVD_HOME', `${process.env.ANDROID_EMULATOR_HOME}/avd`);
}
await io.mkdirP(`${process.env.ANDROID_AVD_HOME}`);

// accept all Android SDK licenses
await exec.exec(`sh -c \\"yes | sdkmanager --licenses > /dev/null"`);
Expand Down