Bug 1386040 - Write .purgecaches sentinels during |mach watch|. r=gps draft
authorNick Alexander <nalexander@mozilla.com>
Fri, 19 Jan 2018 14:40:51 -0800
changeset 749610 746bbe5c6f1555e8b729cbbbc1f8ca57110ae9ba
parent 749609 2a5b67e723f8e1654627e6e6f26704f6a4e57706
push id97459
push usernalexander@mozilla.com
push dateWed, 31 Jan 2018 20:08:09 +0000
reviewersgps
bugs1386040, 1368699
milestone60.0a1
Bug 1386040 - Write .purgecaches sentinels during |mach watch|. r=gps Right now, the "restart flow" that combines |mach watch| with the Quick-Restart Firefox for Desktop shortcut key is frustrated by inconsistencies writing the .purgecaches sentinels for the application. This commit uses recent work from https://bugzilla.mozilla.org/show_bug.cgi?id=1368699 to write the sentinels each time |mach watch| updates the object directory. MozReview-Commit-ID: 62Aa85oT1SE
python/mozbuild/mozbuild/faster_daemon.py
--- a/python/mozbuild/mozbuild/faster_daemon.py
+++ b/python/mozbuild/mozbuild/faster_daemon.py
@@ -16,16 +16,19 @@ import time
 import mozbuild.util
 import mozpack.path as mozpath
 from mozpack.manifests import (
     InstallManifest,
 )
 from mozpack.copier import (
     FileCopier,
 )
+from mozbuild.backend import (
+    get_backend_class,
+)
 
 # Watchman integration cribbed entirely from
 # https://github.com/facebook/watchman/blob/19aebfebb0b5b0b5174b3914a879370ffc5dac37/python/bin/watchman-wait
 import pywatchman
 
 
 def print_line(prefix, m, now=None):
     now = now or datetime.datetime.utcnow()
@@ -270,11 +273,19 @@ class Daemon(object):
                 partial_copier = FileCopier()
                 for output in all_outputs:
                     partial_copier.add(output, self.file_copier[output])
 
                 self.incremental_copy(partial_copier, force=True, verbose=verbose)
                 yield change
 
     def watch(self, verbose=True):
+        try:
+            active_backend = self.config_environment.substs.get('BUILD_BACKENDS', [None])[0]
+            if active_backend:
+                backend_cls = get_backend_class(active_backend)(self.config_environment)
+        except Exception:
+            backend_cls = None
+
         for change in self.output_changes(verbose=verbose):
-            pass
-
+            # Try to run the active build backend's post-build step, if possible.
+            if backend_cls:
+                backend_cls.post_build(self.config_environment, None, 1, False, 0)