Bug 1235021 - Avoid passing defines to FasterMakeBackend._consume_jar_manifest. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 24 Dec 2015 17:59:55 +0900
changeset 277924 3d25c8199fec736ccbdb13f15865ecad2232bd6f
parent 277923 dc3037f69b58e579a69d1c83925fb2205fb962a8
child 277925 70708efd7d3b39eb7160ada26bddaab60bc62557
push id69650
push usermh@glandium.org
push dateWed, 30 Dec 2015 22:08:21 +0000
treeherdermozilla-inbound@70708efd7d3b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1235021
milestone46.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 1235021 - Avoid passing defines to FasterMakeBackend._consume_jar_manifest. r=gps We want to move it to CommonBackend, so it's better to make it more independent, which the Defines instances now attached to ContextDerived instances allow.
python/mozbuild/mozbuild/backend/fastermake.py
--- a/python/mozbuild/mozbuild/backend/fastermake.py
+++ b/python/mozbuild/mozbuild/backend/fastermake.py
@@ -59,28 +59,26 @@ class FasterMakeBackend(CommonBackend):
             mozpath.join(obj.install_target, dest, target).replace('/', '_'))
         self._install_manifests[obj.install_target].add_preprocess(
             mozpath.join(obj.srcdir, path),
             mozpath.join(dest, target),
             depfile,
             **kwargs)
 
     def consume_object(self, obj):
-        if isinstance(obj, (JARManifest, FinalTargetPreprocessedFiles)):
-            defines = obj.defines or {}
-            if defines:
-                defines = defines.defines
-
         if isinstance(obj, JARManifest) and \
                 obj.install_target.startswith('dist/bin'):
-            self._consume_jar_manifest(obj, defines)
+            self._consume_jar_manifest(obj)
 
         elif isinstance(obj, (FinalTargetFiles,
                               FinalTargetPreprocessedFiles)) and \
                 obj.install_target.startswith('dist/bin'):
+            defines = obj.defines or {}
+            if defines:
+                defines = defines.defines
             for path, files in obj.files.walk():
                 for f in files:
                     if isinstance(obj, FinalTargetPreprocessedFiles):
                         self._add_preprocess(obj, f.full_path, path,
                                              target=f.target_basename,
                                              defines=defines)
                     elif '*' in f:
                         def _prefix(s):
@@ -116,28 +114,29 @@ class FasterMakeBackend(CommonBackend):
 
         elif isinstance(obj, XPIDLFile):
             self._has_xpidl = True
 
         # We currently ignore a lot of object types, so just acknowledge
         # everything.
         return True
 
-    def _consume_jar_manifest(self, obj, defines):
+    def _consume_jar_manifest(self, obj):
         # Ideally, this would all be handled somehow in the emitter, but
         # this would require all the magic surrounding l10n and addons in
         # the recursive make backend to die, which is not going to happen
         # any time soon enough.
         # Notably missing:
         # - DEFINES from config/config.mk
         # - L10n support
         # - The equivalent of -e when USE_EXTENSION_MANIFEST is set in
         #   moz.build, but it doesn't matter in dist/bin.
         pp = Preprocessor()
-        pp.context.update(defines)
+        if obj.defines:
+            pp.context.update(obj.defines.defines)
         pp.context.update(self.environment.defines)
         pp.context.update(
             AB_CD='en-US',
             BUILD_FASTER=1,
         )
         pp.out = JarManifestParser()
         pp.do_include(obj.path.full_path)
         self.backend_input_files |= pp.includes
@@ -148,17 +147,18 @@ class FasterMakeBackend(CommonBackend):
             jar_context.push_source(obj._context.main_path)
             jar_context.push_source(obj.path.full_path)
 
             install_target = obj.install_target
             if jarinfo.base:
                 install_target = mozpath.normpath(
                     mozpath.join(install_target, jarinfo.base))
             jar_context['FINAL_TARGET'] = install_target
-            jar_context['DEFINES'] = defines
+            if obj.defines:
+                jar_context['DEFINES'] = obj.defines.defines
             files = jar_context['FINAL_TARGET_FILES']
             files_pp = jar_context['FINAL_TARGET_PP_FILES']
 
             for e in jarinfo.entries:
                 if e.is_locale:
                     if jarinfo.relativesrcdir:
                         src = '/%s' % jarinfo.relativesrcdir
                     else: