From 07a7f542c37828247965046bf47dd58b8e371f65 Mon Sep 17 00:00:00 2001 From: Ben Dean-Kawamura Date: Wed, 28 Jul 2021 14:50:40 -0400 Subject: [PATCH] Updating libs/scripts to require Java 11 --- docs/building.md | 4 ++-- libs/verify-android-ci-environment.sh | 8 ++++---- taskcluster/docker/linux/Dockerfile | 18 +++++++++++------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/docs/building.md b/docs/building.md index de63e28c3..77e7b4688 100644 --- a/docs/building.md +++ b/docs/building.md @@ -74,8 +74,8 @@ The instructions here assume that you are building for Fenix in order test your 1. Install Android SDK, JAVA, NDK and set required env vars 1. Clone the [Fenix](https://github.com/mozilla-mobile/fenix/) repository (not in a-s) 1. Clone the [android-components](https://github.com/mozilla-mobile/android-components/) repository (not in a-s) - 1. Install [Java **8**] for your system - 1. Set `JAVA_HOME` to point to the JDK 8 installation directory. + 1. Install [Java **11**] for your system + 1. Set `JAVA_HOME` to point to the JDK 11 installation directory. 1. Download and install [Android Studio](https://developer.android.com/studio/#downloads) 1. Set `ANDROID_SDK_ROOT` and `ANDROID_HOME` to the Android Studio sdk location and add it to your rc file. 1. Configure the required versions of NDK diff --git a/libs/verify-android-ci-environment.sh b/libs/verify-android-ci-environment.sh index d8f595c43..d7bb2727e 100755 --- a/libs/verify-android-ci-environment.sh +++ b/libs/verify-android-ci-environment.sh @@ -53,14 +53,14 @@ location of your Java installation." fi JAVA_VERSION=$("$JAVACMD" -version 2>&1 | grep -i version | cut -d'"' -f2 | cut -d'.' -f1-2) -if [[ "${JAVA_VERSION}" != "1.8" ]]; then - echo "Incompatible java version: ${JAVA_VERSION}. JDK 8 must be installed." - echo "Try switching versions and re-running. Using sdkman: sdk install java 8.0.282+8.hs-adpt || sdk use java 8.0.282+8.hs-adpt" +if [[ "${JAVA_VERSION}" != "11.0" ]]; then + echo "Incompatible java version: ${JAVA_VERSION}. JDK 11 must be installed." + echo "Try switching versions and re-running. Using sdkman: sdk install java 11.0.3.hs-adpt || sdk use 11.0.3.hs-adpt" exit 1 fi # NDK ez-install -"$ANDROID_HOME/tools/bin/sdkmanager" "ndk;$(./gradlew -q printNdkVersion | tail -1)" +"$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" "ndk;$(./gradlew -q printNdkVersion | tail -1)" # CI just downloads these libs anyway. if [[ -z "${CI}" ]]; then diff --git a/taskcluster/docker/linux/Dockerfile b/taskcluster/docker/linux/Dockerfile index c33a986cf..3da404ae4 100644 --- a/taskcluster/docker/linux/Dockerfile +++ b/taskcluster/docker/linux/Dockerfile @@ -20,9 +20,9 @@ WORKDIR /builds/worker/ # Configuration -ENV ANDROID_BUILD_TOOLS "28.0.3" -ENV ANDROID_SDK_VERSION "3859397" -ENV ANDROID_PLATFORM_VERSION "28" +ENV ANDROID_BUILD_TOOLS "30.0.3" +ENV ANDROID_PLATFORM_VERSION "30" +ENV ANDROID_NDK_VERSION "21.3.6528147" # Set up the language variables to avoid problems (we run locale-gen later). ENV LANG en_US.UTF-8 @@ -51,7 +51,7 @@ RUN apt-get update -qq \ # If you add anything below, please update building.md. #################### # Android builds - openjdk-8-jdk \ + openjdk-11-jdk \ # Required by gyp but also CI scripts. python3 \ # libs/ source patching. @@ -110,10 +110,14 @@ WORKDIR /builds/worker ENV ANDROID_HOME /builds/worker/android-sdk ENV ANDROID_SDK_HOME /builds/worker/android-sdk -ENV PATH ${PATH}:${ANDROID_SDK_HOME}/tools:${ANDROID_SDK_HOME}/tools/bin:${ANDROID_SDK_HOME}/platform-tools:/opt/tools:${ANDROID_SDK_HOME}/build-tools/${ANDROID_BUILD_TOOLS} +ENV PATH ${PATH}:${ANDROID_SDK_HOME}/cmdline-tools/latest/bin:${ANDROID_SDK_HOME}/platform-tools:/opt/tools:${ANDROID_SDK_HOME}/build-tools/${ANDROID_BUILD_TOOLS} -RUN curl -sfSL --retry 5 --retry-delay 10 https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_VERSION}.zip > sdk.zip \ - && unzip -q sdk.zip -d ${ANDROID_SDK_HOME} \ +# Download the Android SDK tools, unzip them to ${ANDROID_SDK_HOME}/cmdline-tools/latest/, accept all licenses +# The download link comes from https://developer.android.com/studio/#downloads +RUN curl -sfSL --retry 5 --retry-delay 10 https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip > sdk.zip \ + && unzip -q sdk.zip \ + && mkdir $ANDROID_SDK_HOME/cmdline-tools \ + && mv cmdline-tools $ANDROID_HOME/cmdline-tools/latest \ && rm sdk.zip \ && mkdir -p /builds/worker/android-sdk/.android/ \ && touch /builds/worker/android-sdk/.android/repositories.cfg \