Closed Bug 1255914 Opened 6 years ago Closed 5 years ago

Build release configurations and Proguard (minify) Gradle builds

Categories

(Firefox Build System :: Android Studio and Gradle Integration, defect)

defect
Not set
normal

Tracking

(firefox53 fixed)

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: nalexander, Assigned: nalexander)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Right now, we build debug automation: https://dxr.mozilla.org/mozilla-central/source/mobile/android/base/Makefile.in#214.

This ticket tracks changing that to release automation; enabling Proguard (minify) on those configurations; and verifying that the Proguard passes aren't breaking our local builds or our test configurations.
Depends on: 1262273
mcomella: I have patches on try for this.  I'll attempt to post the latest from my tree shortly; I'm not aware of significant changes here.
I think this is already working, see https://dxr.mozilla.org/mozilla-central/source/mobile/android/app/build.gradle#44.  I'll re-open if we're actually busted.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
We're busted.  We build debug in --with-gradle: https://dxr.mozilla.org/mozilla-central/source/mobile/android/base/Makefile.in#238.

The trick to making this work is keeping our bonkers Robocop, which runs against a Proguarded APK.  We can either try to make Gradle produce a debug test APK that runs against a release Fennec APK, or we can make the debug APK _be_ a release Fennec APK.  I think the latter is probably easier; I'll investigate.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
> ... or we can make the debug APK _be_ a release Fennec APK.  I think the latter is probably easier; I'll
> investigate.

A little more context: the Android Gradle plugin automatically produces a "debugAndroidTest" but no "releaseAndroidTest".  The androidTest configuration is what makes the test APK (which we rename to robocop.apk); it seems harder to coerce a "releaseAndroidTest" than to make the "debugAutomation" configuration just _be_ release.
--with-gradle, without Proguard:


Size of classes.dex: 7525520 bytes
Size of fennec-52.0a1.en-US.android-arm.apk: 32251279 bytes

https://treeherder.mozilla.org/#/jobs?repo=try&revision=8a39a0b7a09288e656b1d26dc252ad1c923ac960&selectedJob=30973164

--with-gradle, with Proguard

Size of classes.dex: 7359360 bytes
Size of fennec-52.0a1.en-US.android-arm.apk: 32164904 bytes

https://treeherder.mozilla.org/#/jobs?repo=try&revision=a425cf4d7daabf5f5d90dc799f3c1bdc84ef3f44&selectedJob=30973001

Without Gradle, with Proguard

Size of classes.dex: 6885456 bytes
Size of fennec-52.0a1.en-US.android-arm.apk: 31803028 bytes

https://treeherder.mozilla.org/#/jobs?repo=mozilla-inbound&selectedJob=39132592

So that's a difference in APK size of (- 31803028 32164904) = 361876.  I comment on the difference in classes.dex in the commit message.
Comment on attachment 8812474 [details]
Bug 1255914 - Part 1: Proguard (minify) Gradle builds in automation.

https://reviewboard.mozilla.org/r/94210/#review94554

::: mobile/android/app/build.gradle:70
(Diff revision 1)
>              proguardFile "${topsrcdir}/mobile/android/config/proguard/proguard.cfg"
>          }
> +        release configureMinifyClosure
> +        if (mozconfig.substs.MOZILLA_OFFICIAL) {
> +            debug configureMinifyClosure
> +        }            

nit: trailing whitespaces
Attachment #8812474 - Flags: review?(s.kaspari) → review+
Comment on attachment 8812475 [details]
Bug 1255914 - Part 2: mostly back out multiDex (changeset 6972bef6693c).

https://reviewboard.mozilla.org/r/94212/#review94556

Nice!
Attachment #8812475 - Flags: review?(s.kaspari) → review+
Assignee: nobody → nalexander
Pushed by nalexander@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/61e649e690c9
Part 1: Proguard (minify) Gradle builds in automation. r=sebastian
https://hg.mozilla.org/integration/autoland/rev/a776c56e2ac7
Part 2: mostly back out multiDex (changeset 6972bef6693c). r=sebastian
https://hg.mozilla.org/mozilla-central/rev/a776c56e2ac7
Status: REOPENED → RESOLVED
Closed: 5 years ago5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 53
Blocks: 1353055
No longer blocks: gradle-automation
Product: Firefox for Android → Firefox Build System
Target Milestone: Firefox 53 → mozilla53
You need to log in before you can comment on or make changes to this bug.