Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenXR android bump versions #37

Merged
merged 2 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment on lines -40 to +48
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe delete all this when it doesn't need to be set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I debated on this one. This is semi-generated from a script in the Monado repo, which uses the same basic outline, which is why I left it.


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
Loading