Bug 1418464 - Part 2: Do less work when packaging GeckoView. r=mshal,jchen
☠☠ backed out by 9a8856c931e5 ☠ ☠
authorNick Alexander <nalexander@mozilla.com>
Fri, 05 Oct 2018 18:29:04 +0000
changeset 495578 d6794cb231e188d3bba25f8bae557de19febc09b
parent 495577 cc793c2d8cee397f244c25eb57676d663ed5bc9e
child 495579 d58fa859ebb0bd8b9964f2740c26078f32399b1c
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal, jchen
bugs1418464, 1351000
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1418464 - Part 2: Do less work when packaging GeckoView. r=mshal,jchen There are two significant parts to this commit. The first avoids scanning for duplicates in the omnijar when packaging locally. The Fennec/GeckoView local development edit-test-compile loop _always_ includes packaging, so these developers always pay to scan for duplicates. And, for historical reasons (Bug 1351000), we build both a Fennec and a GeckoView omnijar, so these developers pay to scan twice! Since scanning for duplicates isn't something that local developers are likely to act on, let's not do this at all (rather than, say, only once for Fennec). The second avoids stripping and XZ compressing Fennec/GeckoView asset/ libraries twice. A little path hacking allows to exploit the fact that the executable processing is idempotent, saving a significant amount of time during |mach package|. The final part of this commit just reduces the verbosity of a `zipalign` invocation. Depends on D7314 Differential Revision: https://phabricator.services.mozilla.com/D7315
--- a/mobile/android/gradle/with_gecko_binaries.gradle
+++ b/mobile/android/gradle/with_gecko_binaries.gradle
@@ -37,30 +37,32 @@ task buildOmnijars(type:Exec) {
             throw new GradleException("Process '${commandLine}' finished with non-zero exit value ${execResult.exitValue}:\n\n${standardOutput.toString()}")
 ext.configureVariantWithGeckoBinaries = { variant ->
     // :app needs the full Fennec omni.ja, whereas other projects need the
     // GeckoView-specific omni.ja.
-    def omnijar_dir = "app".equals(project.name) ? "fennec" : "geckoview"
-    def distDir = "${topobjdir}/dist/${omnijar_dir}"
+    def omnijarDir = { "${topobjdir}/dist/${it}" }("app".equals(project.name) ? "fennec" : "geckoview")
+    // All projects take the same Gecko libraries, which (for historical
+    // reasons) are in "fennec".
+    def distDir = "${topobjdir}/dist/fennec"
     def syncOmnijarFromDistDir = task("syncOmnijarFromDistDirFor${variant.name.capitalize()}", type: Sync) {
         onlyIf {
             if (source.empty) {
-                throw new StopExecutionException("Required omnijar not found in ${distDir}/{omni.ja,assets/omni.ja}.  Have you built and packaged?")
+                throw new StopExecutionException("Required omnijar not found in ${omnijarDir}/{omni.ja,assets/omni.ja}.  Have you built and packaged?")
             return true
-        from("${distDir}/omni.ja",
-             "${distDir}/assets/omni.ja") {
+        from("${omnijarDir}/omni.ja",
+             "${omnijarDir}/assets/omni.ja") {
             // Throw an exception if we find multiple, potentially conflicting omni.ja files.
             duplicatesStrategy 'fail'
     def syncLibsFromDistDir = task("syncLibsFromDistDirFor${variant.name.capitalize()}", type: Sync) {
         onlyIf {
             if (source.empty) {
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -19,17 +19,24 @@
+; We want fennec/assets for both Fennec and GeckoView, so we turn
+; geckoview/assets into fennec/assets.
 [assets xz_compress="1" destdir="assets/@ANDROID_CPU_ARCH@"]
+[assets xz_compress="1" destdir="../fennec/assets/@ANDROID_CPU_ARCH@"]
 #ifndef MOZ_STATIC_JS
 #ifdef MOZ_DMD
 #ifndef MOZ_FOLD_LIBS
@@ -66,17 +73,24 @@
 #ifndef MOZ_FOLD_LIBS
+; We want fennec/lib for both Fennec and GeckoView, so we turn
+; geckoview/lib into fennec/lib.
 [lib destdir="lib/@ANDROID_CPU_ARCH@"]
+[lib destdir="../fennec/lib/@ANDROID_CPU_ARCH@"]
 # This should be MOZ_CHILD_PROCESS_NAME, but that has a "lib/" prefix.
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -29,17 +29,19 @@ stage-package: multilocale.txt locale-ma
 		$(if $(MOZ_PACKAGER_MINIFY_JS),--minify-js \
 		  $(addprefix --js-binary ,$(JS_BINARY)) \
 		) \
 		$(if $(JARLOG_DIR),$(addprefix --jarlog ,$(wildcard $(JARLOG_FILE_AB_CD)))) \
 		$(if $(OPTIMIZEJARS),--optimizejars) \
 		$(addprefix --compress ,$(JAR_COMPRESSION)) \
 		$(if $(filter omni,$(MOZ_PACKAGER_FORMAT)),$(if $(NON_OMNIJAR_FILES),--non-resource $(NON_OMNIJAR_FILES)))
 	$(PYTHON) $(MOZILLA_DIR)/toolkit/mozapps/installer/find-dupes.py $(DEFINES) $(ACDEFINES) $(MOZ_PKG_DUPEFLAGS) $(DIST)/$(MOZ_PKG_DIR)
 	# Package mozharness
 	$(call py_action,test_archive, \
 		mozharness \
 	# Package JavaScript Shell
--- a/toolkit/mozapps/installer/upload-files-APK.mk
+++ b/toolkit/mozapps/installer/upload-files-APK.mk
@@ -27,17 +27,17 @@ endif
 # produces signed, unaligned APK files, but this expects unsigned, unaligned
 # APK files.  The |zip -d| discards any existing signature, turning a signed,
 # unaligned APK into an unsigned, unaligned APK.  Sadly |zip -q| doesn't
 # silence a warning about "nothing to do" so we pipe to /dev/null.
   cp $(1) $(2)-unaligned.apk && \
   ($(ZIP) -d $(2)-unaligned.apk 'META-INF/*' > /dev/null || true) && \
   $(RELEASE_JARSIGNER) $(2)-unaligned.apk && \
-  $(ZIPALIGN) -f -v 4 $(2)-unaligned.apk $(2) && \
+  $(ZIPALIGN) $(if $(MOZ_AUTOMATION),-v) -f 4 $(2)-unaligned.apk $(2) && \
   $(RM) $(2)-unaligned.apk
 # Files packed into the APK root.  Packing files into the APK root is not
 # supported by modern Android build systems, including Gradle, so don't add to
 # this list without Android peer approval.
   application.ini \
   package-name.txt \