Backed out 6 changesets (bug 1509572) for linting failure. CLOSED TREE
authorDorel Luca <dluca@mozilla.com>
Mon, 26 Nov 2018 23:21:28 +0200
changeset 504561 79ae8ec996e64730196a994093f3ff8bb4af1384
parent 504560 d534baf412772ee14e0d89f651267cb4dc2a3f6c
child 504562 8e3bf28192dff3eea2e163c4dbf56bc02da86430
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1509572
milestone65.0a1
backs out9f6a7e664cef95703e629aa3fd02cd6a5b014f54
f6653c7d29671c942662c75945ae4f82ef21a31d
122d6f1a1136f696c88481c1cb1d97451a952a77
bc6911d14ae0612c7f78858ca2ee3e4472911317
bd0729ff0bbc9dfcd109f2fb430361b1ea81b1cc
c4087e8ea340050a45994f4d4f938bb5076a8d5f
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 6 changesets (bug 1509572) for linting failure. CLOSED TREE Backed out changeset 9f6a7e664cef (bug 1509572) Backed out changeset f6653c7d2967 (bug 1509572) Backed out changeset 122d6f1a1136 (bug 1509572) Backed out changeset bc6911d14ae0 (bug 1509572) Backed out changeset bd0729ff0bbc (bug 1509572) Backed out changeset c4087e8ea340 (bug 1509572)
gradle/wrapper/gradle-wrapper.properties
mobile/android/annotations/src/main/java/org/mozilla/gecko/annotationProcessors/AnnotationProcessor.java
mobile/android/annotations/src/main/java/org/mozilla/gecko/annotationProcessors/SDKProcessor.java
mobile/android/app/build.gradle
mobile/android/geckoview/build.gradle
mobile/android/gradle/with_gecko_binaries.gradle
mobile/android/mach_commands.py
taskcluster/ci/build/android.yml
taskcluster/scripts/misc/android-gradle-dependencies/after.sh
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,7 +1,7 @@
 #Fri Sep 16 15:41:50 PDT 2016
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
-distributionSha256Sum=b7aedd369a26b177147bcb715f8b1fc4fe32b0a6ade0d7fd8ee5ed0c6f731f2c
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
+distributionSha256Sum=7a2c66d1a78f811d5f37d14630ad21cec5e77a2a4dc61e787e2257a6341016ce
--- a/mobile/android/annotations/src/main/java/org/mozilla/gecko/annotationProcessors/AnnotationProcessor.java
+++ b/mobile/android/annotations/src/main/java/org/mozilla/gecko/annotationProcessors/AnnotationProcessor.java
@@ -165,16 +165,31 @@ public class AnnotationProcessor {
 
     private static String getHeaderGuardName(final String name) {
         return name.replaceAll("\\W", "_");
     }
 
     private static int writeOutputFile(final String name, final StringBuilder content) {
         final byte[] contentBytes = content.toString().getBytes(StandardCharsets.UTF_8);
 
+        try {
+            final byte[] existingBytes = Files.readAllBytes(new File(name).toPath());
+            if (Arrays.equals(contentBytes, existingBytes)) {
+                return 0;
+            }
+        } catch (FileNotFoundException e) {
+            // Pass.
+        } catch (NoSuchFileException e) {
+            // Pass.
+        } catch (IOException e) {
+            System.err.println("Unable to read " + name + ". Perhaps a permissions issue?");
+            e.printStackTrace(System.err);
+            return 1;
+        }
+
         try (FileOutputStream outStream = new FileOutputStream(name)) {
             outStream.write(contentBytes);
         } catch (IOException e) {
             System.err.println("Unable to write " + name + ". Perhaps a permissions issue?");
             e.printStackTrace(System.err);
             return 1;
         }
 
--- a/mobile/android/annotations/src/main/java/org/mozilla/gecko/annotationProcessors/SDKProcessor.java
+++ b/mobile/android/annotations/src/main/java/org/mozilla/gecko/annotationProcessors/SDKProcessor.java
@@ -221,18 +221,18 @@ public class SDKProcessor {
                 }
             }
             return new AnnotationInfo(stubName, mode, thread, target, noLiteral);
         }
     }
 
     public static void main(String[] args) throws Exception {
         // We expect a list of jars on the commandline. If missing, whinge about it.
-        if (args.length < 3 || args.length % 2 != 1) {
-            System.err.println("Usage: java SDKProcessor sdkjar max-sdk-version outdir [configfile fileprefix]*");
+        if (args.length < 5 || args.length % 2 != 1) {
+            System.err.println("Usage: java SDKProcessor sdkjar max-sdk-version outdir [configfile fileprefix]+");
             System.exit(1);
         }
 
         System.out.println("Processing platform bindings...");
 
         final String sdkJar = args[0];
         sMaxSdkVersion = Integer.parseInt(args[1]);
         final String outdir = args[2];
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -406,17 +406,17 @@ android.applicationVariants.all { varian
         reportLevel = "high"   // For now we only care about high priority bugs. After we have fixed
                                // the issues with medium/low priority we can lower the report level here.
 
         classes = files("$project.buildDir/intermediates/classes")
         source = variant.javaCompile.source
         classpath = variant.javaCompile.classpath
 
         excludeFilter = file("findbugs-exclude.xml")
-        dependsOn "bundleAppClasses${variant.name.capitalize()}"
+        dependsOn "assemble${variant.name.capitalize()}"
 
         reports {
             html.enabled = true // HTML reports for humans.
             html.destination = file("$project.buildDir/reports/findbugs/findbugs-${variant.name}-output.html")
             xml.enabled = false
         }
     }
 
@@ -430,17 +430,17 @@ android.applicationVariants.all { varian
         reportLevel = "high"   // For now we only care about high priority bugs. After we have fixed
                                // the issues with medium/low priority we can lower the report level here.
         
         classes = files("$project.buildDir/intermediates/classes")
         source = variant.javaCompile.source
         classpath = variant.javaCompile.classpath
 
         excludeFilter = file("findbugs-exclude.xml")
-        dependsOn "bundleAppClasses${variant.name.capitalize()}"
+        dependsOn "assemble${variant.name.capitalize()}"
 
         reports {
             xml.enabled = true // XML reports for machines.
             xml.destination = file("$project.buildDir/reports/findbugs/findbugs-${variant.name}-output.xml")
             html.enabled = false
         }
     }
 }
@@ -492,16 +492,40 @@ android.applicationVariants.all { varian
 
                     manifestOutFile.write(XmlUtil.serialize(xml), 'UTF-8')
                 }
             })
         }
     }
 }
 
