Bug 1352599 - Part 1: Add a Proguard toolchain task for Android builds. r=froydnj draft
authorNick Alexander <nalexander@mozilla.com>
Mon, 02 Oct 2017 13:27:51 -0700
changeset 676232 4a55a38f11e66a2c99d820f53d5cc9e729f491b8
parent 674396 9be05b2177667ed8221f9da4fdcc200dbdf3de62
child 676233 34c9834c1c6b02884888d54d3930913a8c71e336
push id83439
push usernalexander@mozilla.com
push dateFri, 06 Oct 2017 21:19:31 +0000
reviewersfroydnj
bugs1352599
milestone58.0a1
Bug 1352599 - Part 1: Add a Proguard toolchain task for Android builds. r=froydnj MozReview-Commit-ID: 5lyHGLkzyg
taskcluster/ci/build/android-stuff.yml
taskcluster/ci/build/android.yml
taskcluster/ci/l10n/kind.yml
taskcluster/ci/toolchain/linux.yml
taskcluster/scripts/misc/repack-proguard-jar.sh
--- a/taskcluster/ci/build/android-stuff.yml
+++ b/taskcluster/ci/build/android-stuff.yml
@@ -34,16 +34,18 @@ android-dependencies/opt:
             - builds/releng_base_android_64_builds.py
             - disable_signing.py
             - platform_supports_post_upload_to_latest.py
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         custom-build-variant-cfg: api-16-gradle-dependencies
         tooltool-downloads: internal
         job-script: taskcluster/scripts/builder/build-android-dependencies.sh
+    toolchains:
+        - proguard-jar
     optimization:
         skip-unless-changed:
           - "mobile/android/config/**"
           - "testing/mozharness/configs/builds/releng_sub_android_configs/*gradle_dependencies.py"
           - "**/*.gradle"
           - "taskcluster/docker/android-build/**"
 
 android-test/opt:
@@ -77,16 +79,18 @@ android-test/opt:
         config:
             - builds/releng_base_android_64_builds.py
             - disable_signing.py
             - platform_supports_post_upload_to_latest.py
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         custom-build-variant-cfg: android-test
         tooltool-downloads: internal
+    toolchains:
+        - proguard-jar
     optimization:
         skip-unless-changed:
           - "mobile/android/base/**"
           - "mobile/android/config/**"
           - "mobile/android/tests/background/junit4/**"
           - "**/*.gradle"
 
 android-lint/opt:
@@ -135,16 +139,18 @@ android-lint/opt:
         config:
             - builds/releng_base_android_64_builds.py
             - disable_signing.py
             - platform_supports_post_upload_to_latest.py
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         custom-build-variant-cfg: android-lint
         tooltool-downloads: internal
+    toolchains:
+        - proguard-jar
     optimization:
         skip-unless-changed:
           - "mobile/android/**/*.java"
           - "mobile/android/**/*.jpeg"
           - "mobile/android/**/*.jpg"
           - "mobile/android/**/*.png"
           - "mobile/android/**/*.svg"
           - "mobile/android/**/*.xml" # Manifest & android resources
@@ -187,16 +193,18 @@ android-checkstyle/opt:
         config:
             - builds/releng_base_android_64_builds.py
             - disable_signing.py
             - platform_supports_post_upload_to_latest.py
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         custom-build-variant-cfg: android-checkstyle
         tooltool-downloads: internal
+    toolchains:
+        - proguard-jar
     optimization:
         skip-unless-changed:
           - "mobile/android/**/checkstyle.xml"
           - "mobile/android/**/*.java"
           - "mobile/android/**/Makefile.in"
           - "mobile/android/config/**"
           - "mobile/android/**/moz.build"
           - "**/*.gradle"
@@ -241,15 +249,17 @@ android-findbugs/opt:
         config:
             - builds/releng_base_android_64_builds.py
             - disable_signing.py
             - platform_supports_post_upload_to_latest.py
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         custom-build-variant-cfg: android-findbugs
         tooltool-downloads: internal
+    toolchains:
+        - proguard-jar
     optimization:
         skip-unless-changed:
           - "mobile/android/**/*.java"
           - "mobile/android/**/Makefile.in"
           - "mobile/android/config/**"
           - "mobile/android/**/moz.build"
           - "**/*.gradle"
--- a/taskcluster/ci/build/android.yml
+++ b/taskcluster/ci/build/android.yml
@@ -21,16 +21,17 @@ android-api-16/debug:
             - platform_supports_post_upload_to_latest.py
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         custom-build-variant-cfg: api-16-debug
         tooltool-downloads: internal
     toolchains:
         - linux64-rust-android
         - linux64-sccache
+        - proguard-jar
 
 android-x86/opt:
     description: "Android 4.2 x86 Opt"
     index:
         product: mobile
         job-name: android-x86-opt
     treeherder:
         platform: android-4-2-x86/opt
