Bug 1411686 - Part 2: Don't invoke |make gradle-targets| for AB_CD=multi. r=maliu
authorNick Alexander <nalexander@mozilla.com>
Thu, 19 Oct 2017 13:49:45 -0700
changeset 389044 1e44cf9fed8b781f1b47294f93a5c7efdafb5d8c
parent 389043 11aeb89a63f0e5dcbcfb13c6847ccdcf4e9c729e
child 389045 d4baaf271606ac5cbdbbd22495bf42ed73ac3d38
push id32777
push userarchaeopteryx@coole-files.de
push dateMon, 30 Oct 2017 22:44:45 +0000
treeherdermozilla-central@dd0f265a1300 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmaliu
bugs1411686
milestone58.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 1411686 - Part 2: Don't invoke |make gradle-targets| for AB_CD=multi. r=maliu This work-around isn't needed for the moz.build system because there's no equivalent of the |mach build| > |mach gradle| > |make gradle-targets| dependency chain that "re-enters" Make processing. That is, the nodeps mechanism ensures that nothing in m/a/b/Makefile.in (that knows about AB_CD) ever sees AB_CD=multi. MozReview-Commit-ID: qZKAtlLhJw
build.gradle
mobile/android/base/Makefile.in
--- a/build.gradle
+++ b/build.gradle
@@ -59,31 +59,42 @@ buildscript {
             // Without these, we get errors linting.
             exclude module: 'guava'
         }
         // Provided in tree.
         classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.7.3'
     }
 }
 
-task generateCodeAndResources(type:Exec) {
-    workingDir "${topobjdir}"
-
-    commandLine mozconfig.substs.GMAKE
-    args '-C'
-    args "${topobjdir}/mobile/android/base"
-    args 'gradle-targets'
+if ('multi' == System.env.AB_CD) {
+    // Multi-l10n builds set `AB_CD=multi`, which isn't a valid locale.  This
+    // causes the
+    //
+    // |mach build| > |mach gradle| > |make gradle-targets| > AndroidManifest.xml > strings.xml > multi/brand.dtd
+    //
+    // dependency chain to fail, since multi isn't a real locale.  To avoid
+    // this, if Gradle is invoked with AB_CD=multi, we don't invoke Make at all.
+    task generateCodeAndResources()
+} else {
+    task generateCodeAndResources(type:Exec) {
+        workingDir "${topobjdir}"
 
-    // Only show the output if something went wrong.
-    ignoreExitValue = true
-    standardOutput = new ByteArrayOutputStream()
-    errorOutput = standardOutput
-    doLast {
-        if (execResult.exitValue != 0) {
-            throw new GradleException("Process '${commandLine}' finished with non-zero exit value ${execResult.exitValue}:\n\n${standardOutput.toString()}")
+        commandLine mozconfig.substs.GMAKE
+        args '-C'
+        args "${topobjdir}/mobile/android/base"
+        args 'gradle-targets'
+
+        // Only show the output if something went wrong.
+        ignoreExitValue = true
+        standardOutput = new ByteArrayOutputStream()
+        errorOutput = standardOutput
+        doLast {
+            if (execResult.exitValue != 0) {
+                throw new GradleException("Process '${commandLine}' finished with non-zero exit value ${execResult.exitValue}:\n\n${standardOutput.toString()}")
+            }
         }
     }
 }
 
 // Skip unit test for all build variants, unless if it was specifically requested by user.
 // The enabled property for the unit test tasks is reset based on the command line task names just before the task execution.
 // I bet there is a easier/cleaner way to do this, but this gets the job done for now.
 Pattern pattern = Pattern.compile('.*test(.+UnitTest)?.*')
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -544,28 +544,33 @@ update-fennec-wrappers:
 $(ABS_DIST)/fennec/$(OMNIJAR_NAME): FORCE
 	$(REPORT_BUILD)
 	$(MAKE) -C ../../../faster
 	$(MAKE) -C ../installer stage-package
 	$(MKDIR) -p $(@D)
 	rsync --update $(DIST)/fennec/$(notdir $(OMNIJAR_NAME)) $@
 	$(RM) $(DIST)/fennec/$(notdir $(OMNIJAR_NAME))
 
-# Targets built very early during a Gradle build.
+ifndef MOZILLA_OFFICIAL
+# Targets built very early during a Gradle build.  In automation,
+# these are built before Gradle is invoked by .gradle.deps and
+# gradle-targets is not made at all.  This is required to avoid
+# building gradle-targets with AB_CD=multi during multi-l10n builds.
 gradle-targets: $(foreach f,$(constants_PP_JAVAFILES),$(f))
 gradle-targets: AndroidManifest.xml
 gradle-targets: $(ANDROID_GENERATED_RESFILES)
 
-ifndef MOZILLA_OFFICIAL
 # Local developers update omni.ja during their builds.  There's a
 # chicken-and-egg problem here.
 gradle-omnijar: $(abspath $(DIST)/fennec/$(OMNIJAR_NAME))
 else
 # In automation, omni.ja is built only during packaging.
 gradle-omnijar:
+
+gradle-targets:
 endif
 
 .PHONY: gradle-targets gradle-omnijar
 
 # GeneratedJNIWrappers.cpp target also generates
 #   GeneratedJNIWrappers.h and GeneratedJNINatives.h
 # FennecJNIWrappers.cpp target also generates
 #   FennecJNIWrappers.h and FennecJNINatives.h