+android.applicationVariants.all { variant ->
+    def processResourcesTask = tasks["process${variant.name.capitalize()}Resources"]
+    def assembleTask = tasks["assemble${variant.name.capitalize()}"]
+
+    def dumpTask = task("dump${variant.name.capitalize()}RTxt", type: Copy) {
+        from "${project.buildDir}/intermediates/symbols"
+        into "${project.buildDir}/R/symbols-${System.env.AB_CD}"
+        include "**/R.txt"
+
+        includeEmptyDirs = false
+
+        // Force task to run.
+        outputs.upToDateWhen { false }
+
+        rename { filename ->
+            filename.replace 'R.txt', "R-${new Date().format('yyyyMMddHHmmssSSS')}.txt"
+        }
+
+        dependsOn processResourcesTask
+    }
+
+    assembleTask.dependsOn dumpTask
+}
+
 // Bug 1415298: make Robolectric find assets.  Fix adapted from
 // https://github.com/robolectric/robolectric/issues/2647.
 android.applicationVariants.all { variant ->
     def productFlavor = ""
     variant.productFlavors.each {
         productFlavor += "${it.name.capitalize()}"
     }
     def buildType = "${variant.buildType.name.capitalize()}"
--- a/mobile/android/geckoview/build.gradle
+++ b/mobile/android/geckoview/build.gradle
@@ -375,21 +375,18 @@ task("generateSDKBindings", type: JavaEx
 
     main = 'org.mozilla.gecko.annotationProcessors.SDKProcessor'
     args android.bootClasspath
     args 16
     args "${topobjdir}/widget/android/bindings"
 
     // Configure the arguments at evaluation-time, not at configuration-time.
     doFirst {
-        // From -Pgenerate_sdk_bindings_args=... on command line; missing in
-        // `android-gradle-dependencies` toolchain task.
-        if (project.hasProperty('generate_sdk_bindings_args')) {
-            args project.generate_sdk_bindings_args.split(':')
-        }
+        // From -Pgenerate_sdk_bindings_args=... on command line.
+        args project.generate_sdk_bindings_args.split(':')
     }
 
     workingDir "${topsrcdir}/widget/android/bindings"
 
     dependsOn project(':annotations').jar
 }
 
 apply from: "${topsrcdir}/mobile/android/gradle/jacoco_dependencies.gradle"
--- a/mobile/android/gradle/with_gecko_binaries.gradle
+++ b/mobile/android/gradle/with_gecko_binaries.gradle
@@ -110,17 +110,17 @@ ext.configureLibraryVariantWithJNIWrappe
     //
     // It's not really possible to insert something immediately _after_
     // ...WithPrepareIntermediateJars..., so we make the consuming moz.build
     // system invoke this target directly, and force the
     // ...WithPrepareIntermediateJars... dependency.  The real consumer of the
     // JNI wrappers is the moz.build system, which always builds geckoview to
     // consume from Fennec, so that dependency likely adds less to the build time.
     def jarTask = tasks["transformClassesAndResourcesWithPrepareIntermediateJarsFor${variant.name.capitalize()}"]
-    def bundleJar = jarTask.outputs.files.find({ it.absolutePath.contains('/classes.jar') })
+    def output = jarTask.outputs.files.find({ it.absolutePath.contains('/classes.jar') })
 
     def annotationProcessorsJarTask = project(':annotations').jar
 
     def wrapperTask
     if (System.env.IS_LANGUAGE_REPACK == '1') {
         // Single-locale l10n repacks set `IS_LANGUAGE_REPACK=1` and don't
         // really have a build environment.
         wrapperTask = task("generateJNIWrappersFor${module}${variant.name.capitalize()}")
@@ -133,43 +133,35 @@ ext.configureLibraryVariantWithJNIWrappe
             doFirst {
                 classpath variant.javaCompile.classpath
                 // Include android.jar.
                 classpath variant.javaCompile.options.bootClasspath
             }
     
             main = 'org.mozilla.gecko.annotationProcessors.AnnotationProcessor'
             args module
-            args bundleJar
+            args output
             
             workingDir "${topobjdir}/widget/android"
-
-            inputs.file(bundleJar)
-            inputs.file(annotationProcessorsJarTask.archivePath)
-            inputs.property("module", module)
-
-            outputs.file("${topobjdir}/widget/android/GeneratedJNINatives.h")
-            outputs.file("${topobjdir}/widget/android/GeneratedJNIWrappers.cpp")
-            outputs.file("${topobjdir}/widget/android/GeneratedJNIWrappers.h")
-
+            
             dependsOn jarTask
             dependsOn annotationProcessorsJarTask
         }
     }
 
     if (module == 'Generated') {
         tasks["bundle${variant.name.capitalize()}"].dependsOn wrapperTask
     } else {
         tasks["assemble${variant.name.capitalize()}"].dependsOn wrapperTask
     }
 }
 
 ext.configureApplicationVariantWithJNIWrappers = { variant, module ->
     def jarTask = tasks["bundleAppClasses${variant.name.capitalize()}"]
-    def bundleJar = jarTask.outputs.files.find({ it.absolutePath.contains('/classes.jar') })
+    def output = jarTask.outputs.files.find({ it.absolutePath.contains('/classes.jar') })
 
     def annotationProcessorsJarTask = project(':annotations').jar
 
     def wrapperTask
     if (System.env.IS_LANGUAGE_REPACK == '1') {
         // Single-locale l10n repacks set `IS_LANGUAGE_REPACK=1` and don't
         // really have a build environment.
         wrapperTask = task("generateJNIWrappersFor${module}${variant.name.capitalize()}")
@@ -182,27 +174,19 @@ ext.configureApplicationVariantWithJNIWr
             doFirst {
                 classpath variant.javaCompile.classpath
                 // Include android.jar.
                 classpath variant.javaCompile.options.bootClasspath
             }
         
             main = 'org.mozilla.gecko.annotationProcessors.AnnotationProcessor'
             args module
-            args bundleJar
+            args output
         
             workingDir "${topobjdir}/widget/android/fennec"
-
-            inputs.file(bundleJar)
-            inputs.file(annotationProcessorsJarTask.archivePath)
-            inputs.property("module", module)
-
-            outputs.file("${topobjdir}/widget/android/fennec/FennecJNINatives.h")
-            outputs.file("${topobjdir}/widget/android/fennec/FennecJNIWrappers.cpp")
-            outputs.file("${topobjdir}/widget/android/fennec/FennecJNIWrappers.h")
-
+    
             // This forces bundling, which isn't usually part of the assemble* process.
             dependsOn jarTask
 
             dependsOn annotationProcessorsJarTask
         }
     }
 }