@@ -50,16 +51,17 @@ android-x86/opt:
             - platform_supports_post_upload_to_latest.py
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         custom-build-variant-cfg: x86
         tooltool-downloads: internal
     toolchains:
         - linux64-rust-android
         - linux64-sccache
+        - proguard-jar
 
 android-x86-nightly/opt:
     description: "Android 4.2 x86 Nightly"
     attributes:
         nightly: true
     index:
         product: mobile
         job-name: android-x86-opt
@@ -83,16 +85,17 @@ android-x86-nightly/opt:
             - taskcluster_nightly.py
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         custom-build-variant-cfg: x86
         tooltool-downloads: internal
     toolchains:
         - linux64-rust-android
         - linux64-sccache
+        - proguard-jar
 
 android-api-16/opt:
     description: "Android 4.0 api-16+ Opt"
     index:
         product: mobile
         job-name: android-api-16-opt
     treeherder:
         platform: android-4-0-armv7-api16/opt
@@ -112,16 +115,17 @@ android-api-16/opt:
             - platform_supports_post_upload_to_latest.py
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         custom-build-variant-cfg: api-16
         tooltool-downloads: internal
     toolchains:
         - linux64-rust-android
         - linux64-sccache
+        - proguard-jar
 
 android-api-16-nightly/opt:
     description: "Android 4.0 api-16+ Nightly"
     attributes:
         nightly: true
     index:
         product: mobile
         job-name: android-api-16-opt
@@ -145,16 +149,17 @@ android-api-16-nightly/opt:
             - taskcluster_nightly.py
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         custom-build-variant-cfg: api-16
         tooltool-downloads: internal
     toolchains:
         - linux64-rust-android
         - linux64-sccache
+        - proguard-jar
 
 android-x86-old-id/opt:
     description: "Android 4.2 x86 Opt OldId"
     index:
         product: mobile
         job-name: android-x86-old-id-opt
     treeherder:
         platform: android-4-2-x86-old-id/opt
@@ -175,16 +180,17 @@ android-x86-old-id/opt:
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         custom-build-variant-cfg: x86-old-id
         tooltool-downloads: internal
     run-on-projects: [ 'mozilla-central' ]
     toolchains:
         - linux64-rust-android
         - linux64-sccache
+        - proguard-jar
 
 android-x86-old-id-nightly/opt:
     description: "Android 4.2 x86 OldId Nightly"
     attributes:
         nightly: true
     index:
         product: mobile
         job-name: android-x86-old-id-opt
@@ -209,16 +215,17 @@ android-x86-old-id-nightly/opt:
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         custom-build-variant-cfg: x86-old-id
         tooltool-downloads: internal
     run-on-projects: [ 'mozilla-central' ]
     toolchains:
         - linux64-rust-android
         - linux64-sccache
+        - proguard-jar
 
 android-api-16-old-id/opt:
     description: "Android 4.0 api-16+ Opt OldId"
     index:
         product: mobile
         job-name: android-api-16-old-id-opt
     treeherder:
         platform: android-4-0-armv7-api16-old-id/opt
@@ -239,16 +246,17 @@ android-api-16-old-id/opt:
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         custom-build-variant-cfg: api-16-old-id
         tooltool-downloads: internal
     run-on-projects: [ 'mozilla-central' ]
     toolchains:
         - linux64-rust-android
         - linux64-sccache
+        - proguard-jar
 
 android-api-16-old-id-nightly/opt:
     description: "Android 4.0 api-16+ OldId Nightly"
     attributes:
         nightly: true
     index:
         product: mobile
         job-name: android-api-16-old-id-opt
@@ -273,16 +281,17 @@ android-api-16-old-id-nightly/opt:
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         custom-build-variant-cfg: api-16-old-id
         tooltool-downloads: internal
     run-on-projects: [ 'mozilla-central' ]
     toolchains:
         - linux64-rust-android
         - linux64-sccache
+        - proguard-jar
 
 android-api-16-gradle/opt:
     description: "Android 4.0 api-16+ (Gradle) Opt"
     index:
         product: mobile
         job-name: android-api-16-gradle-opt
     treeherder:
         platform: android-api-16-gradle/opt
@@ -315,16 +324,17 @@ android-api-16-gradle/opt:
             - platform_supports_post_upload_to_latest.py
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         custom-build-variant-cfg: api-16-gradle
         tooltool-downloads: internal
     toolchains:
         - linux64-rust-android
         - linux64-sccache
+        - proguard-jar
 
 android-aarch64/opt:
     description: "Android 5.0 AArch64 Opt"
     index:
         product: mobile
         job-name: android-aarch64-opt
     treeherder:
         platform: android-5-0-aarch64/opt
