ANDROID: Refactor Android toolchains to make it lighter and more modular

This commit is contained in:
Le Philousophe
2020-04-09 16:36:31 +00:00
parent b0aab87649
commit 2f382486a0
23 changed files with 206 additions and 212 deletions
+2
View File
@@ -80,6 +80,8 @@ $(foreach i,$(TOOLCHAINS),$(eval $(call DEPEND_COMMON,$(i))))
# Add here all dependencies between toolchains
$(BUILDDIR)/toolchains/devkit3ds: $(BUILDDIR)/toolchains/devkitarm
$(BUILDDIR)/toolchains/devkitnds: $(BUILDDIR)/toolchains/devkitarm
$(BUILDDIR)/toolchains/android: $(BUILDDIR)/toolchains/android-common
$(BUILDDIR)/toolchains/android-old: $(BUILDDIR)/toolchains/android-common
clean-toolchains:
docker rmi $(TOOLCHAINS)
+34 -48
View File
@@ -114,65 +114,51 @@ def _3ds():
platforms.append(platform)
_3ds()
def android(suffix, scummvm_target, ndk_target, cxx_target, abi_version,
android_master_root = "/opt/android/master",
android_stable_root = "/opt/android/stable"):
android_master_toolchain = "{0}/ndk/toolchains/llvm/prebuilt/linux-x86_64".format(
android_master_root)
android_stable_toolchain = "{0}/toolchain".format(android_stable_root)
def android(suffix, scummvm_target, ndk_target, cxx_target, abi_version):
platform = Platform("android_{0}".format(suffix))
platform.workerimage = "android"
platform.compatibleBuilds = (builds.ScummVMBuild, )
platform.workerimage = {
builds.ScummVMBuild: "android",
builds.ScummVMStableBuild: "android-old",
}
platform.buildenv = {
builds.ScummVMBuild: {
"ANDROID_NDK_ROOT": "{0}/ndk".format(android_master_root),
# configure script will find everything from this
"ANDROID_TOOLCHAIN": "{0}".format(android_master_toolchain),
# We keep SDK and gradle dynamic and outside the container
# Their versions can change without the need to regenerate the image
# Android build system can be shared across all versions so we don't specialize
# the directory in /data/bshomes
"ANDROID_SDK_ROOT": "/data/bshomes/android/sdk",
"ANDROID_SDK_HOME": "/data/bshomes/android/sdk-home",
"GRADLE_USER_HOME": "/data/bshomes/android/gradle",
"CXX": "ccache {0}/bin/{1}{2}-clang++".format(
android_master_toolchain, cxx_target, abi_version),
"CXX": "ccache ${{ANDROID_TOOLCHAIN}}/bin/{0}{1}-clang++".format(
cxx_target, abi_version),
# Worker has all libraries installed in the NDK sysroot
"PKG_CONFIG_LIBDIR": "{0}/sysroot/usr/lib/{1}/{2}/pkgconfig".format(
android_master_toolchain, ndk_target, abi_version),
"PKG_CONFIG_LIBDIR": "${{ANDROID_TOOLCHAIN}}/sysroot/usr/lib/{0}/{1}/pkgconfig".format(
ndk_target, abi_version),
# Altering PATH for curl-config, that lets us reuse environment variables instead of using configure args
"PATH": [ "${PATH}", "${{ANDROID_TOOLCHAIN}}/sysroot/usr/bin/{0}/{1}".format(
ndk_target, abi_version)],
},
builds.ScummVMStableBuild: {
"ANDROID_NDK": "{0}/ndk".format(android_stable_root),
"ANDROID_SDK": "{0}/sdk".format(android_stable_root),
"ANDROID_SDK_HOME": "/data/bshomes/android/sdk-home",
"AR": "{0}/bin/{1}-ar".format(
android_stable_toolchain, ndk_target),
"AS": "{0}/bin/{1}-as".format(
android_stable_toolchain, ndk_target),
"RANLIB": "{0}/bin/{1}-ranlib".format(
android_stable_toolchain, ndk_target),
"STRIP": "{0}/bin/{1}-strip".format(
android_stable_toolchain, ndk_target),
"STRINGS": "{0}/bin/{1}-strings".format(
android_stable_toolchain, ndk_target),
"CXX": "ccache {0}/bin/{1}-clang++".format(
android_stable_toolchain, ndk_target),
"CC": "ccache {0}/bin/{1}-clang".format(
android_stable_toolchain, ndk_target),
"AR": "${{ANDROID_TOOLCHAIN}}/bin/{0}-ar".format(
ndk_target),
"AS": "${{ANDROID_TOOLCHAIN}}/bin/{0}-as".format(
ndk_target),
"RANLIB": "${{ANDROID_TOOLCHAIN}}/bin/{0}-ranlib".format(
ndk_target),
"STRIP": "${{ANDROID_TOOLCHAIN}}/bin/{0}-strip".format(
ndk_target),
"STRINGS": "${{ANDROID_TOOLCHAIN}}/bin/{0}-strings".format(
ndk_target),
"CXX": "ccache ${{ANDROID_TOOLCHAIN}}/bin/{0}-clang++".format(
ndk_target),
"CC": "ccache ${{ANDROID_TOOLCHAIN}}/bin/{0}-clang".format(
ndk_target),
# Worker has all libraries installed in the toolchain
"PKG_CONFIG_LIBDIR": "{0}/sysroot/usr/lib/{1}/pkgconfig".format(
android_stable_toolchain, ndk_target),
"PKG_CONFIG_LIBDIR": "${{ANDROID_TOOLCHAIN}}/sysroot/usr/lib/{0}/pkgconfig".format(
ndk_target),
# Altering PATH for curl-config, that lets us reuse environment variables instead of using configure args
"PATH": [ "${PATH}", "${{ANDROID_TOOLCHAIN}}/sysroot/usr/bin/{0}".format(
ndk_target)],
}
}
platform.configureargs.append("--host=android-{0}".format(scummvm_target))
platform.buildconfigureargs = {
builds.ScummVMBuild: [ "--enable-debug",
# libcurl is detected using curl-config. Instead of modifying PATH just provide path to it to configure.
"--with-libcurl-prefix={0}/sysroot/usr/bin/{1}/{2}".format(android_master_toolchain, ndk_target, abi_version)],
builds.ScummVMStableBuild: [ "--enable-debug",
# libcurl is detected using curl-config. Instead of modifying PATH just provide path to it to configure.
"--with-libcurl-prefix={0}/sysroot/usr/bin/{1}".format(android_stable_toolchain, ndk_target)],
}
platform.configureargs.append("--enable-debug")
platform.packaging_cmd = "androiddistdebug"
platform.built_files = {
builds.ScummVMBuild: [ "debug" ],
+4
View File
@@ -0,0 +1,4 @@
FROM scratch
COPY functions-platform.sh functions-sdk.sh multi-build.sh /lib-helpers/
COPY packages /lib-helpers/packages/
+36
View File
@@ -0,0 +1,36 @@
##### Old toolchain : NDK r14b and SDK 25 #####
m4_include(`android/start.m4')m4_dnl
# Ant is needed by old Android build system
# file and python are needed by NDK
# libncurses5 is needed by all binaries
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ant \
file \
libncurses5 \
python && \
rm -rf /var/lib/apt/lists/*
# Unlike the newer toolchain, this one is quite static because it shouldn't evolve in time
# and many tricks may depend on the NDK version
ENV ANDROID_ROOT=/opt/android
# ABIS is for ndk-old package and determine how the unified toolchain will be composed
# API is none because we don't have new style folder hierarchy
ENV ANDROID_NDK_ROOT=${ANDROID_ROOT}/ndk \
TOOLCHAIN=${ANDROID_ROOT}/toolchain \
ABIS="arm/9 arm64/21 x86/9 x86_64/21" \
API="none" \
HOST_TAG=linux-x86_64
# Install NDK using settings above
local_sdk_package(ndk-old)
# Include the packaging instructions
m4_include(`android/packages_list.m4')
# Install an old (unsupported) SDK because build process depends on android project command
ENV ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
local_sdk_package(sdk-old)
@@ -10,10 +10,10 @@ NO_FUNCTIONS_PLATFORM=yes
. $HELPERS_DIR/functions.sh
export ANDROID_SDK_HOME=$(pwd)
do_make_bdir
export ANDROID_SDK_HOME=$(pwd)
do_http_fetch tools "https://dl.google.com/android/repository/tools_r${SDK_VERSION}-${HOST_TAG%-*}.zip" 'unzip' \
"sha1:${SDK_SHA1}"
@@ -46,6 +46,14 @@ sed -ie 's#<property name="java.\(target\|source\)" value="1.5" />#<property nam
# OpenJDK 11 doesn't have sun.misc.Base64Encoder anymore, provide it and patch sdklibs.jar
cp $PACKAGE_DIR/sun_misc_base64.jar ./lib/
# Install JDK and remove it just after to make final image lighter
# Do it like we do in Dockerfiles
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
default-jdk-headless && \
rm -rf /var/lib/apt/lists/*
# Spawn a subshell to not alter working directory
(DIR=$(pwd) && \
cd .. && \
@@ -54,6 +62,9 @@ cp $PACKAGE_DIR/sun_misc_base64.jar ./lib/
jar ufm "$DIR/lib/sdklib.jar" META-INF/MANIFEST.MF && \
rm -rf META-INF)
DEBIAN_FRONTEND=noninteractive apt-get autoremove --purge -y \
default-jdk-headless
mkdir -p "${ANDROID_SDK_ROOT}"
# Download needed parts
+7 -140
View File
@@ -1,45 +1,10 @@
# This toolchain is made of two sub-toolchains one for stable ScummVM and one for master one
# Two sub-toolchains are used to avoid invalidating one when updating the other
# The merging process, being only copies, is faster
##### New toolchain : NDK 21.0.6113669 + SDK licenses only / SDK and tools are downloaded by Gradle #####
m4_include(`android/start.m4')m4_dnl
FROM toolchains/common AS helpers
m4_include(`paths.m4')m4_dnl
# Don't import packages.m4 as it clashes with functions defined here
m4_define(`local_sdk_package', COPY packages/$1 lib-helpers/packages/$1/
RUN $3 lib-helpers/packages/$1/build.sh $2)
m4_define(`local_package', COPY packages/$1 lib-helpers/packages/$1/
RUN $3 lib-helpers/multi-build.sh lib-helpers/packages/$1/build.sh $2)
m4_define(`helpers_package', COPY --from=helpers /lib-helpers/packages/$1 lib-helpers/packages/$1/
RUN $3 lib-helpers/multi-build.sh lib-helpers/packages/$1/build.sh $2)
##### master toolchain : NDK 21.0.6113669 + SDK licenses only / SDK and tools are download by Gradle #####
FROM debian:stable-slim AS toolchain-master
USER root
WORKDIR /usr/src
# Copy and execute each step separately to avoid invalidating cache
COPY --from=helpers /lib-helpers/prepare.sh lib-helpers/
RUN lib-helpers/prepare.sh
COPY --from=helpers /lib-helpers/functions.sh lib-helpers/
COPY functions-platform.sh lib-helpers/
COPY functions-sdk.sh lib-helpers/
COPY multi-build.sh lib-helpers/
# nasm is used for x86 ScummVM
# Create man directories to please openjdk which expects them
# cf. https://github.com/debuerreotype/debuerreotype/issues/10
RUN for i in $(seq 1 8); do mkdir -p "/usr/share/man/man${i}"; done && \
apt-get update && \
# Newer SDKs need Go
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
default-jre-headless \
golang-go \
nasm && \
golang-go && \
rm -rf /var/lib/apt/lists/*
# API is the API versions for which we will compile packages
@@ -56,7 +21,7 @@ RUN for i in $(seq 1 8); do mkdir -p "/usr/share/man/man${i}"; done && \
# As we follow same rules as Android, we should
# always get the same API versions as expected by Android
ENV ANDROID_ROOT=/opt/android/master
ENV ANDROID_ROOT=/opt/android
ENV ANDROID_NDK_ROOT=${ANDROID_ROOT}/ndk \
ANDROID_NDK_VERSION=21.0.6113669 \
@@ -67,7 +32,7 @@ ENV ANDROID_NDK_ROOT=${ANDROID_ROOT}/ndk \
local_sdk_package(ndk)
# Include the packaging instructions
m4_include(`packages_list.m4')
m4_include(`android/packages_list.m4')
# Only install licenses on this version as everything will be installed by gradle
# It's installed last to avoid rebuilding everything if we just want to update licenses
@@ -75,101 +40,3 @@ m4_include(`packages_list.m4')
ENV ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
# Install SDK using settings above
local_sdk_package(sdk)
##### stable toolchain : NDK r14b and SDK 25 #####
FROM debian:stable-slim AS toolchain-stable
USER root
WORKDIR /usr/src
# Copy and execute each step separately to avoid invalidating cache
COPY --from=helpers /lib-helpers/prepare.sh lib-helpers/
RUN lib-helpers/prepare.sh
COPY --from=helpers /lib-helpers/functions.sh lib-helpers/
COPY functions-platform.sh lib-helpers/
# We don't need these functions for older SDK but that let's image reuse possible
COPY functions-sdk.sh lib-helpers/
COPY multi-build.sh lib-helpers/
# nasm is used for x86 ScummVM
# JDK is needed instead of JRE to patch Android SDK for OpenJDK 11
# Create man directories to please openjdk which expects them
# cf. https://github.com/debuerreotype/debuerreotype/issues/10
RUN for i in $(seq 1 8); do mkdir -p "/usr/share/man/man${i}"; done && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
default-jdk-headless \
golang-go \
nasm && \
rm -rf /var/lib/apt/lists/*
# Unlike the newer toolchain, this one is quite static because it shouldn't evolve in time
# and many tricks may depend on the NDK version
ENV ANDROID_ROOT=/opt/android/stable
# Old toolchains need python to create toolchains and old ncurses
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
libncurses5 \
python && \
rm -rf /var/lib/apt/lists/*
# ABIS is for ndk-old package and determine how the unified toolchain will be composed
# API is none because we don't have new style folder hierarchy
ENV ANDROID_NDK_ROOT=${ANDROID_ROOT}/ndk \
TOOLCHAIN=${ANDROID_ROOT}/toolchain \
ABIS="arm/9 arm64/21 x86/9 x86_64/21" \
API="none" \
HOST_TAG=linux-x86_64
# Install NDK using settings above
local_sdk_package(ndk-old)
# Include the packaging instructions
m4_include(`packages_list.m4')
# Install an old (unsupported) SDK because build process depends on android project command
ENV ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
local_sdk_package(sdk-old)
##### Resulting toolchain #####
FROM debian:stable-slim
USER root
WORKDIR /usr/src
# Copy and execute each step separately to avoid invalidating cache
COPY --from=helpers /lib-helpers/prepare.sh lib-helpers/
RUN lib-helpers/prepare.sh
COPY --from=helpers /lib-helpers/functions.sh lib-helpers/
COPY functions-platform.sh lib-helpers/
COPY functions-sdk.sh lib-helpers/
COPY multi-build.sh lib-helpers/
# Create man directories to please openjdk which expects them
# cf. https://github.com/debuerreotype/debuerreotype/issues/10
# ant is used by ScummVM build system
# file is used ndk-build in NDK 14
# libncurses5 is used by binaries in NDK 14
# nasm is used for x86 ScummVM
RUN for i in $(seq 1 8); do mkdir -p "/usr/share/man/man${i}"; done && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ant \
default-jre-headless \
file \
libncurses5 \
nasm && \
rm -rf /var/lib/apt/lists/*
ENV ANDROID_ROOT=/opt/android
# Toolchains are not (yet?) relocatable, so we must not change their path once they are compiled
COPY --from=toolchain-master ${ANDROID_ROOT}/master/ ${ANDROID_ROOT}/master/
COPY --from=toolchain-stable ${ANDROID_ROOT}/stable/ ${ANDROID_ROOT}/stable/
@@ -1,7 +1,7 @@
m4_dnl This file is included by Dockerfile.m4
# zlib is already provided by Android but doesn't come with a pkg-config file
# This package just installs one to please libpng and others which require it
local_package(zlib)
android_package(zlib)
helpers_package(libpng1.6)
@@ -15,8 +15,9 @@ helpers_package(libogg)
helpers_package(libtheora)
# Copy platform patch
COPY packages/libvorbis lib-helpers/packages/libvorbis
# Platform patch provided in android-common
# Remove compilation flag not supported by clang
COPY --from=android-helpers /lib-helpers/packages/libvorbis lib-helpers/packages/libvorbis
helpers_package(libvorbis)
helpers_package(flac)
@@ -27,21 +28,22 @@ helpers_package(a52dec)
helpers_package(libiconv)
local_package(openssl)
android_package(openssl)
helpers_package(curl)
helpers_package(freetype)
# Specific android patched version
local_package(libsdl2)
android_package(libsdl2)
# Copy platform patch
# Platform patch provided in android-common
# Don't depend on SDL2 (paradoxical)
# We have installed it but it depends on OpenGL so try to avoid these dependencies
COPY packages/libsdl2-net lib-helpers/packages/libsdl2-net
COPY --from=android-helpers /lib-helpers/packages/libsdl2-net lib-helpers/packages/libsdl2-net
helpers_package(libsdl2-net)
# Copy platform patch
COPY packages/fluidsynth-lite lib-helpers/packages/fluidsynth-lite
# Platform patch provided in android-common
# Fix destination directories
COPY --from=android-helpers /lib-helpers/packages/fluidsynth-lite lib-helpers/packages/fluidsynth-lite
helpers_package(fluidsynth-lite, -DBIN_INSTALL_DIR=bin/\$TARGET/\$API -DLIB_INSTALL_DIR=lib/\$TARGET/\$API)
+40
View File
@@ -0,0 +1,40 @@
m4_define(`local_sdk_package', COPY packages/$1 lib-helpers/packages/$1/
RUN $3 lib-helpers/packages/$1/build.sh $2)m4_dnl
m4_define(`local_package', COPY packages/$1 lib-helpers/packages/$1/
RUN $3 lib-helpers/multi-build.sh lib-helpers/packages/$1/build.sh $2)m4_dnl
m4_define(`helpers_package', COPY --from=helpers /lib-helpers/packages/$1 lib-helpers/packages/$1/
RUN $3 lib-helpers/multi-build.sh lib-helpers/packages/$1/build.sh $2)m4_dnl
m4_define(`android_package', COPY --from=android-helpers /lib-helpers/packages/$1 lib-helpers/packages/$1/
RUN $3 lib-helpers/multi-build.sh lib-helpers/packages/$1/build.sh $2)
FROM toolchains/common AS helpers
FROM toolchains/android-common AS android-helpers
FROM debian:stable-slim
USER root
WORKDIR /usr/src
# Copy and execute each step separately to avoid invalidating cache
COPY --from=helpers /lib-helpers/prepare.sh lib-helpers/
RUN lib-helpers/prepare.sh
COPY --from=helpers /lib-helpers/functions.sh lib-helpers/
COPY --from=android-helpers /lib-helpers/functions-platform.sh \
/lib-helpers/functions-sdk.sh \
/lib-helpers/multi-build.sh lib-helpers/
# nasm is used for x86 ScummVM
# Create man directories to please openjdk which expects them
# cf. https://github.com/debuerreotype/debuerreotype/issues/10
RUN for i in $(seq 1 8); do mkdir -p "/usr/share/man/man${i}"; done && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
default-jre-headless \
nasm && \
rm -rf /var/lib/apt/lists/*
+43
View File
@@ -0,0 +1,43 @@
FROM toolchains/android-old AS toolchain
m4_include(`debian-builder-base.m4')m4_dnl
# nasm is used for x86 ScummVM
# Create man directories to please openjdk which expects them
# cf. https://github.com/debuerreotype/debuerreotype/issues/10
RUN for i in $(seq 1 8); do mkdir -p "/usr/share/man/man${i}"; done && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
default-jre-headless \
nasm && \
rm -rf /var/lib/apt/lists/*
# Split to keep the previous rule the same as the android one
# Ant is needed by old Android build system
# file is needed by ndk-build
# libncurses5 is needed by all binaries
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ant \
file \
libncurses5 && \
rm -rf /var/lib/apt/lists/*
ENV RO_ANDROID_ROOT=/opt/android \
ANDROID_EXTERNAL_ROOT=/data/bshomes/android \
HOST_TAG=linux-x86_64
COPY --from=toolchain ${RO_ANDROID_ROOT} ${RO_ANDROID_ROOT}/
# Copy the wrapper script in charge of copying the licenses at the right place
COPY setup_wrapper.sh ${RO_ANDROID_ROOT}/
ENV ANDROID_NDK=${RO_ANDROID_ROOT}/ndk \
ANDROID_TOOLCHAIN=${RO_ANDROID_ROOT}/toolchain \
ANDROID_SDK=${RO_ANDROID_ROOT}/sdk \
ANDROID_SDK_HOME=${ANDROID_EXTERNAL_ROOT}/sdk-home
# Don't forget quotes for the ENTRYPOINT as it's a list of strings
# We can't use RO_ANDROID_ROOT there as it's not expanded when running
m4_define(`ENTRY_WRAPPER', `"/opt/android/setup_wrapper.sh"')m4_dnl
m4_include(`run-buildbot.m4')m4_dnl
+7
View File
@@ -0,0 +1,7 @@
#! /bin/sh
# Create home directory
mkdir -p "${ANDROID_SDK_HOME}"
# Don't do anything after so replace our process
exec "$@"
+8 -7
View File
@@ -2,23 +2,18 @@ FROM toolchains/android AS toolchain
m4_include(`debian-builder-base.m4')m4_dnl
# nasm is used for x86 ScummVM
# Create man directories to please openjdk which expects them
# cf. https://github.com/debuerreotype/debuerreotype/issues/10
# ant is used by ScummVM build system
# file is used ndk-build in NDK 14
# libncurses5 is used by binaries in NDK 14
# nasm is used for x86 ScummVM
RUN for i in $(seq 1 8); do mkdir -p "/usr/share/man/man${i}"; done && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ant \
default-jre-headless \
file \
libncurses5 \
nasm && \
rm -rf /var/lib/apt/lists/*
ENV RO_ANDROID_ROOT=/opt/android \
ANDROID_EXTERNAL_ROOT=/data/bshomes/android \
HOST_TAG=linux-x86_64
COPY --from=toolchain ${RO_ANDROID_ROOT} ${RO_ANDROID_ROOT}/
@@ -26,6 +21,12 @@ COPY --from=toolchain ${RO_ANDROID_ROOT} ${RO_ANDROID_ROOT}/
# Copy the wrapper script in charge of copying the licenses at the right place
COPY setup_wrapper.sh ${RO_ANDROID_ROOT}/
ENV ANDROID_NDK_ROOT=${RO_ANDROID_ROOT}/ndk \
ANDROID_TOOLCHAIN=${RO_ANDROID_ROOT}/ndk/toolchains/llvm/prebuilt/linux-x86_64 \
ANDROID_SDK_ROOT=${ANDROID_EXTERNAL_ROOT}/sdk \
ANDROID_SDK_HOME=${ANDROID_EXTERNAL_ROOT}/sdk-home \
GRADLE_USER_HOME=${ANDROID_EXTERNAL_ROOT}/gradle
# Don't forget quotes for the ENTRYPOINT as it's a list of strings
# We can't use RO_ANDROID_ROOT there as it's not expanded when running
m4_define(`ENTRY_WRAPPER', `"/opt/android/setup_wrapper.sh"')m4_dnl
+1 -6
View File
@@ -1,15 +1,10 @@
#! /bin/sh
unset ANDROID_SDK_ROOT ANDROID_SDK_HOME GRADLE_USER_HOME
ANDROID_SDK_ROOT=/data/bshomes/android/sdk
ANDROID_SDK_HOME=/data/bshomes/android/sdk-home
GRADLE_USER_HOME=/data/bshomes/android/gradle
# Create all directories
mkdir -p "${ANDROID_SDK_ROOT}" "${ANDROID_SDK_HOME}" "${GRADLE_USER_HOME}"
# Copy accepted licenses as we can't accept them during the build process
cp -R "${RO_ANDROID_ROOT}"/master/sdk/licenses "${ANDROID_SDK_ROOT}"/licenses
cp -R "${RO_ANDROID_ROOT}"/sdk/licenses "${ANDROID_SDK_ROOT}"/licenses
# Disable gradle build daemon as we kill the container after the build
echo "org.gradle.daemon=false" > "${GRADLE_USER_HOME}"/gradle.properties