ci: Add java and Android SDK to our NDK builder

This commit is contained in:
Ryan Pavlik 2022-01-20 14:32:25 -06:00
parent 3c85fd3bed
commit e06e0c764d
8 changed files with 57 additions and 14 deletions

2
.gitignore vendored
View file

@ -75,7 +75,7 @@ src/xrt/drivers/arduino/device/*.bin
# Ignore gradle-related and android studio-related things
*.iml
.gradle/
local.properties
/local.properties
.idea/*
# .idea/caches
# .idea/libraries

View file

@ -36,7 +36,7 @@ include:
.monado.variables.debian:bullseye-ndk:
variables:
FDO_DISTRIBUTION_VERSION: "bullseye"
FDO_DISTRIBUTION_TAG: "2022-01-24.0"
FDO_DISTRIBUTION_TAG: "2022-01-25.0"
FDO_REPO_SUFFIX: ndk
# Variables for build and usage of Ubuntu focal image
@ -90,8 +90,8 @@ debian:bullseye-ndk:container_prep:
- .monado.variables.debian:bullseye-ndk
- .fdo.container-build@debian # from ci-templates
variables:
FDO_DISTRIBUTION_PACKAGES: 'ca-certificates cmake git glslang-tools libeigen3-dev meson ninja-build pkg-config python3 unzip wget'
FDO_DISTRIBUTION_EXEC: 'bash .gitlab-ci/ndk_container_prep.sh'
FDO_DISTRIBUTION_PACKAGES: 'ca-certificates cmake default-jdk-headless git glslang-tools libeigen3-dev meson ninja-build pkg-config python3 unzip wget'
FDO_DISTRIBUTION_EXEC: 'bash .gitlab-ci/android_container_prep.sh'
# Make Ubuntu focal image
ubuntu:focal:container_prep:

View file

@ -0,0 +1,9 @@
#!/bin/bash
# Copyright 2018-2020, 2022, Collabora, Ltd. and the Monado contributors
# SPDX-License-Identifier: BSL-1.0
(
cd $(dirname $0)
bash ./install-ndk.sh
bash ./install-android-sdk.sh
)

View file

@ -119,11 +119,12 @@ distributions:
- --cross-file=.gitlab-ci/i386-cross.txt
# This one is pretty minimal, compared to the others.
# Though, we now install the android SDK in it...
- codename: bullseye-ndk
distro_version: bullseye
repo_suffix: ndk
script: ndk_container_prep.sh
tag: "2022-01-24.0"
script: android_container_prep.sh
tag: "2022-01-25.0"
packages:
git:
wget:
@ -136,6 +137,7 @@ distributions:
pkg-config:
ca-certificates:
glslang-tools:
default-jdk-headless:
build_jobs:
- name: "ndk:armeabi-v7a"
cmake_defines:

View file

@ -0,0 +1,34 @@
#!/usr/bin/env bash
# Copyright 2022, Collabora, Ltd. and the Monado contributors
# SPDX-License-Identifier: BSL-1.0
# Partially inspired by https://about.gitlab.com/blog/2018/10/24/setting-up-gitlab-ci-for-android-projects/
set -eo pipefail
VERSION=7583922
ROOT=${ROOT:-/opt/android-sdk}
ANDROID_COMPILE_SDK=${ANDROID_COMPILE_SDK:-31}
ANDROID_BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-31.0.0}
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

0
.gitlab-ci/install-cross.sh Normal file → Executable file
View file

View file

@ -0,0 +1,6 @@
# SPDX-License-Identifier: CC0-1.0
# SPDX-FileCopyrightText: 2018-2022 Collabora, Ltd. and the Monado contributors
# For building on CI
ndk.dir=/opt/android-ndk
sdk.dir=/opt/android-sdk

View file

@ -1,8 +0,0 @@
#!/bin/bash
# Copyright 2018-2020, Collabora, Ltd. and the Monado contributors
# SPDX-License-Identifier: BSL-1.0
(
cd $(dirname $0)
bash ./install-ndk.sh
)