Bug 1256033 - Allow GENERATED_FILES scripts to depend on other generated files; r=glandium
authorMike Shal <mshal@mozilla.com>
Fri, 11 Mar 2016 19:25:24 -0500
changeset 288809 d799cc3c6894621947b494b71b37e2b3ea337175
parent 288808 60d99f139eea31f904346b606c3575602067b014
child 288810 c1d3b754cbcdd44fb5234c7c902517f557a6c882
push id73589
push usermshal@mozilla.com
push dateTue, 15 Mar 2016 22:31:07 +0000
treeherdermozilla-inbound@c1d3b754cbcd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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 1256033 - Allow GENERATED_FILES scripts to depend on other generated files; r=glandium If we add an ObjDirPath as an input to a GENERATED_FILES script, we should run it in the misc tier to ensure the dependent files are created beforehand. We need to use Path objects instead of raw filenames in the GeneratedFile object so the recursive make backend can distinguish between source and objdir files. MozReview-Commit-ID: 9thHTi75zdI
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -500,29 +500,30 @@ class RecursiveMakeBackend(CommonBackend
                     backend_file.write('%s := %s\n' % (k, v))
         elif isinstance(obj, HostDefines):
             self._process_defines(obj, backend_file, which='HOST_DEFINES')
         elif isinstance(obj, Defines):
             self._process_defines(obj, backend_file)
         elif isinstance(obj, GeneratedFile):
-            self._no_skip['export'].add(backend_file.relobjdir)
+            tier = 'misc' if any(isinstance(f, ObjDirPath) for f in obj.inputs) else 'export'
+            self._no_skip[tier].add(backend_file.relobjdir)
             dep_file = "%s.pp" % obj.output
-            backend_file.write('export:: %s\n' % obj.output)
+            backend_file.write('%s:: %s\n' % (tier, obj.output))
             backend_file.write('GARBAGE += %s\n' % obj.output)
             backend_file.write('EXTRA_MDDEPEND_FILES += %s\n' % dep_file)
             if obj.script:
                 backend_file.write("""{output}: {script}{inputs}{backend}
 \t$(call py_action,file_generate,{script} {method} {output} $(MDDEPDIR)/{dep_file}{inputs}{flags})
-           inputs=' ' + ' '.join(obj.inputs) if obj.inputs else '',
+           inputs=' ' + ' '.join([f.full_path for f in obj.inputs]) if obj.inputs else '',
            flags=' ' + ' '.join(obj.flags) if obj.flags else '',
            backend=' backend.mk' if obj.flags else '',
         elif isinstance(obj, JARManifest):
             backend_file.write('JAR_MANIFEST := %s\n' % obj.path.full_path)
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -566,17 +566,17 @@ class TreeMetadataEmitter(LoggingMixin):
                     script = mozpath.join(
                         'action', 'generate_symbols_file.py')
                     defines = ()
                     if lib.defines:
                         defines = lib.defines.get_defines()
                     yield GeneratedFile(context, script,
                         'generate_symbols_file', lib.symbols_file,
-                        [symbols_file.full_path], defines)
+                        [symbols_file], defines)
             if static_lib:
                 lib = StaticLibrary(context, libname, **static_args)
                 self._linkage.append((context, lib, 'USE_LIBS'))
                 has_linkables = True
             if lib_defines:
                 if not libname:
@@ -984,17 +984,17 @@ class TreeMetadataEmitter(LoggingMixin):
                 xpidl_module, add_to_manifest=not context['XPIDL_NO_MANIFEST'])
     def _process_generated_files(self, context):
         for path in context['CONFIGURE_DEFINE_FILES']:
             script = mozpath.join(mozpath.dirname(mozpath.dirname(__file__)),
                                   'action', 'process_define_files.py')
             yield GeneratedFile(context, script, 'process_define_file',
-                                [mozpath.join(context.srcdir, path + '.in')])
+                                [Path(context, path + '.in')])
         generated_files = context.get('GENERATED_FILES')
         if not generated_files:
         for f in generated_files:
             flags = generated_files[f]
             output = f
@@ -1019,17 +1019,17 @@ class TreeMetadataEmitter(LoggingMixin):
                 for i in flags.inputs:
                     p = Path(context, i)
                     if (isinstance(p, SourcePath) and
                             not os.path.exists(p.full_path)):
                         raise SandboxValidationError(
                             'Input for generating %s does not exist: %s'
                             % (f, p.full_path), context)
-                    inputs.append(p.full_path)
+                    inputs.append(p)
                 script = None
                 method = None
             yield GeneratedFile(context, script, method, output, inputs)
     def _process_test_manifests(self, context):
         for prefix, info in TEST_MANIFESTS.items():
             for path, manifest in context.get('%s_MANIFESTS' % prefix, []):