diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml
index 8558802..993b1ca 100644
--- a/.github/workflows/build-test.yml
+++ b/.github/workflows/build-test.yml
@@ -59,6 +59,7 @@ jobs:
runSdkManager:
runs-on: ${{ matrix.os }}
+ name: ${{ matrix.os }} - ${{ matrix.cmdline-tools-version }}
strategy:
fail-fast: false
matrix:
@@ -89,6 +90,8 @@ jobs:
- run: node dist/index.js
env:
INPUT_CMDLINE-TOOLS-VERSION: ${{ matrix.cmdline-tools-version }}
+ INPUT_ACCEPT-ANDROID-SDK-LICENSES: 'true'
+ INPUT_LOG-ACCEPTED-ANDROID-SDK-LICENSES: 'false'
- run: sdkmanager --list
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 65aaa32..5424839 100644
--- a/README.md
+++ b/README.md
@@ -64,5 +64,16 @@ To install a different version, call setup-android with desired long version as
Current cmdline tools version can be found at https://developer.android.com/studio#command-line-tools-only
+
+# Android SDK Licences
+
+Android SDK (unsurprisingly) is not public domain software, it comes with a licence.
+
+Input parameter `accept-android-sdk-licenses` decides if Android SDK licences should be agreed to on behalf of the user of this action.
+Default option is 'yes', because otherwise SDK is unusable until said licences are agreed to.
+
+Licences are quite long, to prevent a wall of text in the action output, licences can be agreed to silently.
+Input parameter `log-accepted-android-sdk-licenses` controls whether licence texts should be printed or omitted from the text output. Defaults to 'true'.
+
# Thanks
Based on the project [android-problem-matchers-action](https://github.com/jonasb/android-problem-matchers-action) from [@jonasb](https://github.com/jonasb)
diff --git a/action.yml b/action.yml
index 11d1629..178e182 100644
--- a/action.yml
+++ b/action.yml
@@ -8,6 +8,16 @@ inputs:
required: false
default: '10406996'
+ accept-android-sdk-licenses:
+ description: 'Android SDK is usable only after the licence agreement. Should setup-android agree to the licences, provided by "sdkmanager --licenses"'
+ required: false
+ default: 'true'
+
+ log-accepted-android-sdk-licenses:
+ description: 'Should accepted licences be logged. If not, accepted licences will be accepted silently'
+ required: false
+ default: 'true'
+
runs:
using: node20
main: 'dist/index.js'
diff --git a/dist/index.js b/dist/index.js
index e3a2ae0..a8bb5b9 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -28183,11 +28183,12 @@ const COMMANDLINE_TOOLS_MAC_URL = `https://dl.google.com/android/repository/comm
const COMMANDLINE_TOOLS_LIN_URL = `https://dl.google.com/android/repository/commandlinetools-linux-${VERSION_LONG}_latest.zip`;
const ANDROID_HOME_SDK_DIR = path.join(os.homedir(), '.android', 'sdk');
let ANDROID_SDK_ROOT = process.env['ANDROID_SDK_ROOT'] || ANDROID_HOME_SDK_DIR;
-function callSdkManager(sdkManager, arg) {
+function callSdkManager(sdkManager, arg, printOutput = true) {
return __awaiter(this, void 0, void 0, function* () {
const acceptBuffer = Buffer.from(Array(10).fill('y').join('\n'), 'utf8');
yield exec.exec(sdkManager, [arg], {
- input: acceptBuffer
+ input: acceptBuffer,
+ silent: !printOutput
});
});
}
@@ -28264,7 +28265,10 @@ function run() {
}
}
const sdkManagerExe = yield installSdkManager();
- yield callSdkManager(sdkManagerExe, '--licenses');
+ if (core.getBooleanInput('accept-android-sdk-licenses')) {
+ core.info('Accepting Android SDK licences');
+ yield callSdkManager(sdkManagerExe, '--licenses', core.getBooleanInput('log-accepted-android-sdk-licenses'));
+ }
yield callSdkManager(sdkManagerExe, 'tools');
yield callSdkManager(sdkManagerExe, 'platform-tools');
core.setOutput('ANDROID_COMMANDLINE_TOOLS_VERSION', VERSION_LONG);
diff --git a/src/main.ts b/src/main.ts
index 2f48294..c0b8950 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -38,10 +38,15 @@ const COMMANDLINE_TOOLS_LIN_URL = `https://dl.google.com/android/repository/comm
const ANDROID_HOME_SDK_DIR = path.join(os.homedir(), '.android', 'sdk')
let ANDROID_SDK_ROOT = process.env['ANDROID_SDK_ROOT'] || ANDROID_HOME_SDK_DIR
-async function callSdkManager(sdkManager: string, arg: string): Promise {
+async function callSdkManager(
+ sdkManager: string,
+ arg: string,
+ printOutput: Boolean = true
+): Promise {
const acceptBuffer = Buffer.from(Array(10).fill('y').join('\n'), 'utf8')
await exec.exec(sdkManager, [arg], {
- input: acceptBuffer
+ input: acceptBuffer,
+ silent: !printOutput
})
}
@@ -142,7 +147,15 @@ async function run(): Promise {
}
const sdkManagerExe = await installSdkManager()
- await callSdkManager(sdkManagerExe, '--licenses')
+
+ if (core.getBooleanInput('accept-android-sdk-licenses')) {
+ core.info('Accepting Android SDK licences')
+ await callSdkManager(
+ sdkManagerExe,
+ '--licenses',
+ core.getBooleanInput('log-accepted-android-sdk-licenses')
+ )
+ }
await callSdkManager(sdkManagerExe, 'tools')
await callSdkManager(sdkManagerExe, 'platform-tools')