mirror of
https://github.com/android-actions/setup-android
synced 2024-11-22 05:29:34 -08:00
Implement action input parameter 'packages'
This commit is contained in:
parent
a86cdbf03d
commit
eb7920b260
4 changed files with 43 additions and 6 deletions
13
README.md
13
README.md
|
@ -39,12 +39,21 @@ steps:
|
|||
```
|
||||
|
||||
## Additional packages
|
||||
By default, sdkmanager installs "tools" and "platform-tools" packages. To install additional packages, call sdkmanager manually:
|
||||
Input parameter `packages` controls which packages this action will install from Android SDK.
|
||||
|
||||
Default value is `tools platform-tools`, supply an empty string to skip installing additional packages.
|
||||
|
||||
Additional packages can be installed at a later time by calling sdkmanager manually.
|
||||
|
||||
```yaml
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
with:
|
||||
packages: ''
|
||||
|
||||
- run: sdkmanager "ndk;26.1.10909125" "cmake;3.22.1"
|
||||
# ...
|
||||
|
||||
- run: sdkmanager tools platform-tools
|
||||
```
|
||||
|
||||
## SDK Version selection
|
||||
|
|
|
@ -18,6 +18,11 @@ inputs:
|
|||
required: false
|
||||
default: 'true'
|
||||
|
||||
packages:
|
||||
description: 'Additional packages to install'
|
||||
required: false
|
||||
default: 'tools platform-tools'
|
||||
|
||||
runs:
|
||||
using: node20
|
||||
main: 'dist/index.js'
|
||||
|
|
15
dist/index.js
vendored
15
dist/index.js
vendored
|
@ -28269,8 +28269,19 @@ function run() {
|
|||
core.info('Accepting Android SDK licenses');
|
||||
yield callSdkManager(sdkManagerExe, '--licenses', core.getBooleanInput('log-accepted-android-sdk-licenses'));
|
||||
}
|
||||
yield callSdkManager(sdkManagerExe, 'tools');
|
||||
yield callSdkManager(sdkManagerExe, 'platform-tools');
|
||||
const packages = core
|
||||
.getInput('packages', { required: false })
|
||||
.split(' ')
|
||||
.map(function (str) {
|
||||
return str.trim();
|
||||
})
|
||||
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
||||
.filter(function (element, index, array) {
|
||||
return element;
|
||||
});
|
||||
for (const pkg of packages) {
|
||||
yield callSdkManager(sdkManagerExe, pkg);
|
||||
}
|
||||
core.setOutput('ANDROID_COMMANDLINE_TOOLS_VERSION', VERSION_LONG);
|
||||
core.exportVariable('ANDROID_HOME', ANDROID_SDK_ROOT);
|
||||
core.exportVariable('ANDROID_SDK_ROOT', ANDROID_SDK_ROOT);
|
||||
|
|
16
src/main.ts
16
src/main.ts
|
@ -156,8 +156,20 @@ async function run(): Promise<void> {
|
|||
core.getBooleanInput('log-accepted-android-sdk-licenses')
|
||||
)
|
||||
}
|
||||
await callSdkManager(sdkManagerExe, 'tools')
|
||||
await callSdkManager(sdkManagerExe, 'platform-tools')
|
||||
|
||||
const packages = core
|
||||
.getInput('packages', {required: false})
|
||||
.split(' ')
|
||||
.map(function (str) {
|
||||
return str.trim()
|
||||
})
|
||||
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
||||
.filter(function (element, index, array) {
|
||||
return element
|
||||
})
|
||||
for (const pkg of packages) {
|
||||
await callSdkManager(sdkManagerExe, pkg)
|
||||
}
|
||||
|
||||
core.setOutput('ANDROID_COMMANDLINE_TOOLS_VERSION', VERSION_LONG)
|
||||
core.exportVariable('ANDROID_HOME', ANDROID_SDK_ROOT)
|
||||
|
|
Loading…
Reference in a new issue