--- a/mobile/android/mach_commands.py
+++ b/mobile/android/mach_commands.py
@@ -63,17 +63,17 @@ class MachCommands(MachCommandBase):
         pass
 
     @SubCommand('android', 'assemble-app',
                 """Assemble Firefox for Android.
         See http://firefox-source-docs.mozilla.org/build/buildsystem/toolchains.html#firefox-for-android-with-gradle""")  # NOQA: E501
     @CommandArgument('args', nargs=argparse.REMAINDER)
     def android_assemble_app(self, args):
         ret = self.gradle(self.substs['GRADLE_ANDROID_APP_TASKS'] +
-                          ['-x', 'lint'] + args, verbose=True)
+                          ['-x', 'lint', '--continue'] + args, verbose=True)
 
         return ret
 
     @SubCommand('android', 'generate-sdk-bindings',
                 """Generate SDK bindings used when building GeckoView.""")
     @CommandArgument('inputs', nargs='+', help='config files, '
                      'like [/path/to/ClassName-classes.txt]+')
     @CommandArgument('args', nargs=argparse.REMAINDER)
@@ -135,17 +135,17 @@ class MachCommands(MachCommandBase):
         return ret
 
     @SubCommand('android', 'test',
                 """Run Android local unit tests.
                 See https://developer.mozilla.org/en-US/docs/Mozilla/Android-specific_test_suites#android-test""")  # NOQA: E501
     @CommandArgument('args', nargs=argparse.REMAINDER)
     def android_test(self, args):
         ret = self.gradle(self.substs['GRADLE_ANDROID_TEST_TASKS'] +
-                          args, verbose=True)
+                          ["--continue"] + args, verbose=True)
 
         ret |= self._parse_android_test_results('public/app/unittest',
                                                 'gradle/build/mobile/android/app',
                                                 (self.substs['GRADLE_ANDROID_APP_VARIANT_NAME'],))
 
         ret |= self._parse_android_test_results('public/geckoview/unittest',
                                                 'gradle/build/mobile/android/geckoview',
                                                 (self.substs['GRADLE_ANDROID_GECKOVIEW_VARIANT_NAME'],))  # NOQA: E501
@@ -235,17 +235,17 @@ class MachCommands(MachCommandBase):
     @CommandArgument('args', nargs=argparse.REMAINDER)
     def android_test_ccov(self, args):
         enable_ccov = '-Penable_code_coverage'
 
         # Don't care if the tests are failing, we only want the coverage information.
         self.android_test([enable_ccov])
 
         self.gradle(self.substs['GRADLE_ANDROID_TEST_CCOV_REPORT_TASKS'] +
-                    [enable_ccov] + args, verbose=True)
+                    ['--continue', enable_ccov] + args, verbose=True)
         self._process_jacoco_reports()
         return 0
 
     def _process_jacoco_reports(self):
         def run_grcov(grcov_path, input_path):
             args = [grcov_path, input_path, '-t', 'lcov']
             return subprocess.check_output(args)
 
@@ -263,17 +263,17 @@ class MachCommands(MachCommandBase):
                 z.writestr('grcov_lcov_output.info', grcov_output)
 
     @SubCommand('android', 'lint',
                 """Run Android lint.
                 See https://developer.mozilla.org/en-US/docs/Mozilla/Android-specific_test_suites#android-lint""")  # NOQA: E501
     @CommandArgument('args', nargs=argparse.REMAINDER)
     def android_lint(self, args):
         ret = self.gradle(self.substs['GRADLE_ANDROID_LINT_TASKS'] +
-                          args, verbose=True)
+                          ["--continue"] + args, verbose=True)
 
         # Android Lint produces both HTML and XML reports.  Visit the
         # XML report(s) to report errors and link to the HTML
         # report(s) for human consumption.
         import xml.etree.ElementTree as ET
 
         root_url = self._root_url(
             artifactdir='public/android/lint',
@@ -311,17 +311,17 @@ class MachCommands(MachCommandBase):
         return ret
 
     @SubCommand('android', 'checkstyle',
                 """Run Android checkstyle.
                 See https://developer.mozilla.org/en-US/docs/Mozilla/Android-specific_test_suites#android-checkstyle""")  # NOQA: E501
     @CommandArgument('args', nargs=argparse.REMAINDER)
     def android_checkstyle(self, args):
         ret = self.gradle(self.substs['GRADLE_ANDROID_CHECKSTYLE_TASKS'] +
-                          args, verbose=True)
+                          ["--continue"] + args, verbose=True)
 
         # Checkstyle produces both HTML and XML reports.  Visit the
         # XML report(s) to report errors and link to the HTML
         # report(s) for human consumption.
         import xml.etree.ElementTree as ET
 
         f = open(os.path.join(self.topobjdir,
                               'gradle/build/mobile/android/app/reports/checkstyle/checkstyle.xml'),
@@ -367,17 +367,17 @@ class MachCommands(MachCommandBase):
         return ret
 
     @SubCommand('android', 'findbugs',
                 """Run Android findbugs.
                 See https://developer.mozilla.org/en-US/docs/Mozilla/Android-specific_test_suites#android-findbugs""")  # NOQA: E501
     @CommandArgument('args', nargs=argparse.REMAINDER)
     def android_findbugs(self, dryrun=False, args=[]):
         ret = self.gradle(self.substs['GRADLE_ANDROID_FINDBUGS_TASKS'] +
-                          args, verbose=True)
+                          ["--continue"] + args, verbose=True)
 
         # Findbug produces both HTML and XML reports.  Visit the
         # XML report(s) to report errors and link to the HTML
         # report(s) for human consumption.
         import xml.etree.ElementTree as ET
 
         root_url = self._root_url(
             artifactdir='public/android/findbugs',
@@ -438,27 +438,27 @@ class MachCommands(MachCommandBase):
         return 0
 
     @SubCommand('android', 'archive-coverage-artifacts',
                 """Archive compiled classfiles to be used later in generating code
         coverage reports. See https://firefox-source-docs.mozilla.org/mobile/android/fennec/testcoverage.html""")  # NOQA: E501
     @CommandArgument('args', nargs=argparse.REMAINDER)
     def android_archive_classfiles(self, args):
         self.gradle(self.substs['GRADLE_ANDROID_ARCHIVE_COVERAGE_ARTIFACTS_TASKS'] +
-                    args, verbose=True)
+                    ["--continue"] + args, verbose=True)
 
         return 0
 
     @SubCommand('android', 'archive-geckoview',
                 """Create GeckoView archives.
         See http://firefox-source-docs.mozilla.org/build/buildsystem/toolchains.html#firefox-for-android-with-gradle""")  # NOQA: E501
     @CommandArgument('args', nargs=argparse.REMAINDER)
     def android_archive_geckoview(self, args):
         ret = self.gradle(
-            self.substs['GRADLE_ANDROID_ARCHIVE_GECKOVIEW_TASKS'] + args,
+            self.substs['GRADLE_ANDROID_ARCHIVE_GECKOVIEW_TASKS'] + ["--continue"] + args,
             verbose=True)
 
         if ret != 0:
             return ret
 
         # The zip archive is passed along in CI to ship geckoview onto a maven repo
         _craft_maven_zip_archive(self.topobjdir)
 
@@ -612,21 +612,18 @@ class MachCommands(MachCommandBase):
         # It's not even enough to set the encoding just for Gradle; it
         # needs to be for JVMs spawned by Gradle as well.  This
         # happens during the maven deployment generating the GeckoView
         # documents; this works around "error: unmappable character
         # for encoding ASCII" in exoplayer2.  See
         # https://discuss.gradle.org/t/unmappable-character-for-encoding-ascii-when-building-a-utf-8-project/10692/11  # NOQA: E501
         # and especially https://stackoverflow.com/a/21755671.
 
-        if self.substs.get('MOZ_AUTOMATION'):
-            gradle_flags += ['--console=plain']
-
         return self.run_process(
-            [self.substs['GRADLE']] + gradle_flags + args,
+            [self.substs['GRADLE']] + gradle_flags + ['--console=plain'] + args,
             append_env={
                 'GRADLE_OPTS': '-Dfile.encoding=utf-8',
                 'JAVA_HOME': java_home,
                 'JAVA_TOOL_OPTIONS': '-Dfile.encoding=utf-8',
             },
             pass_thru=True,  # Allow user to run gradle interactively.
             ensure_exit_code=False,  # Don't throw on non-zero exit code.
             cwd=mozpath.join(self.topsrcdir))
--- a/taskcluster/ci/build/android.yml
+++ b/taskcluster/ci/build/android.yml
@@ -15,16 +15,19 @@ android-api-16/debug:
     worker-type: aws-provisioner-v1/gecko-{level}-b-android
     worker:
         docker-image: {in-tree: android-build}
         max-run-time: 7200
         env:
             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/R
+              path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/R
+              type: directory
               # TODO Bug 1433198. Remove the following entry once target.maven.zip is uploaded to a maven repository
             - name: public/android/maven
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/maven/
               type: directory
             - name: public/build/target.maven.zip
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/target.maven.zip
               type: file
             - name: public/build/geckoview-androidTest.apk
@@ -67,16 +70,19 @@ android-api-16-ccov/debug:
     worker-type: aws-provisioner-v1/gecko-{level}-b-android
     worker:
         docker-image: {in-tree: android-build}
         max-run-time: 7200
         env:
             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/R
+              path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/R
+              type: directory
             - name: public/android/maven
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/maven/
               type: directory
             - name: public/build/geckoview-androidTest.apk
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/outputs/apk/androidTest/withGeckoBinaries/debug/geckoview-withGeckoBinaries-debug-androidTest.apk
               type: file
             - name: public/build/geckoview_example.apk
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview_example/outputs/apk/withGeckoBinaries/debug/geckoview_example-withGeckoBinaries-debug.apk
@@ -127,16 +133,19 @@ android-x86/opt:
     worker-type: aws-provisioner-v1/gecko-{level}-b-android
     worker:
         docker-image: {in-tree: android-build}
         max-run-time: 7200
         env:
             GRADLE_USER_HOME: "/builds/worker/workspace/build/src/mobile/android/gradle/dotgradle-offline"
             TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android-x86/releng.manifest"
         artifacts:
+            - name: public/android/R
+              path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/R
+              type: directory
               # TODO Bug 1433198. Remove the following entry once target.maven.zip is uploaded to a maven repository
             - name: public/android/maven
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/maven/
               type: directory
             - name: public/build/target.maven.zip
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/target.maven.zip
               type: file
             - name: public/build/geckoview-androidTest.apk
@@ -179,16 +188,19 @@ android-x86-fuzzing/debug:
     worker-type: aws-provisioner-v1/gecko-{level}-b-android
     worker:
         docker-image: {in-tree: android-build}
         max-run-time: 7200
         env:
             GRADLE_USER_HOME: "/builds/worker/workspace/build/src/mobile/android/gradle/dotgradle-offline"
             TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android-x86/releng.manifest"
         artifacts:
+            - name: public/android/R
+              path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/R
+              type: directory
             - name: public/android/maven
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/maven/
               type: directory
             - name: public/build/geckoview-androidTest.apk
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/outputs/apk/androidTest/withGeckoBinaries/debug/geckoview-withGeckoBinaries-debug-androidTest.apk
               type: file
             - name: public/build/geckoview_example.apk
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview_example/outputs/apk/withGeckoBinaries/debug/geckoview_example-withGeckoBinaries-debug.apk
@@ -233,16 +245,19 @@ android-x86-nightly/opt:
     worker-type: aws-provisioner-v1/gecko-{level}-b-android
     worker:
         docker-image: {in-tree: android-build}
         max-run-time: 7200
         env:
             GRADLE_USER_HOME: "/builds/worker/workspace/build/src/mobile/android/gradle/dotgradle-offline"
             TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android-x86/releng.manifest"
         artifacts:
+            - name: public/android/R
+              path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/R
+              type: directory
               # TODO Bug 1433198. Remove the following entry once target.maven.zip is uploaded to a maven repository
             - name: public/android/maven
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/maven/
               type: directory
             - name: public/build/target.maven.zip
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/target.maven.zip
               type: file
             - name: public/build/geckoview-androidTest.apk
@@ -288,16 +303,19 @@ android-api-16/opt:
     worker-type: aws-provisioner-v1/gecko-{level}-b-android
     worker:
         docker-image: {in-tree: android-build}
         max-run-time: 7200
         env:
             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/R
+              path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/R
+              type: directory
               # TODO Bug 1433198. Remove the following entry once target.maven.zip is uploaded to a maven repository
             - name: public/android/maven
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/maven/
               type: directory
             - name: public/build/target.maven.zip
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/target.maven.zip
               type: file
             - name: public/build/geckoview-androidTest.apk
@@ -341,16 +359,19 @@ android-api-16-without-google-play-servi
     worker:
         docker-image: {in-tree: android-build}
         max-run-time: 7200
         env:
             GRADLE_USER_HOME: "/builds/worker/workspace/build/src/mobile/android/gradle/dotgradle-offline"
             PERFHERDER_EXTRA_OPTIONS: android-api-16-without-google-play-services
             TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android/releng.manifest"
         artifacts:
+            - name: public/android/R
+              path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/R
+              type: directory
               # TODO Bug 1433198. Remove the following entry once target.maven.zip is uploaded to a maven repository
             - name: public/android/maven
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/maven/
               type: directory
             - name: public/build/target.maven.zip
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/target.maven.zip
               type: file
             - name: public/build/geckoview_example.apk
@@ -397,16 +418,19 @@ android-api-16-nightly/opt:
     worker-type: aws-provisioner-v1/gecko-{level}-b-android
     worker:
         docker-image: {in-tree: android-build}
         max-run-time: 7200
         env:
             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/R
+              path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/R
+              type: directory
               # TODO Bug 1433198. Remove the following entry once target.maven.zip is uploaded to a maven repository
             - name: public/android/maven
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/maven/
               type: directory
             - name: public/build/target.maven.zip
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/target.maven.zip
               type: file
             - name: public/build/geckoview-androidTest.apk
@@ -452,16 +476,19 @@ android-aarch64/opt:
     worker-type: aws-provisioner-v1/gecko-{level}-b-android
     worker:
         docker-image: {in-tree: android-build}
         max-run-time: 7200
         env:
             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/R
+              path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/R
+              type: directory
               # TODO Bug 1433198. Remove the following entry once target.maven.zip is uploaded to a maven repository
             - name: public/android/maven
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/maven/
               type: directory
             - name: public/build/target.maven.zip
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/target.maven.zip
               type: file
             - name: public/build/geckoview-androidTest.apk
@@ -510,16 +537,19 @@ android-aarch64-nightly/opt:
     worker-type: aws-provisioner-v1/gecko-{level}-b-android
     worker:
         docker-image: {in-tree: android-build}
         max-run-time: 7200
         env:
             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/R
+              path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/R
+              type: directory
               # TODO Bug 1433198. Remove the following entry once target.maven.zip is uploaded to a maven repository
             - name: public/android/maven
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/maven/
               type: directory
             - name: public/build/target.maven.zip
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/target.maven.zip
               type: file
             - name: public/build/geckoview-androidTest.apk
@@ -565,16 +595,19 @@ android-x86_64/opt:
     worker-type: aws-provisioner-v1/gecko-{level}-b-android
     worker:
         docker-image: {in-tree: android-build}
         max-run-time: 7200
         env:
             GRADLE_USER_HOME: "/builds/worker/workspace/build/src/mobile/android/gradle/dotgradle-offline"
             TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android-x86/releng.manifest"
         artifacts:
+            - name: public/android/R
+              path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/R
+              type: directory
               # TODO Bug 1433198. Remove the following entry once target.maven.zip is uploaded to a maven repository
             - name: public/android/maven
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/maven/
               type: directory
             - name: public/build/target.maven.zip
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/target.maven.zip
               type: file
             - name: public/build/geckoview-androidTest.apk
@@ -623,16 +656,19 @@ android-x86_64-nightly/opt:
     worker-type: aws-provisioner-v1/gecko-{level}-b-android
     worker:
         docker-image: {in-tree: android-build}
         max-run-time: 7200
         env:
             GRADLE_USER_HOME: "/builds/worker/workspace/build/src/mobile/android/gradle/dotgradle-offline"
             TOOLTOOL_MANIFEST: "mobile/android/config/tooltool-manifests/android-x86/releng.manifest"
         artifacts:
+            - name: public/android/R
+              path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/R
+              type: directory
               # TODO Bug 1433198. Remove the following entry once target.maven.zip is uploaded to a maven repository
             - name: public/android/maven
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/maven/
               type: directory
             - name: public/build/target.maven.zip
               path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/geckoview/target.maven.zip
               type: file
             - name: public/build/geckoview-androidTest.apk
--- a/taskcluster/scripts/misc/android-gradle-dependencies/after.sh
+++ b/taskcluster/scripts/misc/android-gradle-dependencies/after.sh
@@ -1,30 +1,31 @@
 #!/bin/bash -vex
 
 set -x -e
 
 echo "running as" $(id)
 
 : WORKSPACE ${WORKSPACE:=/builds/worker/workspace}
+: GRADLE_VERSION ${GRADLE_VERSION:=4.4}
 
 set -v
 
 # Package everything up.
 pushd $WORKSPACE
 mkdir -p android-gradle-dependencies /builds/worker/artifacts
 
 cp -R ${NEXUS_WORK}/storage/jcenter android-gradle-dependencies
 cp -R ${NEXUS_WORK}/storage/google android-gradle-dependencies
 cp -R ${NEXUS_WORK}/storage/gradle-plugins android-gradle-dependencies
 
 # The Gradle wrapper will have downloaded and verified the hash of exactly one
 # Gradle distribution.  It will be located in $GRADLE_USER_HOME, like
 # ~/.gradle/wrapper/dists/gradle-2.7-all/$PROJECT_HASH/gradle-2.7-all.zip.  We
 # want to remove the version from the internal directory for use via tooltool in
 # a mozconfig.
-cp ${GRADLE_USER_HOME}/wrapper/dists/gradle-*-*/*/gradle-*-*.zip gradle.zip
-unzip -q gradle.zip
-mv gradle-* android-gradle-dependencies/gradle-dist
+cp ${GRADLE_USER_HOME}/wrapper/dists/gradle-${GRADLE_VERSION}-all/*/gradle-${GRADLE_VERSION}-all.zip gradle-${GRADLE_VERSION}-all.zip
+unzip -q gradle-${GRADLE_VERSION}-all.zip
+mv gradle-${GRADLE_VERSION} android-gradle-dependencies/gradle-dist
 
 tar cf - android-gradle-dependencies | xz > /builds/worker/artifacts/android-gradle-dependencies.tar.xz
 
 popd