From f747e2e5508597f6f7aa96d5c46d348dfb5b85d4 Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Fri, 3 Aug 2018 12:52:13 -0700 Subject: [PATCH 1/4] [sdks/android] Pre: Disable `testCaching` for frequent intermittent failures. --- .../src/test/java/org/mozilla/mentat/FFIIntegrationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdks/android/Mentat/library/src/test/java/org/mozilla/mentat/FFIIntegrationTest.java b/sdks/android/Mentat/library/src/test/java/org/mozilla/mentat/FFIIntegrationTest.java index 8f5979c9..f9f75408 100644 --- a/sdks/android/Mentat/library/src/test/java/org/mozilla/mentat/FFIIntegrationTest.java +++ b/sdks/android/Mentat/library/src/test/java/org/mozilla/mentat/FFIIntegrationTest.java @@ -1173,7 +1173,7 @@ public class FFIIntegrationTest { expectation2.await(); } - @Test + // @Test // Disabled due to frequent failures. public void testCaching() throws InterruptedException { String query = "[:find ?district :where\n" + " [?neighborhood :neighborhood/name \"Beacon Hill\"]\n" + From 0cb82277507d0153e254bb190ae31d90c36d97a9 Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Wed, 1 Aug 2018 11:36:48 -0700 Subject: [PATCH 2/4] [automation] Be project agnostic; use armv7-linux-androideabi; install Android standalone toolchains. This is ready for Android Rust-y components: it no longer references Mentat. The standalone toolchains are installed into $ANDROID_NDK_TOOLCHAIN_DIR/arch-$ANDROID_NDK_API_VERSION. --- automation/docker/Dockerfile | 48 +++++++++++++----------------------- 1 file changed, 17 insertions(+), 31 deletions(-) diff --git a/automation/docker/Dockerfile b/automation/docker/Dockerfile index 94e01bb2..e4190e25 100644 --- a/automation/docker/Dockerfile +++ b/automation/docker/Dockerfile @@ -11,7 +11,6 @@ MAINTAINER Nick Alexander "nalexander@mozilla.com" #---------------------------------------------------------------------------------------------------------------------- ENV ANDROID_NDK_VERSION "r17b" -ENV PROJECT_REPOSITORY "https://github.com/mozilla/mentat.git" #---------------------------------------------------------------------------------------------------------------------- #-- System ------------------------------------------------------------------------------------------------------------ @@ -26,19 +25,24 @@ RUN apt-get update -qq RUN mkdir -p /build WORKDIR /build -# ENV ANDROID_HOME /build/android-sdk -# ENV ANDROID_SDK_HOME /build/android-sdk ENV ANDROID_NDK_HOME /build/android-ndk -# ENV PATH ${PATH}:${ANDROID_NDK_HOME}/tools:${ANDROID_SDK_HOME}/tools/bin:${ANDROID_SDK_HOME}/platform-tools:/opt/tools:${ANDROID_SDK_HOME}/build-tools/${ANDROID_BUILD_TOOLS} RUN curl -L https://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip > ndk.zip \ && unzip ndk.zip -d /build \ && rm ndk.zip \ && mv /build/android-ndk-${ANDROID_NDK_VERSION} ${ANDROID_NDK_HOME} +ENV ANDROID_NDK_TOOLCHAIN_DIR /build/android-ndk-toolchain +ENV ANDROID_NDK_API_VERSION 26 + +RUN set -eux; \ + python "$ANDROID_NDK_HOME/build/tools/make_standalone_toolchain.py" --arch="arm" --api="$ANDROID_NDK_API_VERSION" --install-dir="$ANDROID_NDK_TOOLCHAIN_DIR/arm-$ANDROID_NDK_API_VERSION" --force; \ + python "$ANDROID_NDK_HOME/build/tools/make_standalone_toolchain.py" --arch="arm64" --api="$ANDROID_NDK_API_VERSION" --install-dir="$ANDROID_NDK_TOOLCHAIN_DIR/arm64-$ANDROID_NDK_API_VERSION" --force; \ + python "$ANDROID_NDK_HOME/build/tools/make_standalone_toolchain.py" --arch="x86" --api="$ANDROID_NDK_API_VERSION" --install-dir="$ANDROID_NDK_TOOLCHAIN_DIR/x86-$ANDROID_NDK_API_VERSION" --force + #---------------------------------------------------------------------------------------------------------------------- #-- Rust (cribbed from https://github.com/rust-lang-nursery/docker-rust/blob/ced83778ec6fea7f63091a484946f95eac0ee611/1.27.1/stretch/Dockerfile) -#-- Rust after the Android NDK since Rust rolls forward more frequently. +#-- Rust is after the Android NDK since Rust rolls forward more frequently. Both stable and beta for advanced consumers. #---------------------------------------------------------------------------------------------------------------------- ENV RUSTUP_HOME=/usr/local/rustup \ @@ -59,37 +63,19 @@ RUN set -eux; \ cargo --version; \ rustc --version; \ rustup target add i686-linux-android; \ - rustup target add arm-linux-androideabi; \ + rustup target add armv7-linux-androideabi; \ rustup target add aarch64-linux-android -#---------------------------------------------------------------------------------------------------------------------- -#-- Project ----------------------------------------------------------------------------------------------------------- -#---------------------------------------------------------------------------------------------------------------------- - -RUN git clone $PROJECT_REPOSITORY - -WORKDIR /build/mentat - -# Temporary. -RUN git fetch origin build-android-sdk && git checkout origin/build-android-sdk && git show-ref HEAD - -# Populate dependencies. -RUN ./sdks/android/Mentat/gradlew --no-daemon -p sdks/android/Mentat tasks - -# Cache toolchains. -RUN ./sdks/android/Mentat/gradlew --no-daemon -p sdks/android/Mentat generateToolchains - -# Build Rust. -RUN ./sdks/android/Mentat/gradlew --no-daemon -p sdks/android/Mentat cargoBuild - -# Actually build. In the future, we might also test and lint (to cache additional dependencies). -RUN ./sdks/android/Mentat/gradlew --no-daemon -p sdks/android/Mentat assemble - -# Drop built Rust artifacts. -RUN cargo clean +RUN set -eux; \ + rustup install beta; \ + rustup target add --toolchain beta i686-linux-android; \ + rustup target add --toolchain beta armv7-linux-androideabi; \ + rustup target add --toolchain beta aarch64-linux-android #---------------------------------------------------------------------------------------------------------------------- # -- Cleanup ---------------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------------------------- +WORKDIR /build + RUN apt-get clean From 814ab19ecbc089fcd33549d748e6a709546058fb Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Thu, 2 Aug 2018 14:22:09 -0700 Subject: [PATCH 3/4] [automation] Move project-agnostic Dockerfile into subdirectory. Docker is directory oriented so we have to play along. --- automation/docker/{ => generic}/Dockerfile | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename automation/docker/{ => generic}/Dockerfile (100%) diff --git a/automation/docker/Dockerfile b/automation/docker/generic/Dockerfile similarity index 100% rename from automation/docker/Dockerfile rename to automation/docker/generic/Dockerfile From b5d0e12a24e4217e378ff1b24a09ef9f44b11d5c Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Thu, 2 Aug 2018 14:23:37 -0700 Subject: [PATCH 4/4] [automation] Re-add project-specific Mentat Docker image. --- .taskcluster.yml | 4 +-- automation/docker/Dockerfile | 36 +++++++++++++++++++ .../taskcluster/decision_task_pull_request.py | 2 +- sdks/android/Mentat/build.gradle | 7 ++-- 4 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 automation/docker/Dockerfile diff --git a/.taskcluster.yml b/.taskcluster.yml index 24848ffb..ba36df3c 100644 --- a/.taskcluster.yml +++ b/.taskcluster.yml @@ -25,7 +25,7 @@ tasks: payload: maxRunTime: 3600 deadline: "{{ '2 hours' | $fromNow }}" - image: 'mozillamobile/mentat:1.1' + image: 'mozillamobile/android-components:1.4' command: - /bin/bash - '--login' @@ -57,7 +57,7 @@ tasks: payload: maxRunTime: 3600 deadline: "{{ '2 hours' | $fromNow }}" - image: 'mozillamobile/mentat:1.1' + image: 'mozillamobile/mentat:1.2' command: - /bin/bash - '--login' diff --git a/automation/docker/Dockerfile b/automation/docker/Dockerfile new file mode 100644 index 00000000..818436d2 --- /dev/null +++ b/automation/docker/Dockerfile @@ -0,0 +1,36 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +FROM mozillamobile/rust-component:buildtools-27.0.3-ndk-r17b-ndk-version-26-rust-stable-rust-beta + +MAINTAINER Nick Alexander "nalexander@mozilla.com" + +#---------------------------------------------------------------------------------------------------------------------- +#-- Project ----------------------------------------------------------------------------------------------------------- +#---------------------------------------------------------------------------------------------------------------------- + +ENV PROJECT_REPOSITORY "https://github.com/mozilla/mentat.git" + +RUN git clone $PROJECT_REPOSITORY + +WORKDIR /build/mentat + +# Temporary. +RUN git fetch origin master && git checkout origin/generic-automation-images && git show-ref HEAD + +# Populate dependencies. +RUN ./sdks/android/Mentat/gradlew --no-daemon -p sdks/android/Mentat tasks + +# Build Rust. +RUN ./sdks/android/Mentat/gradlew --no-daemon -p sdks/android/Mentat cargoBuild + +# Actually build. In the future, we might also lint (to cache additional dependencies). +RUN ./sdks/android/Mentat/gradlew --no-daemon -p sdks/android/Mentat assemble test + +#---------------------------------------------------------------------------------------------------------------------- +# -- Cleanup ---------------------------------------------------------------------------------------------------------- +#---------------------------------------------------------------------------------------------------------------------- + +# Drop built Rust artifacts. +RUN cargo clean diff --git a/automation/taskcluster/decision_task_pull_request.py b/automation/taskcluster/decision_task_pull_request.py index 69e4e98c..4ef09da5 100644 --- a/automation/taskcluster/decision_task_pull_request.py +++ b/automation/taskcluster/decision_task_pull_request.py @@ -63,7 +63,7 @@ def create_task(name, description, command): "payload": { "features": {}, "maxRunTime": 7200, - "image": "mozillamobile/mentat:1.1", + "image": "mozillamobile/mentat:1.2", "command": [ "/bin/bash", "--login", diff --git a/sdks/android/Mentat/build.gradle b/sdks/android/Mentat/build.gradle index 26397c48..1407553b 100644 --- a/sdks/android/Mentat/build.gradle +++ b/sdks/android/Mentat/build.gradle @@ -29,13 +29,14 @@ buildscript { classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' - classpath 'gradle.plugin.org.mozilla.rust-android-gradle:plugin:0.1.0' - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files + classpath 'gradle.plugin.org.mozilla.rust-android-gradle:plugin:0.2.0' // Yes, this is unusual. We want to access some host-specific // computation at build time. classpath 'net.java.dev.jna:jna:4.5.2' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files } }