Bug 1406196 - Move GRADLE_USER_HOME in tree. r=maliu
The goal of this approach is to tell Gradle to not connect (or allow
it to connect) to the network when fetching dependencies. No Android
automation tasks should fetch from the network, except the toolchain
tasks (which are specially intended to do so).
It's difficult to arrange this without including the `--offline` flag
everywhere. It _should_ be possible to set offline using an
environment variable -- which would allow us to get rid of these
dotgradle-* files -- but offline isn't an option in
https://docs.gradle.org/4.2.1/userguide/build_environment.html#sec:gradle_configuration_properties
(and certainly not in earlier versions either). Therefore,
environment variable that points to an init.gradle file in automation.
Before this patch, the files telling Gradle whether to start offline
were fetched from tooltool. That's just a layer that doesn't need to
be there.
None of this impacts local developers.
MozReview-Commit-ID: LAXktbBu1Az
--- a/mobile/android/config/tooltool-manifests/android-frontend/releng.manifest
+++ b/mobile/android/config/tooltool-manifests/android-frontend/releng.manifest
@@ -33,18 +33,10 @@
},
{
"algorithm": "sha512",
"visibility": "public",
"filename": "gradle-dist.tar.xz",
"unpack": true,
"digest": "e3cfe7f8259ad97722243d4e873d5a05c014bfc24d637427f89d804bf5073290229c778ea303142cf06c2dc79e0492f23521f57d3a73825f55b8db587317646f",
"size": 51753660
- },
- {
- "algorithm": "sha512",
- "visibility": "public",
- "filename": "dotgradle.tar.xz",
- "unpack": true,
- "digest": "9f082ccd71ad18991eb71fcad355c6990f50a72a09ab9b79696521485656083a72faf5a8d4714de9c4b901ee2319b6786a51964846bb7075061642a8505501c2",
- "size": 512
}
]
--- a/mobile/android/config/tooltool-manifests/android-gradle-dependencies/releng.manifest
+++ b/mobile/android/config/tooltool-manifests/android-gradle-dependencies/releng.manifest
@@ -1,10 +1,2 @@
[
- {
- "algorithm": "sha512",
- "visibility": "public",
- "filename": "dotgradle-online.tar.xz",
- "unpack": true,
- "digest": "0979eb1dcd9349a9c3f51f24747bb6e19e803226d7150fcf6846889ae24a8df925d03edfac038a5330822703c51130d4f5757d9f4caff7bcb2b6f71858c024d3",
- "size": 512
- }
]
--- a/mobile/android/config/tooltool-manifests/android/releng.manifest
+++ b/mobile/android/config/tooltool-manifests/android/releng.manifest
@@ -50,18 +50,10 @@
},
{
"algorithm": "sha512",
"visibility": "public",
"filename": "gradle-dist.tar.xz",
"unpack": true,
"digest": "e3cfe7f8259ad97722243d4e873d5a05c014bfc24d637427f89d804bf5073290229c778ea303142cf06c2dc79e0492f23521f57d3a73825f55b8db587317646f",
"size": 51753660
- },
- {
- "algorithm": "sha512",
- "visibility": "public",
- "filename": "dotgradle.tar.xz",
- "unpack": true,
- "digest": "9f082ccd71ad18991eb71fcad355c6990f50a72a09ab9b79696521485656083a72faf5a8d4714de9c4b901ee2319b6786a51964846bb7075061642a8505501c2",
- "size": 512
}
]
new file mode 100644
--- /dev/null
+++ b/mobile/android/gradle/dotgradle-offline/gradle.properties
@@ -0,0 +1,3 @@
+// Per https://docs.gradle.org/current/userguide/build_environment.html, this
+// overrides the gradle.properties in topsrcdir.
+org.gradle.daemon=false
new file mode 100644
--- /dev/null
+++ b/mobile/android/gradle/dotgradle-offline/init.gradle
@@ -0,0 +1,4 @@
+// From https://discuss.gradle.org/t/enable-offline-mode-using-gradle-properties/12134/2.
+startParameter.offline = true
+// Sadly, this doesn't work: see http://stackoverflow.com/a/19686585.
+// startParameter.logLevel = org.gradle.api.logging.LogLevel.INFO
new file mode 100644
--- /dev/null
+++ b/mobile/android/gradle/dotgradle-online/gradle.properties
@@ -0,0 +1,3 @@
+// Per https://docs.gradle.org/current/userguide/build_environment.html, this
+// overrides the gradle.properties in topsrcdir.
+org.gradle.daemon=false
new file mode 100644
--- /dev/null
+++ b/mobile/android/gradle/dotgradle-online/init.gradle
@@ -0,0 +1,4 @@
+// From https://discuss.gradle.org/t/enable-offline-mode-using-gradle-properties/12134/2.
+startParameter.offline = false
+// Sadly, this doesn't work: see http://stackoverflow.com/a/19686585.
+// startParameter.logLevel = org.gradle.api.logging.LogLevel.INFO
--- a/taskcluster/ci/build/android-stuff.yml
+++ b/taskcluster/ci/build/android-stuff.yml
@@ -7,17 +7,17 @@ android-dependencies/opt:
platform: android-4-0-armv7-api16/opt
kind: build
tier: 2
symbol: tc(Deps)
worker-type: aws-provisioner-v1/gecko-{level}-b-android
worker:
docker-image: {in-tree: android-build}
env:
- GRADLE_USER_HOME: "/builds/worker/workspace/build/src/dotgradle-online"
+ GRADLE_USER_HOME: "/builds/worker/workspace/build/src/mobile/android/gradle/dotgradle-online"
PERFHERDER_EXTRA_OPTIONS: android-dependencies
TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android-gradle-dependencies/releng.manifest"
WORKSPACE: "/builds/worker/workspace"
artifacts:
- name: public/build
path: /builds/worker/artifacts/
type: directory
- name: private/android-sdk
@@ -57,17 +57,17 @@ android-test/opt:
platform: android-4-0-armv7-api16/opt
kind: build
tier: 2
symbol: tc(test)
worker-type: aws-provisioner-v1/gecko-{level}-b-android
worker:
docker-image: {in-tree: android-build}
env:
- GRADLE_USER_HOME: "/builds/worker/workspace/build/src/dotgradle"
+ GRADLE_USER_HOME: "/builds/worker/workspace/build/src/mobile/android/gradle/dotgradle-offline"
PERFHERDER_EXTRA_OPTIONS: android-test
TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android-frontend/releng.manifest"
artifacts:
- name: public/android/unittest
path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/reports/tests
type: directory
- name: public/build
path: /builds/worker/artifacts/
@@ -102,17 +102,17 @@ android-lint/opt:
platform: android-4-0-armv7-api16/opt
kind: build
tier: 2
symbol: tc(lint)
worker-type: aws-provisioner-v1/gecko-{level}-b-android
worker:
docker-image: {in-tree: android-build}
env:
- GRADLE_USER_HOME: "/builds/worker/workspace/build/src/dotgradle"
+ GRADLE_USER_HOME: "/builds/worker/workspace/build/src/mobile/android/gradle/dotgradle-offline"
PERFHERDER_EXTRA_OPTIONS: android-lint
TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android-frontend/releng.manifest"
artifacts:
- name: public/android/lint/lint-results-officialAustralisDebug.html
path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/outputs/lint-results-officialAustralisDebug.html
type: file
- name: public/android/lint/lint-results-officialAustralisDebug.xml
path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/outputs/lint-results-officialAustralisDebug.xml
@@ -168,17 +168,17 @@ android-checkstyle/opt:
platform: android-4-0-armv7-api16/opt
kind: build
tier: 2
symbol: tc(checkstyle)
worker-type: aws-provisioner-v1/gecko-{level}-b-android
worker:
docker-image: {in-tree: android-build}
env:
- GRADLE_USER_HOME: "/builds/worker/workspace/build/src/dotgradle"
+ GRADLE_USER_HOME: "/builds/worker/workspace/build/src/mobile/android/gradle/dotgradle-offline"
PERFHERDER_EXTRA_OPTIONS: android-checkstyle
TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android-frontend/releng.manifest"
artifacts:
- name: public/android/checkstyle/checkstyle.html
path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/reports/checkstyle/checkstyle.html
type: file
- name: public/android/checkstyle/checkstyle.xml
path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/reports/checkstyle/checkstyle.xml
@@ -218,17 +218,17 @@ android-findbugs/opt:
platform: android-4-0-armv7-api16/opt
kind: build
tier: 2
symbol: tc(findbugs)
worker-type: aws-provisioner-v1/gecko-{level}-b-android
worker:
docker-image: {in-tree: android-build}
env:
- GRADLE_USER_HOME: "/builds/worker/workspace/build/src/dotgradle"
+ GRADLE_USER_HOME: "/builds/worker/workspace/build/src/mobile/android/gradle/dotgradle-offline"
PERFHERDER_EXTRA_OPTIONS: android-findbugs
TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android-frontend/releng.manifest"
artifacts:
- name: public/android/findbugs/findbugs-officialAustralisDebug-output.html
path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/outputs/findbugs/findbugs-officialAustralisDebug-output.html
type: file
- name: public/android/findbugs/findbugs-officialAustralisDebug-output.xml
path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/outputs/findbugs/findbugs-officialAustralisDebug-output.xml
--- a/taskcluster/ci/build/android.yml
+++ b/taskcluster/ci/build/android.yml
@@ -297,18 +297,17 @@ android-api-16-gradle/opt:
platform: android-api-16-gradle/opt
symbol: tc(Bg)
tier: 2
worker-type: aws-provisioner-v1/gecko-{level}-b-android
worker:
docker-image: {in-tree: android-build}
max-run-time: 7200
env:
- # Bug 1292762 - Set GRADLE_USER_HOME to avoid sdk-manager-plugin intermittent
- GRADLE_USER_HOME: /builds/worker/workspace/build/src/dotgradle
+ GRADLE_USER_HOME: /builds/worker/workspace/build/src/mobile/android/gradle/dotgradle-offline
TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android/releng.manifest"
artifacts:
- name: public/android/maven
path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/maven/
type: directory
- name: public/build/geckoview_example.apk
path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview_example/outputs/apk/geckoview_example-withGeckoBinaries.apk
type: file