llvm-project/libcxx/utils/ci/vendor/android/run-buildbot-container
Ryan Prichard d0c8e268c1
[libc++][Android] Fix Android bugs in the CI Dockerfile (#99623)
The base of android-buildkite-builder is buildkite-builder, not
android-build-base. android-build-base is only used for its /opt/android
directory, so move the Docker installation step into
android-buildkite-builder.

Install bzip2 for extracting ndk_platform.tar.bz2.

Add "set -e" to RUN heredocs to catch failing commands.
2024-07-23 13:28:36 -07:00

32 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Similar to libcxx/utils/ci/run-buildbot-container, but adds additional options
# needed for running Android tests.
set -e
MONOREPO_ROOT="$(git rev-parse --show-toplevel)"
if [[ ! -d "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android" ]]; then
echo "Was unable to find the root of the LLVM monorepo; are you running from within the monorepo?"
exit 1
fi
DOCKER_OPTIONS=(-it)
DOCKER_OPTIONS+=(--volume "${MONOREPO_ROOT}:/llvm")
DOCKER_OPTIONS+=(--workdir "/llvm")
DOCKER_OPTIONS+=(--cap-add=SYS_PTRACE)
# Mount this volume to allow the main image to share its copy of the Android
# platform tools with the emulator image, ensuring that the adb versions match.
# This argument will create a new volume if it doesn't already exist.
DOCKER_OPTIONS+=(--volume android-platform-tools:/mnt/android-platform-tools)
# Pass through the Docker socket so that the buildbot can start a sibling
# container running an Android emulator.
if [ -S /var/run/docker.sock ]; then
DOCKER_OPTIONS+=(--volume /var/run/docker.sock:/var/run/docker.sock)
fi
docker run "${DOCKER_OPTIONS[@]}" ghcr.io/libcxx/android-buildkite-builder \
bash -c 'git config --global --add safe.directory /llvm; (/opt/android/container-setup.sh && exec bash)'