Skip to content

Commit

Permalink
Updating libs/scripts to require Java 11
Browse files Browse the repository at this point in the history
  • Loading branch information
bhearsum authored and bendk committed Sep 14, 2021
1 parent c51b635 commit 07a7f54
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
4 changes: 2 additions & 2 deletions docs/building.md
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions libs/verify-android-ci-environment.sh
Expand Up @@ -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
Expand Down
20 changes: 12 additions & 8 deletions taskcluster/docker/linux/Dockerfile
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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}

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} \
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}

# 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 \
Expand Down

0 comments on commit 07a7f54

Please sign in to comment.