Skip to content

Commit

Permalink
Merge pull request #37 from rpavlik/openxr-android-bump-versions
Browse files Browse the repository at this point in the history
OpenXR android bump versions
  • Loading branch information
rpavlik authored Mar 13, 2024
2 parents 18267f9 + 87d4c18 commit 088dae3
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 30 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 "$@"
)
17 changes: 12 additions & 5 deletions build-one.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,20 @@ REPO="khronosgroup/docker-images"
if [ "$OP" == "push" ]; then
docker push "$REPO:$DOCKERFILE"
docker push "$REPO:$DOCKERFILE.$VERSION"

# Show how to refer to it.
# This digest is only created by pushing to a v2 registry,
# so we can't do this reliably except in the "push" base
HASH=$(docker inspect --format='{{index .RepoDigests 0}}' "$REPO:$DOCKERFILE.$VERSION" | sed -E -n "s/.*(sha256:.*)/\1/p")
echo
echo "** To refer to this image precisely, use:"
echo " $REPO:$DOCKERFILE.$VERSION@$HASH"
else
echo
echo "** Not pushing, so no SHA256 manifest available. Until you push this image, refer to it as:"
echo " $REPO:$DOCKERFILE.$VERSION"
fi

# Show how to refer to it.
HASH=$(docker inspect --format='{{index .RepoDigests 0}}' "$REPO:$DOCKERFILE.$VERSION" | sed -E -n "s/.*(sha256:.*)/\1/p")
echo
echo "** To refer to this image precisely, use:"
echo " $REPO:$DOCKERFILE.$VERSION@$HASH"

[ -n "$CI" ] && echo "::endgroup::"
)
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 088dae3

Please sign in to comment.