@@ -344,16 +354,17 @@ android-aarch64/opt:
             - platform_supports_post_upload_to_latest.py
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         custom-build-variant-cfg: aarch64
         tooltool-downloads: internal
     toolchains:
         - linux64-rust-android
         - linux64-sccache
+        - proguard-jar
 
 android-aarch64-nightly/opt:
     description: "Android 5.0 AArch64 Nightly"
     attributes:
         nightly: true
     index:
         product: mobile
         job-name: android-aarch64-opt
@@ -377,8 +388,9 @@ android-aarch64-nightly/opt:
             - taskcluster_nightly.py
         script: "mozharness/scripts/fx_desktop_build.py"
         secrets: true
         custom-build-variant-cfg: aarch64
         tooltool-downloads: internal
     toolchains:
         - linux64-rust-android
         - linux64-sccache
+        - proguard-jar
--- a/taskcluster/ci/l10n/kind.yml
+++ b/taskcluster/ci/l10n/kind.yml
@@ -2,16 +2,17 @@
 # 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/.
 
 loader: taskgraph.loader.single_dep:loader
 
 
 transforms:
    - taskgraph.transforms.l10n:transforms
+   - taskgraph.transforms.use_toolchains:transforms
    - taskgraph.transforms.job:transforms
    - taskgraph.transforms.task:transforms
 
 kind-dependencies:
    - build
 
 only-for-build-platforms:
    - linux64/opt
@@ -37,16 +38,18 @@ job-template:
       by-build-platform:
          default: 36000
          android-api-16-l10n: 18000
    tooltool:
       by-build-platform:
          default: public
          android-api-16-l10n: internal
          macosx64-nightly: internal
+  toolchains:
+        - proguard-jar
    worker-type:
       by-build-platform:
          default: aws-provisioner-v1/gecko-{level}-b-linux
          android: aws-provisioner-v1/gecko-{level}-b-android
    treeherder:
       symbol: tc(L10n)
       tier: 2
       platform:
--- a/taskcluster/ci/toolchain/linux.yml
+++ b/taskcluster/ci/toolchain/linux.yml
@@ -180,16 +180,33 @@ linux64-libdmg:
     worker:
         docker-image: {in-tree: desktop-build}
         max-run-time: 36000
     run:
         using: toolchain-script
         script: build-libdmg-hfsplus.sh
         toolchain-artifact: public/build/dmg.tar.xz
 
+linux64-proguard-jar-repack:
+    description: "proguard.jar repack toolchain build"
+    treeherder:
+        kind: build
+        platform: toolchains/opt
+        symbol: TL(proguard-jar)
+        tier: 1
+    worker-type: aws-provisioner-v1/gecko-{level}-b-linux
+    worker:
+        docker-image: {in-tree: desktop-build}
+        max-run-time: 36000
+    run:
+        using: toolchain-script
+        script: repack-proguard-jar.sh
+        toolchain-artifact: public/build/proguard-jar.tar.xz
+        toolchain-alias: proguard-jar
+
 linux64-rust-1.19:
     description: "rust repack"
     treeherder:
         kind: build
         platform: toolchains/opt
         symbol: TL(rust)
         tier: 1
     worker-type: aws-provisioner-v1/gecko-{level}-b-linux
new file mode 100755
--- /dev/null
+++ b/taskcluster/scripts/misc/repack-proguard-jar.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+set -x -e -v
+
+# This script is for repacking Proguard to get the `proguard.jar`
+# needed to shrink Android packages.
+
+WORKSPACE=$HOME/workspace
+STAGE=$WORKSPACE/proguard
+UPLOAD_DIR=$HOME/artifacts
+
+VERSION=5.3.3
+URL=https://newcontinuum.dl.sourceforge.net/project/proguard/proguard/5.3/proguard$VERSION.tar.gz
+ARCHIVE=proguard$VERSION.tar.gz
+DIR=proguard$VERSION
+SHA256SUM=95bf9580107f00d0e26f01026dcfe9e7a772e5449488b03ba832836c3760b3af
+
+mkdir -p $UPLOAD_DIR $STAGE
+
+cd $WORKSPACE
+wget $URL
+echo "$SHA256SUM  $ARCHIVE" | sha256sum -c -
+
+# Just the file we need.
+tar zxvf $ARCHIVE '*/proguard.jar'
+
+# The archive is to satisfy source distribution requirements.
+mv $ARCHIVE $UPLOAD_DIR
+
+# This leaves us with $STAGE/lib/proguard.jar.
+mv $DIR/lib $STAGE
+
+cat >$STAGE/README<<EOF
+proguard.jar extracted from ${URL}.
+That archive, which includes source, is available as a taskcluster artifact:
+https://queue.taskcluster.net/v1/task/$TASK_ID/artifacts/public/$ARCHIVE
+EOF
+tar cf - -C $WORKSPACE `basename $STAGE` | xz > $UPLOAD_DIR/proguard-jar.tar.xz