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
--- 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
@@ -548,28 +548,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