Debian Codegraph @

.gitlab-ci/templates/install-android-sdk.sh.jinja

raw
1 #!/usr/bin/env bash
2 # Copyright 2022, Collabora, Ltd. and the Monado contributors
3 # SPDX-License-Identifier: BSL-1.0
4
5 #{# ignore the warning, this is actually the template to edit. #}#
6 #######################################################
7 # GENERATED - DO NOT EDIT #
8 # see .gitlab-ci/install-android-sdk.sh.jinja instead #
9 #######################################################
10 #{#
11 Please run the following after editing:
12 make -f .gitlab-ci/ci-scripts.mk
13 #}#
14
15 # Partially inspired by https://about.gitlab.com/blog/2018/10/24/setting-up-gitlab-ci-for-android-projects/
16 {% for distro in distributions -%} {%- for image in distro.images if "android_compile_sdk" in image %}
17
18 set -eo pipefail
19 VERSION={{image.android_cli_tools}}
20 ROOT=${ROOT:-/opt/android-sdk}
21 ANDROID_COMPILE_SDK=${ANDROID_COMPILE_SDK:-{{image.android_compile_sdk}}}
22 ANDROID_BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-{{image.android_build_tools}}}
23
24 mkdir -p "$ROOT"
25 FN=commandlinetools-linux-${VERSION}_latest.zip
26 wget https://dl.google.com/android/repository/$FN
27 unzip $FN -d "$ROOT/extract"
28 mkdir -p "$ROOT/cmdline-tools"
29 mv "$ROOT/extract/cmdline-tools/" "$ROOT/cmdline-tools/latest/"
30 mv "$ROOT/extract/" "$ROOT/cmdline-tools/"
31
32 SDKMANAGER=$ROOT/cmdline-tools/latest/bin/sdkmanager
33
34 echo "Installing the Android compile SDK platform android-${ANDROID_COMPILE_SDK}"
35 echo y | $SDKMANAGER "platforms;android-${ANDROID_COMPILE_SDK}" >> /dev/null
36
37 echo "Installing the Android platform tools"
38 echo y | $SDKMANAGER "platform-tools" >> /dev/null
39
40 echo "Installing the Android build tools ${ANDROID_BUILD_TOOLS}"
41 echo y | $SDKMANAGER "build-tools;${ANDROID_BUILD_TOOLS}" >> /dev/null
42
43 set +o pipefail
44 yes | $SDKMANAGER --licenses
45 set -o pipefail
46
47 {% endfor -%} {%- endfor %}