ci: Move default versions from install-android-sdk to the config.yml

This commit is contained in:
Ryan Pavlik 2022-06-27 09:53:16 -05:00
parent 6028c81796
commit b4aed1309c
5 changed files with 66 additions and 0 deletions

View file

@ -8,6 +8,7 @@
FILES_IN_SUBDIR := \
.gitlab-ci/distributions \
.gitlab-ci/reprepro.sh \
.gitlab-ci/install-android-sdk.sh \
CONFIG_FILE := .gitlab-ci/config.yml
OUTPUTS := .gitlab-ci.yml \

View file

@ -116,6 +116,13 @@ distributions:
repo_suffix: ndk
script: android_container_prep.sh
tag: "2022-06-27.0"
# This must match ext.sharedTargetSdk in build.gradle
android_compile_sdk: 31
# This must match buildscript.ext.buildToolsVersion in build.gradle
android_build_tools: 31.0.0
# look up on https://developer.android.com/studio/index.html#downloads when updating other versions
android_cli_tools: 8512546
packages:
git:
wget:

View file

@ -2,6 +2,13 @@
# Copyright 2022, Collabora, Ltd. and the Monado contributors
# SPDX-License-Identifier: BSL-1.0
##
#######################################################
# GENERATED - DO NOT EDIT #
# see .gitlab-ci/install-android-sdk.sh.jinja instead #
#######################################################
##
# Partially inspired by https://about.gitlab.com/blog/2018/10/24/setting-up-gitlab-ci-for-android-projects/
set -eo pipefail
@ -32,3 +39,4 @@ echo y | $SDKMANAGER "build-tools;${ANDROID_BUILD_TOOLS}" >> /dev/null
set +o pipefail
yes | $SDKMANAGER --licenses
set -o pipefail

View file

@ -0,0 +1,47 @@
#!/usr/bin/env bash
# Copyright 2022, Collabora, Ltd. and the Monado contributors
# SPDX-License-Identifier: BSL-1.0
#{# ignore the warning, this is actually the template to edit. #}#
#######################################################
# GENERATED - DO NOT EDIT #
# see .gitlab-ci/install-android-sdk.sh.jinja instead #
#######################################################
#{#
Please run the following after editing:
make -f .gitlab-ci/ci-scripts.mk
#}#
# Partially inspired by https://about.gitlab.com/blog/2018/10/24/setting-up-gitlab-ci-for-android-projects/
{% for distro in distributions -%} {%- for image in distro.images if "android_compile_sdk" in image %}
set -eo pipefail
VERSION={{image.android_cli_tools}}
ROOT=${ROOT:-/opt/android-sdk}
ANDROID_COMPILE_SDK=${ANDROID_COMPILE_SDK:-{{image.android_compile_sdk}}}
ANDROID_BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-{{image.android_build_tools}}}
mkdir -p "$ROOT"
FN=commandlinetools-linux-${VERSION}_latest.zip
wget https://dl.google.com/android/repository/$FN
unzip $FN -d "$ROOT/extract"
mkdir -p "$ROOT/cmdline-tools"
mv "$ROOT/extract/cmdline-tools/" "$ROOT/cmdline-tools/latest/"
mv "$ROOT/extract/" "$ROOT/cmdline-tools/"
SDKMANAGER=$ROOT/cmdline-tools/latest/bin/sdkmanager
echo "Installing the Android compile SDK platform android-${ANDROID_COMPILE_SDK}"
echo y | $SDKMANAGER "platforms;android-${ANDROID_COMPILE_SDK}" >> /dev/null
echo "Installing the Android platform tools"
echo y | $SDKMANAGER "platform-tools" >> /dev/null
echo "Installing the Android build tools ${ANDROID_BUILD_TOOLS}"
echo y | $SDKMANAGER "build-tools;${ANDROID_BUILD_TOOLS}" >> /dev/null
set +o pipefail
yes | $SDKMANAGER --licenses
set -o pipefail
{% endfor -%} {%- endfor %}

View file

@ -21,6 +21,8 @@ buildscript {
// This is the version to download if we can't find it locally.
eigenFetchVersion = '3.4.0'
// If you update this, must also update .gitlab-ci/config.yml
buildToolsVersion = "31.0.0"
}
repositories {
@ -54,6 +56,7 @@ plugins {
ext {
ndk_version = '21.4.7075529'
// If you update this, must also update .gitlab-ci/config.yml
sharedTargetSdk = 31
sharedMinSdk = 26