Bug 1352599 - Part 1: Add and use a Proguard toolchain in Android builds. r=froydnj draft
authorNick Alexander <nalexander@mozilla.com>
Mon, 02 Oct 2017 13:27:51 -0700
changeset 676206 db3fab1b245188309681e17ba32497d24d77a2d2
parent 674396 9be05b2177667ed8221f9da4fdcc200dbdf3de62
child 676207 eb1bc4ddbb23ca2ccf18760e2e53b01e8b5517e3
push id83424
push usernalexander@mozilla.com
push dateFri, 06 Oct 2017 20:34:02 +0000
reviewersfroydnj
bugs1352599
milestone58.0a1
Bug 1352599 - Part 1: Add and use a Proguard toolchain in Android builds. r=froydnj MozReview-Commit-ID: 5lyHGLkzyg
taskcluster/ci/build/android.yml
taskcluster/ci/toolchain/linux.yml
taskcluster/scripts/misc/repack-proguard-jar.sh
--- 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/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,36 @@
+#!/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
+
+URL=https://newcontinuum.dl.sourceforge.net/project/proguard/proguard/5.3/proguard5.3.3.tar.gz
+SHA256SUM=95bf9580107f00d0e26f01026dcfe9e7a772e5449488b03ba832836c3760b3af
+ARCHIVE=proguard5.3.3.tar.gz
+DIR=proguard5.3.3
+
+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