Skip to content

Commit

Permalink
openxr-android: Bump compile SDK to 33, NDK to 23.2, build tools to 3…
Browse files Browse the repository at this point in the history
…4.0.0
  • Loading branch information
rpavlik committed Mar 12, 2024
1 parent 6717ec5 commit 87d4c18
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 25 deletions.
2 changes: 1 addition & 1 deletion build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ set -e
./build-one.sh openxr 20231010.1 "$@"
./build-one.sh openxr-sdk 20230614 "$@"
./build-one.sh openxr-pregenerated-sdk 20230822 "$@"
./build-one.sh openxr-android 20231206 "$@"
./build-one.sh openxr-android 20240312 "$@"
)
23 changes: 10 additions & 13 deletions install-android-sdk.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
#!/usr/bin/env bash
# Copyright 2022-2023, Collabora, Ltd. and the Monado contributors
# Copyright 2022-2024, 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/
# and based on https://gitlab.freedesktop.org/monado/monado/-/blob/9ad98815bbc291f96c092b7aad2943ad567d65b4/.gitlab-ci/install-android-sdk.sh
# and based on https://gitlab.freedesktop.org/monado/monado/-/blob/main/.gitlab-ci/install-android-sdk.sh

set -eo pipefail
# These normally come from the environment but we have defaults
ANDROID_CLI_TOOLS=${ANDROID_CLI_TOOLS:-9477386}
ANDROID_COMPILE_SDK=${ANDROID_COMPILE_SDK:-32}
ANDROID_BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-32.0.0}
ANDROID_NDK_VERSION=${ANDROID_NDK_VERSION:-25.2.9519653}
ANDROID_CLI_TOOLS=${ANDROID_CLI_TOOLS:-10406996}
ANDROID_COMPILE_SDK=${ANDROID_COMPILE_SDK:-33}
ANDROID_BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-34.0.0}
ANDROID_NDK_VERSION=${ANDROID_NDK_VERSION:-23.2.8568313}
ANDROID_CMAKE_VERSION=${ANDROID_CMAKE_VERSION:-3.22.1}
ANDROID_SDK_ROOT=${ANDROID_SDK_ROOT:-/opt/android-sdk}

# Bootstrap by getting the commandline tools.
mkdir -p "$ANDROID_SDK_ROOT"
FN=commandlinetools-linux-${ANDROID_CLI_TOOLS}_latest.zip
wget https://dl.google.com/android/repository/$FN
Expand All @@ -25,23 +26,19 @@ mv "$ANDROID_SDK_ROOT/extract/" "$ANDROID_SDK_ROOT/cmdline-tools/"

SDKMANAGER=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager

set +o pipefail
yes | $SDKMANAGER --licenses
set -o pipefail

echo "Installing the Android compile SDK platform android-${ANDROID_COMPILE_SDK}"
echo y | $SDKMANAGER "platforms;android-${ANDROID_COMPILE_SDK}" >> /dev/null

echo "Installing the latest 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

echo "Installing the Android NDK ${ANDROID_NDK_VERSION}"
echo y | $SDKMANAGER "ndk;${ANDROID_NDK_VERSION}" >> /dev/null

echo "Installing CMake ${ANDROID_CMAKE_VERSION}"
echo y | $SDKMANAGER "cmake;${ANDROID_CMAKE_VERSION}" >> /dev/null

echo "Installing the Android build tools ${ANDROID_BUILD_TOOLS}"
echo y | $SDKMANAGER "build-tools;${ANDROID_BUILD_TOOLS}" >> /dev/null

rm -rf "${ANDROID_SDK_ROOT}/.temp" "${ANDROID_SDK_ROOT}/.knownPackages"
21 changes: 10 additions & 11 deletions openxr-android.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,32 @@ RUN env DEBIAN_FRONTEND=noninteractive apt-get update -qq && \
unzip \
wget \
zip \
&& apt-get clean
&& apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Set up user and group 1000:1000 for most common usage case
RUN addgroup --gid 1000 --quiet openxr
RUN useradd --shell /bin/bash --create-home --no-log-init --uid 1000 --gid 1000 openxr

### Android SDK components

# This must match android.compileSdk in all Android build.gradle files
ENV ANDROID_COMPILE_SDK=29
# # This must match android.compileSdk in all Android build.gradle files
# ENV ANDROID_COMPILE_SDK=33

# This must match android.buildToolsVersion in all Android build.gradle files
ENV ANDROID_BUILD_TOOLS=30.0.3
# # This must match android.buildToolsVersion in all Android build.gradle files
# ENV ANDROID_BUILD_TOOLS=34.0.0

# look up on https://developer.android.com/studio/index.html#downloads when updating other versions
ENV ANDROID_CLI_TOOLS=9477386
# # look up on https://developer.android.com/studio/index.html#downloads when updating other versions
# ENV ANDROID_CLI_TOOLS=10406996

ENV ANDROID_NDK_VERSION=21.4.7075529
ENV ANDROID_NDK_VERSION=23.2.8568313

ENV ANDROID_SDK_ROOT=/opt/android-sdk

COPY install-android-sdk.sh /install-android-sdk.sh
RUN /install-android-sdk.sh

### Android NDK

ENV ANDROID_NDK_HOME=/opt/android-sdk/ndk/${ANDROID_NDK_VERSION}
ENV ANDROID_NDK_HOME=${ANDROID_SDK_ROOT}/ndk/${ANDROID_NDK_VERSION}

# Switch to non-privileged user
USER openxr
Expand Down

0 comments on commit 87d4c18

Please sign in to comment.