mirror of
https://gitea.com/actions/setup-android.git
synced 2025-12-18 22:36:53 +00:00
[Issue #384] Implement silent licence agreement.
This commit is contained in:
19
src/main.ts
19
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<void> {
|
||||
async function callSdkManager(
|
||||
sdkManager: string,
|
||||
arg: string,
|
||||
printOutput: Boolean = true
|
||||
): Promise<void> {
|
||||
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<void> {
|
||||
}
|
||||
|
||||
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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user