Add a Dockerfile for a new Docker image, libcxx-builder-android, that extends libcxx-builder with support for testing Android. The image includes these things: * An Android Clang compiler and sysroot. * The Android platform-tools (e.g. adb), so that an Android buildbot can run programs on an Android device. At container startup, copy these platform tools to an "android-platform-tools" Docker volume to share them with an emulator container. This copying ensures that the emulator and libcxx-builder containers avoid mismatched adb versions. * Docker, so that an Android buildbot can manage a sibling Docker container that runs the Android emulator. Add an Android-specific run-buildbot-container script for local development. Currently using this script requires building libcxx-build-android and an emulator image locally. Fixes: https://github.com/llvm/llvm-project/issues/69270 Differential Revision: https://reviews.llvm.org/D155271
32 lines
1.2 KiB
Bash
Executable File
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[@]}" libcxx-builder-android \
|
|
bash -c 'git config --global --add safe.directory /llvm; (/opt/android/container-setup.sh && exec bash)'
|