Bug 1319225 - Install generated FinalTargetFiles in the Tup backend. draft
authorChris Manchester <cmanchester@mozilla.com>
Wed, 21 Jun 2017 16:19:16 -0700
changeset 598642 779f4c88788701df1a60ba2438b7130a992c891d
parent 598638 865936535b72bc1847a0c902ed69ecfced1c3e3b
child 598643 bd70e883329d5d5ccd49e753f4b6a4b9c5a27539
push id65268
push userbmo:cmanchester@mozilla.com
push dateWed, 21 Jun 2017 23:19:29 +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).
+            return
+
         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):