Bug 1351000 - 1. Generate separate omni.ja for GeckoView; r=glandium
authorJim Chen <nchen@mozilla.com>
Wed, 05 Apr 2017 14:23:43 -0400
changeset 351334 729859cd4cde2ec6ab4ff52ee6b68fa5a124b50b
parent 351333 28ef9627977c0f574cd46f5deaad2bff0a9fddb4
child 351335 a54617dc98c1c312e3638489b825422cee301495
push id88844
push usernchen@mozilla.com
push dateWed, 05 Apr 2017 18:26:33 +0000
treeherdermozilla-inbound@3a75f63f3801 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1351000
milestone55.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 1351000 - 1. Generate separate omni.ja for GeckoView; r=glandium Generate a separate omni.ja for GeckoView during the packaging step, under dist/geckoview. Define a MOZ_GECKOVIEW_JAR flag to optionally include/exclude files in the package manifest.
mobile/android/build.mk
mobile/android/gradle/with_gecko_binaries.gradle
mobile/android/installer/Makefile.in
toolkit/mozapps/installer/package-name.mk
--- a/mobile/android/build.mk
+++ b/mobile/android/build.mk
@@ -3,16 +3,18 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 include  $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
 
 installer:
 	@$(MAKE) -C mobile/android/installer installer
 
 package:
+	# Setting MOZ_GECKOVIEW_JAR makes the installer generate a separate GeckoView JAR
+	@$(MAKE) MOZ_GECKOVIEW_JAR=1 -C mobile/android/installer stage-package
 	@$(MAKE) -C mobile/android/installer
 
 ifeq ($(OS_TARGET),Android)
 ifneq ($(MOZ_ANDROID_INSTALL_TARGET),)
 ANDROID_SERIAL = $(MOZ_ANDROID_INSTALL_TARGET)
 endif
 ifneq ($(ANDROID_SERIAL),)
 export ANDROID_SERIAL
--- a/mobile/android/gradle/with_gecko_binaries.gradle
+++ b/mobile/android/gradle/with_gecko_binaries.gradle
@@ -56,19 +56,21 @@ task buildOmnijar(type:Exec) {
     doLast {
         if (execResult.exitValue != 0) {
             throw new GradleException("Process '${commandLine}' finished with non-zero exit value ${execResult.exitValue}:\n\n${standardOutput.toString()}")
         }
     }
 }
 
 task syncOmnijarFromDistDir(type: Sync) {
+    // :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"
     into("${project.buildDir}/generated/omnijar")
-    from("${topobjdir}/dist/fennec/omni.ja",
-         "${topobjdir}/dist/fennec/assets/omni.ja") {
+    from("${topobjdir}/dist/${omnijar_dir}/omni.ja",
+         "${topobjdir}/dist/${omnijar_dir}/assets/omni.ja") {
         // Throw an exception if we find multiple, potentially conflicting omni.ja files.
         duplicatesStrategy 'fail'
     }
 }
 
 task checkLibsExistInDistDir<< {
     if (syncLibsFromDistDir.source.empty) {
         throw new GradleException("Required JNI libraries not found in ${topobjdir}/dist/fennec/lib.  Have you built and packaged?")
--- a/mobile/android/installer/Makefile.in
+++ b/mobile/android/installer/Makefile.in
@@ -45,16 +45,23 @@ endif
 ifdef MOZ_ANDROID_GCM
 DEFINES += -DMOZ_ANDROID_GCM=1
 endif
 
 ifdef MOZ_ARTIFACT_BUILDS
 DEFINES += -DMOZ_ARTIFACT_BUILDS=1
 endif
 
+ifdef MOZ_GECKOVIEW_JAR
+# Generate a GeckoView-specific omni.ja under dist/geckoview/omni.ja,
+# alongside the full omni.ja used by Fennec under dist/fennec/omni.ja.
+DEFINES += -DMOZ_GECKOVIEW_JAR=1
+MOZ_PKG_DIR = geckoview
+endif
+
 MOZ_PACKAGER_MINIFY=1
 
 include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
 
 # Note that JS_BINARY can be defined in packager.mk, so this test must come
 # after including that file. MOZ_PACKAGER_MINIFY_JS is used in packager.mk, but
 # since recipe evaluation is deferred, we can set it here after the inclusion.
 ifneq (,$(JS_BINARY))
--- a/toolkit/mozapps/installer/package-name.mk
+++ b/toolkit/mozapps/installer/package-name.mk
@@ -36,17 +36,17 @@ ifeq ($(TARGET_OS),linux-gnu)
 MOZ_PKG_PLATFORM := linux-$(TARGET_CPU)
 endif
 endif #MOZ_PKG_PLATFORM
 
 ifdef MOZ_PKG_SPECIAL
 MOZ_PKG_PLATFORM := $(MOZ_PKG_PLATFORM)-$(MOZ_PKG_SPECIAL)
 endif
 
-MOZ_PKG_DIR = $(MOZ_APP_NAME)
+MOZ_PKG_DIR ?= $(MOZ_APP_NAME)
 
 ifndef MOZ_PKG_APPNAME
 MOZ_PKG_APPNAME = $(MOZ_APP_NAME)
 endif
 
 ifdef MOZ_SIMPLE_PACKAGE_NAME
 PKG_BASENAME := $(MOZ_SIMPLE_PACKAGE_NAME)
 else