Bug 1537734 - Update wrench android build to use offline mode in gradle. r=nalexander

The updated cargo-apk version now correctly handles the `--frozen` flag
and additionally translates it to the `--offline` flag when invoking
gradle. This makes the gradle build fail instead of attempting network
fetches. To make the offline gradle build work, we set up a build.gradle
snippet that points to the maven repositories from the gradle toolchain
artifact, and have cargo-apk use that instead of the default jcenter()
repository.

Differential Revision: https://phabricator.services.mozilla.com/D24485

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kartikaya Gupta 2019-03-24 15:34:17 +00:00
Родитель fb63ec3305
Коммит 08ce8aed17
2 изменённых файлов: 23 добавлений и 2 удалений

Просмотреть файл

@ -7,11 +7,31 @@ mv wrench-deps/{vendor,.cargo,cargo-apk} gfx/wr
popd popd
pushd "${GECKO_PATH}/gfx/wr/wrench" pushd "${GECKO_PATH}/gfx/wr/wrench"
# The following maven links are equivalent to GRADLE_MAVEN_REPOSITORIES, try
# and keep in sync
cat > build.gradle.inc <<END
buildscript {
repositories {
maven{ url uri('file:${GECKO_PATH}/android-gradle-dependencies/google') }
maven{ url uri('file:${GECKO_PATH}/android-gradle-dependencies/jcenter') }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
}
}
allprojects {
repositories {
maven{ url uri('file:${GECKO_PATH}/android-gradle-dependencies/google') }
maven{ url uri('file:${GECKO_PATH}/android-gradle-dependencies/jcenter') }
}
}
END
# These things come from the toolchain dependencies of the job that invokes # These things come from the toolchain dependencies of the job that invokes
# this script (webrender-wrench-android-build). # this script (webrender-wrench-android-build).
export PATH="${PATH}:${GECKO_PATH}/rustc/bin:${GECKO_PATH}/android-gradle-dependencies/gradle-dist/bin"
export PATH="${PATH}:${GECKO_PATH}/rustc/bin" export PATH="${PATH}:${GECKO_PATH}/rustc/bin"
export ANDROID_HOME="${GECKO_PATH}/android-sdk-linux" export ANDROID_HOME="${GECKO_PATH}/android-sdk-linux"
export NDK_HOME="${GECKO_PATH}/android-ndk" export NDK_HOME="${GECKO_PATH}/android-ndk"
export CARGO_APK_GRADLE_COMMAND="${GECKO_PATH}/android-gradle-dependencies/gradle-dist/bin/gradle"
export CARGO_APK_BUILD_GRADLE_INC="${PWD}/build.gradle.inc"
../cargo-apk/bin/cargo-apk build --frozen --verbose ../cargo-apk/bin/cargo-apk build --frozen --verbose
popd popd

Просмотреть файл

@ -22,10 +22,11 @@ mv vendor .cargo wrench-deps/
mkdir wrench-deps/cargo-apk mkdir wrench-deps/cargo-apk
# Until there's a version of cargo-apk published on crates.io that has # Until there's a version of cargo-apk published on crates.io that has
# https://github.com/tomaka/android-rs-glue/pull/205 and # https://github.com/tomaka/android-rs-glue/pull/205 and
# https://github.com/tomaka/android-rs-glue/pull/207 and
# https://github.com/tomaka/android-rs-glue/pull/171 (see also # https://github.com/tomaka/android-rs-glue/pull/171 (see also
# https://github.com/tomaka/android-rs-glue/issues/204), we need to use # https://github.com/tomaka/android-rs-glue/issues/204), we need to use
# an unpublished version. # an unpublished version.
cargo install --git https://github.com/staktrace/android-rs-glue --rev 6b2be25bd536a453e233cd7aea9d22974db63a49 --root wrench-deps/cargo-apk cargo-apk cargo install --git https://github.com/staktrace/android-rs-glue --rev 486491e81819c3346d364a93fc1f3c0206d3ece0 --root wrench-deps/cargo-apk cargo-apk
tar caf wrench-deps.tar.bz2 wrench-deps tar caf wrench-deps.tar.bz2 wrench-deps
mkdir -p $UPLOAD_DIR mkdir -p $UPLOAD_DIR