Skip to content
This repository has been archived by the owner on Apr 7, 2023. It is now read-only.

Commit

Permalink
unify installing android sdk (in docker and with turtle-cli) (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsokal authored Jun 13, 2019
1 parent 32b049d commit d900e3c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 28 deletions.
16 changes: 2 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,8 @@ ENV PATH ${ANDROID_HOME}/tools:${PATH}
ENV PATH ${ANDROID_HOME}/tools/bin:${PATH}
ENV PATH ${ANDROID_HOME}/build-tools/28.0.3/:${PATH}

RUN yes | sdkmanager --licenses > /dev/null
RUN yes | sdkmanager \
"platforms;android-23" \
"platforms;android-24" \
"platforms;android-25" \
"platforms;android-26" \
"platforms;android-27" \
"platforms;android-28" | grep -v '=' || echo 'no output'
RUN yes | sdkmanager "platform-tools" | grep -v '=' || echo 'no output'
RUN yes | sdkmanager "build-tools;28.0.3" | grep -v '=' || echo 'no output'
RUN yes | sdkmanager \
"extras;android;m2repository" \
"extras;google;m2repository" \
"extras;google;google_play_services" | grep -v '=' || echo 'no output'
ADD scripts/android/configureAndroidSdk.sh /tmp/configureAndroidSdk.sh
RUN /tmp/configureAndroidSdk.sh --install-all-platforms

# Install Android NDK
ENV ANDROID_NDK_VERSION android-ndk-r10e
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"files": [
"bin",
"build",
"scripts/cli",
"scripts/android/configureAndroidSdk.sh",
"shellTarballs"
],
"keywords": [
Expand Down
20 changes: 20 additions & 0 deletions scripts/android/configureAndroidSdk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

SDKMANAGER=$ANDROID_HOME/tools/bin/sdkmanager

yes | $SDKMANAGER --licenses > /dev/null
if [[ "$1" = "--install-all-platforms" ]]; then
yes | $SDKMANAGER \
"platforms;android-23" \
"platforms;android-24" \
"platforms;android-25" \
"platforms;android-26" \
"platforms;android-27" | grep -v '='; [[ ${PIPESTATUS[1]} = 0 ]]
fi
yes | $SDKMANAGER "platforms;android-28" | grep -v '='; [[ ${PIPESTATUS[1]} = 0 ]]
yes | $SDKMANAGER "platform-tools" | grep -v '='; [[ ${PIPESTATUS[1]} = 0 ]]
yes | $SDKMANAGER "build-tools;28.0.3" | grep -v '='; [[ ${PIPESTATUS[1]} = 0 ]]
yes | $SDKMANAGER \
"extras;android;m2repository" \
"extras;google;m2repository" \
"extras;google;google_play_services" | grep -v '='; [[ ${PIPESTATUS[1]} = 0 ]]
12 changes: 0 additions & 12 deletions scripts/cli/configureAndroidSdk.sh

This file was deleted.

2 changes: 1 addition & 1 deletion src/bin/setup/android/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async function _configureSdk(androidSdkDir: string) {
await ExponentTools.spawnAsyncThrowError('./configureAndroidSdk.sh', [], {
pipeToLogger: true,
loggerFields: LOGGER_FIELDS,
cwd: path.join(config.directories.rootDir, 'scripts/cli'),
cwd: path.join(config.directories.rootDir, 'scripts/android'),
env: {
...process.env,
ANDROID_HOME: androidSdkDir,
Expand Down

0 comments on commit d900e3c

Please sign in to comment.