Bug 1319225 - Install generated FinalTargetFiles in the Tup backend. draft
authorChris Manchester <cmanchester@mozilla.com>
Fri, 16 Jun 2017 13:55:06 -0700
changeset 595751 815a93a5ce66e50f27fc2761d8e561e4a8e6217d
parent 595750 e896b1f454e831af629f8a4a8c7893046739fc10
child 633802 818ed9a5cdc66691c8ddd4dffa83dfe7ba5758ec
push id64444
push userbmo:cmanchester@mozilla.com
push dateFri, 16 Jun 2017 20:55:26 +0000
bugs1319225
milestone56.0a1
Bug 1319225 - Install generated FinalTargetFiles in the Tup backend. MozReview-Commit-ID: 8NLF11upDCn
python/mozbuild/mozbuild/backend/tup.py
--- a/python/mozbuild/mozbuild/backend/tup.py
+++ b/python/mozbuild/mozbuild/backend/tup.py
@@ -305,51 +305,59 @@ class TupOnly(CommonBackend, PartialBack
                 '_tests',
                 'dist/include',
                 'dist/branding',
                 'dist/sdk',
             ))
             if not path:
                 raise Exception("Cannot install to " + target)
 
+        if target.startswith('_tests'):
+            # TODO: TEST_HARNESS_FILES present a few challenges for the tup
+            # backend (bug 1372381).
+            pass
+
         for path, files in obj.files.walk():
             backend_file = self._get_backend_file(mozpath.join(target, path))
             for f in files:
                 if not isinstance(f, ObjDirPath):
                     if '*' in f:
                         if f.startswith('/') or isinstance(f, AbsolutePath):
                             basepath, wild = os.path.split(f.full_path)
                             if '*' in basepath:
                                 raise Exception("Wildcards are only supported in the filename part of "
                                                 "srcdir-relative or absolute paths.")
 
                             # TODO: This is only needed for Windows, so we can
                             # skip this for now.
                             pass
-                        elif '**' not in f:
+                        else:
                             def _prefix(s):
                                 for p in mozpath.split(s):
                                     if '*' not in p:
                                         yield p + '/'
                             prefix = ''.join(_prefix(f.full_path))
                             self.backend_input_files.add(prefix)
                             finder = FileFinder(prefix)
                             for p, _ in finder.find(f.full_path[len(prefix):]):
                                 backend_file.symlink_rule(mozpath.join(prefix, p),
                                                           output=mozpath.join(f.target_basename, p),
                                                           output_group=self._installed_files)
-                        else:
-                            # TODO: Handle wildcards containing '**' used under '_tests'
-                            # (bug 1372381).
-                            pass
                     else:
                         backend_file.symlink_rule(f.full_path, output=f.target_basename, output_group=self._installed_files)
                 else:
-                    # TODO: Support installing generated files
-                    pass
+                    # We're not generating files in these directories yet, so
+                    # don't attempt to install files generated from them.
+                    if f.context.relobjdir not in ('layout/style/test',
+                                                   'toolkit/library'):
+                        output = mozpath.join('$(MOZ_OBJ_ROOT)', target, path,
+                                              f.target_basename)
+                        gen_backend_file = self._get_backend_file(f.context.relobjdir)
+                        gen_backend_file.symlink_rule(f.full_path, output=output,
+                                                      output_group=self._installed_files)
 
     def _process_final_target_pp_files(self, obj, backend_file):
         for i, (path, files) in enumerate(obj.files.walk()):
             for f in files:
                 self._preprocess(backend_file, f.full_path,
                                  destdir=mozpath.join(self.environment.topobjdir, obj.install_target, path))
 
     def _handle_idl_manager(self, manager):