Bug 1229245 - Don't store the target in FinalTarget{,Preprocessed}Files instances. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Sat, 28 Nov 2015 11:42:51 +0900
changeset 274847 0aed6d985948
parent 274846 60c1ec5f8369
child 274848 aad04db89c38
push id68688
push usermh@glandium.org
push date2015-12-01 05:01 +0000
treeherdermozilla-inbound@aad04db89c38 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1229245
milestone45.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 1229245 - Don't store the target in FinalTarget{,Preprocessed}Files instances. r=gps They already have that value in self.install_target.
python/mozbuild/mozbuild/backend/recursivemake.py
python/mozbuild/mozbuild/frontend/data.py
python/mozbuild/mozbuild/frontend/emitter.py
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -586,21 +586,20 @@ class RecursiveMakeBackend(CommonBackend
             self._process_static_library(obj, backend_file)
             self._process_linked_libraries(obj, backend_file)
 
         elif isinstance(obj, HostLibrary):
             self._process_host_library(obj, backend_file)
             self._process_linked_libraries(obj, backend_file)
 
         elif isinstance(obj, FinalTargetFiles):
-            self._process_final_target_files(obj, obj.files, obj.target)
+            self._process_final_target_files(obj, obj.files)
 
         elif isinstance(obj, FinalTargetPreprocessedFiles):
-            self._process_final_target_pp_files(obj, obj.files, obj.target,
-                                                backend_file)
+            self._process_final_target_pp_files(obj, obj.files, backend_file)
 
         elif isinstance(obj, AndroidResDirs):
             # Order matters.
             for p in obj.paths:
                 backend_file.write('ANDROID_RES_DIRS += %s\n' % p.full_path)
 
         elif isinstance(obj, AndroidAssetsDirs):
             # Order matters.
@@ -1314,17 +1313,18 @@ INSTALL_TARGETS += %(prefix)s
             if obj.KIND == 'target':
                 backend_file.write_once('OS_LIBS += %s\n' % lib)
             else:
                 backend_file.write_once('HOST_EXTRA_LIBS += %s\n' % lib)
 
         # Process library-based defines
         self._process_defines(obj.defines, backend_file)
 
-    def _process_final_target_files(self, obj, files, target):
+    def _process_final_target_files(self, obj, files):
+        target = obj.install_target
         if target.startswith('dist/bin'):
             install_manifest = self._install_manifests['dist_bin']
             reltarget = mozpath.relpath(target, 'dist/bin')
         elif target.startswith('dist/xpi-stage'):
             install_manifest = self._install_manifests['dist_xpi-stage']
             reltarget = mozpath.relpath(target, 'dist/xpi-stage')
         elif target.startswith('_tests'):
             install_manifest = self._install_manifests['tests']
@@ -1333,26 +1333,26 @@ INSTALL_TARGETS += %(prefix)s
             raise Exception("Cannot install to " + target)
 
         for path, strings in files.walk():
             for f in strings:
                 source = mozpath.normpath(os.path.join(obj.srcdir, f))
                 dest = mozpath.join(reltarget, path, mozpath.basename(f))
                 install_manifest.add_symlink(source, dest)
 
-    def _process_final_target_pp_files(self, obj, files, target, backend_file):
+    def _process_final_target_pp_files(self, obj, files, backend_file):
         # We'd like to install these via manifests as preprocessed files.
         # But they currently depend on non-standard flags being added via
         # some Makefiles, so for now we just pass them through to the
         # underlying Makefile.in.
         for i, (path, strings) in enumerate(files.walk()):
             for f in strings:
                 backend_file.write('DIST_FILES_%d += %s\n' % (i, f))
             backend_file.write('DIST_FILES_%d_PATH := $(DEPTH)/%s\n'
-                               % (i, mozpath.join(target, path)))
+                               % (i, mozpath.join(obj.install_target, path)))
             backend_file.write('PP_TARGETS += DIST_FILES_%d\n' % i)
 
     def _process_chrome_manifest_entry(self, obj, backend_file):
         fragment = Makefile()
         rule = fragment.create_rule(targets=['misc:'])
 
         top_level = mozpath.join(obj.install_target, 'chrome.manifest')
         if obj.path != top_level:
--- a/python/mozbuild/mozbuild/frontend/data.py
+++ b/python/mozbuild/mozbuild/frontend/data.py
@@ -815,37 +815,35 @@ class FinalTargetFiles(ContextDerived):
     HierarchicalStringList.
 
     We need an object derived from ContextDerived for use in the backend, so
     this object fills that role. It just has a reference to the underlying
     HierarchicalStringList, which is created when parsing FINAL_TARGET_FILES.
     """
     __slots__ = ('files', 'target')
 
-    def __init__(self, sandbox, files, target):
+    def __init__(self, sandbox, files):
         ContextDerived.__init__(self, sandbox)
         self.files = files
-        self.target = target
 
 
 class FinalTargetPreprocessedFiles(ContextDerived):
     """Sandbox container object for FINAL_TARGET_PP_FILES, which is a
     HierarchicalStringList.
 
     We need an object derived from ContextDerived for use in the backend, so
     this object fills that role. It just has a reference to the underlying
     HierarchicalStringList, which is created when parsing
     FINAL_TARGET_PP_FILES.
     """
     __slots__ = ('files', 'target')
 
-    def __init__(self, sandbox, files, target):
+    def __init__(self, sandbox, files):
         ContextDerived.__init__(self, sandbox)
         self.files = files
-        self.target = target
 
 
 class GeneratedFile(ContextDerived):
     """Represents a generated file."""
 
     __slots__ = (
         'script',
         'method',
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -694,17 +694,17 @@ class TreeMetadataEmitter(LoggingMixin):
                 del all_files.defaults._children['pref']
 
             if has_resources and (context.get('DIST_SUBDIR') or
                                   context.get('XPI_NAME')):
                 raise SandboxValidationError(
                     'RESOURCES_FILES cannot be used with DIST_SUBDIR or '
                     'XPI_NAME.', context)
 
-            yield cls(context, all_files, context['FINAL_TARGET'])
+            yield cls(context, all_files)
 
         # Check for manifest declarations in EXTRA_{PP_,}COMPONENTS.
         if any(e.endswith('.js') for e in components) and \
                 not any(e.endswith('.manifest') for e in components) and \
                 not context.get('NO_JS_MANIFEST', False):
             raise SandboxValidationError('A .js component was specified in EXTRA_COMPONENTS '
                                          'or EXTRA_PP_COMPONENTS without a matching '
                                          '.manifest file.  See '