Bug 1235021 - Re-emit ChromeManifestEntries from the jar manifest handler code in the FasterMake backend. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 24 Dec 2015 15:55:41 +0900
changeset 277922 a99b3de8d858141e9846e78d5ea7314732d1f114
parent 277921 4d191d8983d60511bf53e74e2d4b9eda04ec28ac
child 277923 dc3037f69b58e579a69d1c83925fb2205fb962a8
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 - Re-emit ChromeManifestEntries from the jar manifest handler code in the FasterMake backend. r=gps Instead of filling the install manifests accordingly, reloop in consume_object, so that the jar manifest handler code can eventually be reused in other backends.
python/mozbuild/mozbuild/backend/fastermake.py
--- a/python/mozbuild/mozbuild/backend/fastermake.py
+++ b/python/mozbuild/mozbuild/backend/fastermake.py
@@ -3,30 +3,32 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import, unicode_literals, print_function
 
 from mozbuild.backend.common import CommonBackend
 from mozbuild.frontend.context import (
     Context,
     Path,
+    VARIABLES,
 )
 from mozbuild.frontend.data import (
     ChromeManifestEntry,
     ContextDerived,
     Defines,
     FinalTargetPreprocessedFiles,
     FinalTargetFiles,
     JARManifest,
     XPIDLFile,
 )
 from mozbuild.jar import JarManifestParser
 from mozbuild.makeutil import Makefile
 from mozbuild.preprocessor import Preprocessor
 from mozbuild.util import OrderedDefaultDict
+from mozpack.chrome.manifest import parse_manifest_line
 from mozpack.manifests import InstallManifest
 import mozpack.path as mozpath
 from collections import OrderedDict
 from itertools import chain
 import os
 import sys
 
 
@@ -116,24 +118,26 @@ class FasterMakeBackend(CommonBackend):
         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
 
-        jar_context = Context(config=obj._context.config)
-        jar_context.add_source(obj.path.full_path)
+        for jarinfo in pp.out:
+            jar_context = Context(
+                allowed_variables=VARIABLES, config=obj._context.config)
+            jar_context.add_source(obj.path.full_path)
 
-        for jarinfo in pp.out:
             install_target = obj.install_target
             if jarinfo.base:
                 install_target = mozpath.normpath(
                     mozpath.join(install_target, jarinfo.base))
+            jar_context['FINAL_TARGET'] = install_target
             for e in jarinfo.entries:
                 if e.is_locale:
                     if jarinfo.relativesrcdir:
                         src = '/%s' % jarinfo.relativesrcdir
                     else:
                         src = ''
                     src = mozpath.join(src, 'en-US', e.source)
                 else:
@@ -181,28 +185,22 @@ class FasterMakeBackend(CommonBackend):
                         mozpath.join(jarinfo.name, mozpath.dirname(e.output)),
                         mozpath.basename(e.output),
                         defines=defines)
                 else:
                     self._install_manifests[install_target].add_symlink(
                         src.full_path,
                         mozpath.join(jarinfo.name, e.output))
 
-            manifest = mozpath.normpath(mozpath.join(install_target,
-                                                     jarinfo.name))
-            manifest += '.manifest'
             for m in jarinfo.chrome_manifests:
-                self._manifest_entries[manifest].add(
+                entry = parse_manifest_line(
+                    mozpath.dirname(jarinfo.name),
                     m.replace('%', mozpath.basename(jarinfo.name) + '/'))
-
-            if jarinfo.name != 'chrome':
-                manifest = mozpath.normpath(mozpath.join(install_target,
-                                                         'chrome.manifest'))
-                entry = 'manifest %s.manifest' % jarinfo.name
-                self._manifest_entries[manifest].add(entry)
+                self.consume_object(ChromeManifestEntry(
+                    jar_context, '%s.manifest' % jarinfo.name, entry))
 
     def consume_finished(self):
         mk = Makefile()
         # Add the default rule at the very beginning.
         mk.create_rule(['default'])
         mk.add_statement('TOPSRCDIR = %s' % self.environment.topsrcdir)
         mk.add_statement('TOPOBJDIR = %s' % self.environment.topobjdir)
         mk.add_statement('BACKEND = %s' % self._backend_output_list_file)