Skip to content

Commit

Permalink
Install Java 8, Android command line tools and SDK for Ubuntu (#188)
Browse files Browse the repository at this point in the history
* Install Android command line tools and SDK for Ubuntu

These are used for Envoy Mobile's CI and currently installed on every
CI job run: https://github.com/envoyproxy/envoy/blob/main/mobile/ci/linux_ci_setup.sh

Signed-off-by: JP Simard <[email protected]>
  • Loading branch information
jpsim authored Dec 8, 2022
1 parent cc864e6 commit dce0a8c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
6 changes: 6 additions & 0 deletions build_container/Dockerfile-ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ ENV CLOUDSDK_PYTHON=python3
COPY ./build_container_common.sh /
COPY ./build_container_ubuntu.sh /

ENV ANDROID_SDK_INSTALL_TARGET /.android
ENV ANDROID_HOME /.android/sdk
ENV ANDROID_SDK_ROOT /.android/sdk
ENV ANDROID_NDK_VERSION 21.4.7075529
ENV ANDROID_NDK_HOME /.android/sdk/ndk/21.4.7075529

RUN ./build_container_ubuntu.sh

ENV LANG en_US.utf8
47 changes: 47 additions & 0 deletions build_container/build_container_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,53 @@ update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
# TODO(phlax): use hashed requirements
pip3 install -U pyyaml virtualenv

function install_android_tools() {
#############
# Install JDK
#############

# Add Azul's public key
apt-key adv \
--keyserver hkp://keyserver.ubuntu.com:80 \
--recv-keys 0xB1998361219BD9C9

# Download and install the package that adds
# the Azul APT repository to the list of sources
curl -O https://cdn.azul.com/zulu/bin/zulu-repo_1.0.0-3_all.deb

# Install the Java 8 JDK
apt-get install -y ./zulu-repo_1.0.0-3_all.deb
apt-get update -y
apt-get install -y zulu8-jdk
rm ./zulu-repo_1.0.0-3_all.deb

#######################
# Install Android tools
#######################

mkdir -p "$ANDROID_HOME"
pushd "$ANDROID_SDK_INSTALL_TARGET"

cmdline_file="commandlinetools-linux-7583922_latest.zip"
curl -OL "https://dl.google.com/android/repository/$cmdline_file"
unzip "$cmdline_file"
mkdir -p sdk/cmdline-tools/latest
mv cmdline-tools/* sdk/cmdline-tools/latest

sdkmanager=$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager
echo "y" | $sdkmanager --install "ndk;$ANDROID_NDK_VERSION"
$sdkmanager --install "platforms;android-30"
$sdkmanager --install "build-tools;30.0.2"

popd
}

case $ARCH in
'x86_64' )
install_android_tools
;;
esac

source ./build_container_common.sh

# Soft link the gcc compiler (required by python env)
Expand Down

0 comments on commit dce0a8c

Please sign in to comment.