Skip to content

Commit

Permalink
Only install JDK and Android tools on x86_64
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsim committed Dec 6, 2022
1 parent adb40c2 commit c2cd427
Showing 1 changed file with 52 additions and 51 deletions.
103 changes: 52 additions & 51 deletions build_container/build_container_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -132,58 +132,59 @@ update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
# TODO(phlax): use hashed requirements
pip3 install -U pyyaml virtualenv

########################
# Begin JDK installation
########################
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
#######################

sdk_install_target="/github/home/.android"
mkdir -p "$sdk_install_target/sdk"
pushd "$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

ANDROID_HOME="$(realpath "$sdk_install_target/sdk")"
SDKMANAGER=$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager

echo "y" | $SDKMANAGER --install "ndk;21.4.7075529"
$SDKMANAGER --install "platforms;android-30"
$SDKMANAGER --install "build-tools;30.0.2"

export "ANDROID_HOME=${ANDROID_HOME}"
export "ANDROID_SDK_ROOT=${ANDROID_HOME}"
export "ANDROID_NDK_HOME=${ANDROID_HOME}/ndk/21.4.7075529"

popd
}

# 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

######################
# End JDK installation
######################

##################################
# Begin Android tools installation
##################################

sdk_install_target="/github/home/.android"
mkdir -p "$sdk_install_target/sdk"
pushd "$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

ANDROID_HOME="$(realpath "$sdk_install_target/sdk")"
SDKMANAGER=$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager

echo "y" | $SDKMANAGER --install "ndk;21.4.7075529"
$SDKMANAGER --install "platforms;android-30"
$SDKMANAGER --install "build-tools;30.0.2"

export "ANDROID_HOME=${ANDROID_HOME}"
export "ANDROID_SDK_ROOT=${ANDROID_HOME}"
export "ANDROID_NDK_HOME=${ANDROID_HOME}/ndk/21.4.7075529"

popd

################################
# End Android tools installation
################################
case $ARCH in
'x86_64' )
install_android_tools
;;
esac

source ./build_container_common.sh

Expand Down

0 comments on commit c2cd427

Please sign in to comment.