Bug 1462489 - Re-generate the build backend when a build backend output is missing. draft
authorChris Manchester <cmanchester@mozilla.com>
Wed, 30 May 2018 15:25:22 -0700
changeset 801954 0d01c934a662f9a8dd99a4baa44b25c966e341f6
parent 801953 0d5a1dc7acfc04ecabbe9f0496eba330f021f1e9
push id111789
push usercmanchester@mozilla.com
push dateThu, 31 May 2018 03:40:57 +0000
bugs1462489
milestone62.0a1
Bug 1462489 - Re-generate the build backend when a build backend output is missing. MozReview-Commit-ID: CDO3bTGB4tj
python/mozbuild/mozbuild/controller/building.py
--- a/python/mozbuild/mozbuild/controller/building.py
+++ b/python/mozbuild/mozbuild/controller/building.py
@@ -988,16 +988,29 @@ class BuildDriver(MozbuildObject):
                         if e.errno == errno.ENOENT:
                             return True
                         raise
                     if dep_mtime > mtime:
                         return True
                 return False
 
             def backend_out_of_date(backend_file):
+                if not os.path.isfile(backend_file):
+                    return True
+
+                # Check if any of our output files have been removed since
+                # we last built the backend, re-generate the backend if
+                # so.
+                outputs = []
+                with open(backend_file, 'r') as fh:
+                    outputs = fh.read().splitlines()
+                for output in outputs:
+                    if not os.path.isfile(mozpath.join(self.topobjdir, output)):
+                        return True
+
                 dep_file = '%s.in' % backend_file
                 return build_out_of_date(backend_file, dep_file)
 
             def maybe_invoke_backend(active_backend):
                 # Attempt to bypass the make-oriented logic below. Note this
                 # will only succeed in case we're building with a non-make
                 # backend (Tup), and otherwise be harmless.
                 if active_backend: