Bug 1366644 - Part 3a: Update Android build-tools (25.0.3), Gradle (3.4.1), Android-Gradle (2.3.3). r=maliu draft
authorNick Alexander <nalexander@mozilla.com>
Mon, 16 Oct 2017 15:09:15 -0700
changeset 681832 12d132c0c3e0dbe2b8873b31360ea96d612de44c
parent 681831 f0d9d7eb2b6f701f19cae69bf9428020e3f823d4
child 681833 a0ec7eac5d1a0801d7620b65d7e708a8001d208d
push id84947
push usernalexander@mozilla.com
push dateTue, 17 Oct 2017 21:26:05 +0000
reviewersmaliu
bugs1366644
milestone58.0a1
Bug 1366644 - Part 3a: Update Android build-tools (25.0.3), Gradle (3.4.1), Android-Gradle (2.3.3). r=maliu The goal is to use a newer Android-Gradle build plugin version (2.3.3 is latest stable). That requires a modern Gradle (anything 3.3+, but 3.4.1 is the default from my Android Studio), and also a newer build-tools (25.0.3 is latest stable). The locations of lint output changed, and we want to use the standard output location because it's difficult to accommodate variant details in custom names. We change the location of findbugs output to follow suit. This requires either: - fixing lint errors - adding to the lint whitelist - using the new lint baseline It's best to use the new lint baseline, which will happen in the next commit. MozReview-Commit-ID: D19FzIDCJrE
build.gradle
gradle/wrapper/gradle-wrapper.properties
mobile/android/app/build.gradle
mobile/android/mach_commands.py
old-configure.in
python/mozboot/mozboot/android-packages.txt
taskcluster/ci/build/android-stuff.yml
taskcluster/scripts/misc/android-gradle-dependencies/after.sh
testing/mochitest/Makefile.in
testing/mochitest/mochitest_options.py
toolkit/mozapps/installer/upload-files-APK.mk
--- a/build.gradle
+++ b/build.gradle
@@ -49,17 +49,17 @@ buildscript {
         }
         // For in tree plugins.
         maven {
             url "file://${gradle.mozconfig.topsrcdir}/mobile/android/gradle/m2repo"
         }
     }
 
     dependencies {
-        classpath 'com.android.tools.build:gradle:2.1.3'
+        classpath 'com.android.tools.build:gradle:2.3.3'
         classpath('com.stanfy.spoon:spoon-gradle-plugin:1.0.4') {
             // Without these, we get errors linting.
             exclude module: 'guava'
         }
         // Provided in tree.
         classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.7.3'
     }
 }
--- 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-2.14.1-all.zip
-distributionSha256Sum=88a910cdf2e03ebbb5fe90f7ecf534fc9ac22e12112dc9a2fee810c598a76091
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip
+distributionSha256Sum=ed7e9c8bb41bd10d4c9339c95b2f8b122f5bf13188bd90504a26e0f00b123b0d
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -481,17 +481,17 @@ android.applicationVariants.all { varian
         source = variant.javaCompile.source
         classpath = variant.javaCompile.classpath
 
         excludeFilter = file("findbugs-exclude.xml")
         dependsOn "assemble${variant.name.capitalize()}"
 
         reports {
             html.enabled = true // HTML reports for humans.
-            html.destination = "$project.buildDir/outputs/findbugs/findbugs-${variant.name}-output.html"
+            html.destination = "$project.buildDir/reports/findbugs/findbugs-${variant.name}-output.html"
             xml.enabled = false
         }
     }
 
     task("findbugsXml${variant.name.capitalize()}", type: FindBugs) {
         // TODO: figure out how to share the shared configuration.
         description "Analyze ${variant.name} code with findbugs (XML report)"
         group "Verification"
@@ -505,17 +505,17 @@ android.applicationVariants.all { varian
         source = variant.javaCompile.source
         classpath = variant.javaCompile.classpath
 
         excludeFilter = file("findbugs-exclude.xml")
         dependsOn "assemble${variant.name.capitalize()}"
 
         reports {
             xml.enabled = true // XML reports for machines.
-            xml.destination = "$project.buildDir/outputs/findbugs/findbugs-${variant.name}-output.xml"
+            xml.destination = "$project.buildDir/reports/findbugs/findbugs-${variant.name}-output.xml"
             html.enabled = false
         }
     }
 }
 
 // Bug 1353055 - Strip 'vars' debugging information to agree with moz.build.
 apply from: "${topsrcdir}/mobile/android/gradle/debug_level.gradle"
 android.applicationVariants.all configureVariantDebugLevel
--- a/mobile/android/mach_commands.py
+++ b/mobile/android/mach_commands.py
@@ -130,21 +130,21 @@ class MachCommands(MachCommandBase):
         # 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
 
         if 'TASK_ID' in os.environ and 'RUN_ID' in os.environ:
             root_url = "https://queue.taskcluster.net/v1/task/{}/runs/{}/artifacts/public/android/lint".format(os.environ['TASK_ID'], os.environ['RUN_ID'])
         else:
-            root_url = os.path.join(self.topobjdir, 'gradle/build/mobile/android/app/outputs')
+            root_url = os.path.join(self.topobjdir, 'gradle/build/mobile/android/app/reports')
 
         reports = ('officialPhotonDebug',)
         for report in reports:
-            f = open(os.path.join(self.topobjdir, 'gradle/build/mobile/android/app/outputs/lint-results-{}.xml'.format(report)), 'rt')
+            f = open(os.path.join(self.topobjdir, 'gradle/build/mobile/android/app/reports/lint-results-{}.xml'.format(report)), 'rt')
             tree = ET.parse(f)
             root = tree.getroot()
 
             print('SUITE-START | android-lint | {}'.format(report))
             for issue in root.findall("issue[@severity='Error']"):
                 # There's no particular advantage to formatting the
                 # error, so for now let's just output the <issue> XML
                 # tag.
@@ -225,22 +225,22 @@ class MachCommands(MachCommandBase):
         # 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
 
         if 'TASK_ID' in os.environ and 'RUN_ID' in os.environ:
             root_url = "https://queue.taskcluster.net/v1/task/{}/runs/{}/artifacts/public/artifacts/findbugs".format(os.environ['TASK_ID'], os.environ['RUN_ID'])
         else:
-            root_url = os.path.join(self.topobjdir, 'gradle/build/mobile/android/app/outputs/findbugs')
+            root_url = os.path.join(self.topobjdir, 'gradle/build/mobile/android/app/reports/findbugs')
 
         reports = ('findbugs-officialPhotonDebug-output.xml',)
         for report in reports:
             try:
-                f = open(os.path.join(self.topobjdir, 'gradle/build/mobile/android/app/outputs/findbugs', report), 'rt')
+                f = open(os.path.join(self.topobjdir, 'gradle/build/mobile/android/app/reports/findbugs', report), 'rt')
             except IOError:
                 continue
 
             tree = ET.parse(f)
             root = tree.getroot()
 
             print('SUITE-START | android-findbugs | {}'.format(report))
             for error in root.findall('./BugInstance'):
@@ -311,17 +311,17 @@ class MachCommands(MachCommandBase):
         # filter strings.xml, which is really UTF-8; the ellipsis character is
         # replaced with ??? in some encodings (including ASCII).  It's not yet
         # possible to filter with encodings in Gradle
         # (https://github.com/gradle/gradle/pull/520) and it's challenging to
         # do our filtering with Gradle's Ant support.  Moreover, all of the
         # Android tools expect UTF-8: see
         # http://tools.android.com/knownissues/encoding.  See
         # http://stackoverflow.com/a/21267635 for discussion of this approach.
