Bug 1509573 - Part 1: Make |mach build faster| handle Android generated files. r=froydnj
authorNick Alexander <nalexander@mozilla.com>
Wed, 28 Nov 2018 19:46:16 +0000
changeset 448642 d7e0661e34c223c23d04ef2083b2191f15c1d3c9
parent 448601 c35dea45f131cc498de25030f91f6178751aec71
child 448643 36cf7b9ce095cca9ebc495fb44f23125c100efa7
push id35121
push userdvarga@mozilla.com
push dateThu, 29 Nov 2018 09:53:54 +0000
treeherdermozilla-central@c302586458e0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1509573
milestone65.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 1509573 - Part 1: Make |mach build faster| handle Android generated files. r=froydnj This is just an awkward feature of the FasterMake build system: without a direct consumer, GENERATED_FILES aren't handled. We "consume" them into a dummy directory that isn't packaged. Sadly, the FasterMake generic rule doesn't handle relative directories smoothly, so we have to special case that too. Differential Revision: https://phabricator.services.mozilla.com/D12796
config/faster/rules.mk
mobile/android/base/moz.build
--- a/config/faster/rules.mk
+++ b/config/faster/rules.mk
@@ -61,16 +61,23 @@ endif
 # Extra define to trigger some workarounds. We should strive to limit the
 # use of those. As of writing the only one is in browser/locales/jar.mn.
 ACDEFINES += -DBUILD_FASTER
 
 # Files under the faster/ sub-directory, however, are not meant to use the
 # fallback
 $(TOPOBJDIR)/faster/%: ;
 
+ifeq ($(MOZ_BUILD_APP),mobile/android)
+# The generic rule doesn't handle relative directories, which are used
+# extensively in mobile/android/base.
+$(TOPOBJDIR)/mobile/android/base/% : $(TOPOBJDIR)/buildid.h FORCE
+	$(MAKE) -C $(TOPOBJDIR)/mobile/android/base $*
+endif
+
 # Generic rule to fall back to the recursive make backend.
 # This needs to stay after other $(TOPOBJDIR)/* rules because GNU Make
 # <3.82 apply pattern rules in definition order, not stem length like
 # modern GNU Make.
 $(TOPOBJDIR)/%: FORCE
 	$(MAKE) -C $(dir $@) $(notdir $@)
 
 # Install files using install manifests
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -178,31 +178,38 @@ for f in ['res/values/strings.xml',
     strings.script = '/python/mozbuild/mozbuild/action/generate_strings_xml.py'
     strings.inputs = [
         'strings.xml.in',
         # The `locales/en-US/` will be rewritten to the locale-specific path.
         'locales/en-US/android_strings.dtd',
         'locales/en-US/sync_strings.dtd',
     ]
 
+generated_inputs = [
+    '!AndroidManifest.xml',
+    '!generated/preprocessed/org/mozilla/gecko/AdjustConstants.java',
+    '!generated/preprocessed/org/mozilla/gecko/AppConstants.java',
+    '!generated/preprocessed/org/mozilla/gecko/CrashReporterConstants.java',
+    '!generated/preprocessed/org/mozilla/gecko/MmaConstants.java',
+    # These all depend on AB_CD, which isn't captured in this definition.  Due
+    # to subtle RecursiveMake details, everything works out.  In the future we
+    # can try to express the APKs themselves as LOCALIZED_GENERATED_FILES.
+    '!res/raw/suggestedsites.json',
+    '!res/values/strings.xml',
+]
+
 # The recursive make backend treats the first output specially: it's passed as
 # an open FileAvoidWrite to the invoked script.  That doesn't work well with
 # the Gradle task that generates all of the outputs, so we add a dummy first
 # output.
 t = ('android_apks',
      CONFIG['GRADLE_ANDROID_APP_APK'],
      CONFIG['GRADLE_ANDROID_APP_ANDROIDTEST_APK'])
 
 GENERATED_FILES += [t]
 GENERATED_FILES[t].force = True
 GENERATED_FILES[t].script = '/mobile/android/gradle.py:assemble_app'
-GENERATED_FILES[t].inputs += [
-    '!AndroidManifest.xml',
-    '!generated/preprocessed/org/mozilla/gecko/AdjustConstants.java',
-    '!generated/preprocessed/org/mozilla/gecko/AppConstants.java',
-    '!generated/preprocessed/org/mozilla/gecko/CrashReporterConstants.java',
-    '!generated/preprocessed/org/mozilla/gecko/MmaConstants.java',
-    # These all depend on AB_CD, which isn't captured in this definition.  Due
-    # to subtle RecursiveMake details, everything works out.  In the future we
-    # can try to express the APKs themselves as LOCALIZED_GENERATED_FILES.
-    '!res/raw/suggestedsites.json',
-    '!res/values/strings.xml',
-]
+GENERATED_FILES[t].inputs += generated_inputs
+
+# This makes |mach build faster| build these files.  See the workaround in
+# config/faster/rules.mk.  None of these files appear in package-manifest.in,
+# so they're not packaged.
+FINAL_TARGET_FILES.android += generated_inputs