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
milestone64.0a1
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
mobile/android/gradle/with_gecko_binaries.gradle
mobile/android/installer/package-manifest.in
toolkit/mozapps/installer/packager.mk
toolkit/mozapps/installer/upload-files-APK.mk
--- 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
         }
 
         into("${project.buildDir}/moz.build/src/${variant.name}/omnijar")
-        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 @@
 @BINPATH@/update.locale
 #ifdef MOZ_UPDATER
 @BINPATH@/updater.ini
 #endif
 @BINPATH@/dictionaries/*
 @BINPATH@/hyphenation/*
 @BINPATH@/localization/*
 
+; We want fennec/assets for both Fennec and GeckoView, so we turn
+; geckoview/assets into fennec/assets.
+#ifndef MOZ_GECKOVIEW_JAR
 [assets xz_compress="1" destdir="assets/@ANDROID_CPU_ARCH@"]
+#else
+[assets xz_compress="1" destdir="../fennec/assets/@ANDROID_CPU_ARCH@"]
+#endif
+
 #ifndef MOZ_STATIC_JS
 @BINPATH@/@DLL_PREFIX@mozjs@DLL_SUFFIX@
 #endif
 #ifdef MOZ_DMD
 @BINPATH@/@DLL_PREFIX@dmd@DLL_SUFFIX@
 #endif
 #ifndef MOZ_FOLD_LIBS
 @BINPATH@/@DLL_PREFIX@plc4@DLL_SUFFIX@
@@ -66,17 +73,24 @@
 @BINPATH@/@DLL_PREFIX@nssdbm3.chk
 #endif
 #endif
 
 #ifndef MOZ_FOLD_LIBS
 @BINPATH@/@DLL_PREFIX@mozsqlite3@DLL_SUFFIX@
 #endif
 
+; We want fennec/lib for both Fennec and GeckoView, so we turn
+; geckoview/lib into fennec/lib.
+#ifndef MOZ_GECKOVIEW_JAR
 [lib destdir="lib/@ANDROID_CPU_ARCH@"]
+#else
+[lib destdir="../fennec/lib/@ANDROID_CPU_ARCH@"]
+#endif
+
 @BINPATH@/@DLL_PREFIX@mozglue@DLL_SUFFIX@
 # This should be MOZ_CHILD_PROCESS_NAME, but that has a "lib/" prefix.
 @BINPATH@/@MOZ_CHILD_PROCESS_NAME@
 
 #ifdef MOZ_ANDROID_GOOGLE_VR
 @BINPATH@/@DLL_PREFIX@gvr@DLL_SUFFIX@
 #endif
 
--- 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)) \
 		$(MOZ_PKG_MANIFEST) '$(DIST)' '$(DIST)'/$(MOZ_PKG_DIR)$(if $(MOZ_PKG_MANIFEST),,$(_BINPATH)) \
 		$(if $(filter omni,$(MOZ_PACKAGER_FORMAT)),$(if $(NON_OMNIJAR_FILES),--non-resource $(NON_OMNIJAR_FILES)))
+ifdef MOZ_AUTOMATION
 	$(PYTHON) $(MOZILLA_DIR)/toolkit/mozapps/installer/find-dupes.py $(DEFINES) $(ACDEFINES) $(MOZ_PKG_DUPEFLAGS) $(DIST)/$(MOZ_PKG_DIR)
+endif # MOZ_AUTOMATION
 ifndef MOZ_IS_COMM_TOPDIR
 	# Package mozharness
 	$(call py_action,test_archive, \
 		mozharness \
 		$(ABS_DIST)/$(PKG_PATH)$(MOZHARNESS_PACKAGE))
 endif # MOZ_IS_COMM_TOPDIR
 ifdef MOZ_PACKAGE_JSSHELL
 	# 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.
 RELEASE_SIGN_ANDROID_APK = \
   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.
 ROOT_FILES := \
   application.ini \
   package-name.txt \