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 680303 63824f309d216eab06ea34a6db244eb299139f58
parent 680302 86289e692d646181d545457fc953610e165ee2df
child 680304 9af705e7ab64106b49b84ae091aeaca13200d357
child 680318 c62434c4068d31f5a42610de28656b1714969a81
push id84454
push usernalexander@mozilla.com
push dateFri, 13 Oct 2017 20:05:02 +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/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
@@ -314,16 +323,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
@@ -343,16 +353,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
@@ -376,8 +387,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,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