-        return self.run_process([self.substs['GRADLE']] + gradle_flags + args,
+        return self.run_process([self.substs['GRADLE']] + gradle_flags + ['--console=plain'] + args,
             append_env={
                 'GRADLE_OPTS': '-Dfile.encoding=utf-8',
                 'JAVA_HOME': java_home,
             },
             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/old-configure.in
+++ b/old-configure.in
@@ -2215,17 +2215,17 @@ AC_SUBST(MOZ_MULET)
 
 dnl ========================================================
 dnl Ensure Android SDK and build-tools versions depending on
 dnl mobile target.
 dnl ========================================================
 
 case "$MOZ_BUILD_APP" in
 mobile/android)
-    MOZ_ANDROID_SDK(23, 23, 23.0.3 23.0.1, 26.0.0 26.0.0-dev 25.3.2 25.3.1)
+    MOZ_ANDROID_SDK(23, 23, 25.0.3, 26.0.0 26.0.0-dev 25.3.2 25.3.1)
     ;;
 esac
 
 dnl ========================================================
 dnl =
 dnl = Toolkit Options
 dnl =
 dnl ========================================================
--- a/python/mozboot/mozboot/android-packages.txt
+++ b/python/mozboot/mozboot/android-packages.txt
@@ -1,5 +1,5 @@
 platform-tools
-build-tools;23.0.3
+build-tools;25.0.3
 platforms;android-23
 extras;android;m2repository
 extras;google;m2repository
--- a/taskcluster/ci/build/android-stuff.yml
+++ b/taskcluster/ci/build/android-stuff.yml
@@ -58,33 +58,24 @@ android-lint/opt:
     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/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
-            type: file
-          - name: public/android/lint/lint-results-officialAustralisDebug_files
-            path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/outputs/lint-results-officialAustralisDebug_files
-            type: directory
           - name: public/android/lint/lint-results-officialPhotonDebug.html
-            path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/outputs/lint-results-officialPhotonDebug.html
+            path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/reports/lint-results-officialPhotonDebug.html
             type: file
           - name: public/android/lint/lint-results-officialPhotonDebug.xml
-            path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/outputs/lint-results-officialPhotonDebug.xml
+            path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/reports/lint-results-officialPhotonDebug.xml
             type: file
           - name: public/android/lint/lint-results-officialPhotonDebug_files
-            path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/outputs/lint-results-officialPhotonDebug_files
+            path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/reports/lint-results-officialPhotonDebug_files
             type: directory
           - name: public/build
             path: /builds/worker/artifacts/
             type: directory
         max-run-time: 36000
     run:
         using: mozharness
         actions: [get-secrets build multi-l10n update]
@@ -178,27 +169,21 @@ android-findbugs/opt:
     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/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
-            type: file
           - name: public/android/findbugs/findbugs-officialPhotonDebug-output.html
-            path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/outputs/findbugs/findbugs-officialPhotonDebug-output.html
+            path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/reports/findbugs/findbugs-officialPhotonDebug-output.html
             type: file
           - name: public/android/findbugs/findbugs-officialPhotonDebug-output.xml
-            path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/outputs/findbugs/findbugs-officialPhotonDebug-output.xml
+            path: /builds/worker/workspace/build/src/obj-firefox/gradle/build/mobile/android/app/reports/findbugs/findbugs-officialPhotonDebug-output.xml
             type: file
           - name: public/build
             path: /builds/worker/artifacts/
             type: directory
         max-run-time: 36000
     run:
         using: mozharness
         actions: [get-secrets build multi-l10n update]
--- a/taskcluster/scripts/misc/android-gradle-dependencies/after.sh
+++ b/taskcluster/scripts/misc/android-gradle-dependencies/after.sh
@@ -1,16 +1,16 @@
 #!/bin/bash -vex
 
 set -x -e
 
 echo "running as" $(id)
 
 : WORKSPACE ${WORKSPACE:=/builds/worker/workspace}
-: GRADLE_VERSION ${GRADLE_VERSION:=2.14.1}
+: GRADLE_VERSION ${GRADLE_VERSION:=3.4.1}
 
 set -v
 
 # Package everything up.
 pushd $WORKSPACE
 mkdir -p android-gradle-dependencies /builds/worker/artifacts
 
 cp -R ${NEXUS_WORK}/storage/jcenter android-gradle-dependencies
--- a/testing/mochitest/Makefile.in
+++ b/testing/mochitest/Makefile.in
@@ -20,17 +20,17 @@ libs::
 
 # On Android only, include a release signed Robocop APK in the test package.
 ifeq ($(MOZ_BUILD_APP),mobile/android)
 include $(topsrcdir)/config/android-common.mk
 
 ifndef MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE
 robocop_apk := $(topobjdir)/mobile/android/tests/browser/robocop/robocop-debug-unsigned-unaligned.apk
 else
-robocop_apk := $(topobjdir)/gradle/build/mobile/android/app/outputs/apk/app-official-photon-debug-androidTest-unaligned.apk
+robocop_apk := $(topobjdir)/gradle/build/mobile/android/app/outputs/apk/app-official-photon-debug-androidTest.apk
 endif
 
 stage-package-android:
 	$(NSINSTALL) -D $(_DEST_DIR)
 	$(call RELEASE_SIGN_ANDROID_APK,$(robocop_apk),$(_DEST_DIR)/robocop.apk)
 
 stage-package: stage-package-android
 endif
--- a/testing/mochitest/mochitest_options.py
+++ b/testing/mochitest/mochitest_options.py
@@ -1012,18 +1012,17 @@ class AndroidArguments(ArgumentContainer
                     "Unable to find specified robocop .ini manifest '%s'" %
                     options.robocopIni)
             options.robocopIni = os.path.abspath(options.robocopIni)
 
             if not options.robocopApk and build_obj:
                 if build_obj.substs.get('MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE'):
                     options.robocopApk = os.path.join(build_obj.topobjdir, 'gradle', 'build',
                                                       'mobile', 'android', 'app', 'outputs', 'apk',
-                                                      'app-official-photon-debug-androidTest-'
-                                                      'unaligned.apk')
+                                                      'app-official-photon-debug-androidTest.apk')
                 else:
                     options.robocopApk = os.path.join(build_obj.topobjdir, 'mobile', 'android',
                                                       'tests', 'browser',
                                                       'robocop', 'robocop-debug.apk')
 
         if options.robocopApk != "":
             if not os.path.exists(options.robocopApk):
                 parser.error(
--- a/toolkit/mozapps/installer/upload-files-APK.mk
+++ b/toolkit/mozapps/installer/upload-files-APK.mk
@@ -27,17 +27,17 @@ ifeq ($(MOZ_BUILD_APP),mobile/android)
 UPLOAD_EXTRA_FILES += robocop.apk
 
 # Robocop/Robotium tests, Android Background tests, and Fennec need to
 # be signed with the same key, which means release signing them all.
 
 ifndef MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE
 robocop_apk := $(topobjdir)/mobile/android/tests/browser/robocop/robocop-debug-unsigned-unaligned.apk
 else
-robocop_apk := $(topobjdir)/gradle/build/mobile/android/app/outputs/apk/app-official-photon-debug-androidTest-unaligned.apk
+robocop_apk := $(topobjdir)/gradle/build/mobile/android/app/outputs/apk/app-official-photon-debug-androidTest.apk
 endif
 
 INNER_ROBOCOP_PACKAGE= \
   $(call RELEASE_SIGN_ANDROID_APK,$(robocop_apk),$(ABS_DIST)/robocop.apk)
 endif
 else
 INNER_ROBOCOP_PACKAGE=echo 'Testing is disabled - No Android Robocop for you'
 endif