Bug 1449965 - Output directories during the build as we compile object files. draft
authorChris Manchester <cmanchester@mozilla.com>
Thu, 19 Apr 2018 00:16:57 -0700
changeset 784840 7619303e82b7fc28ce75402d96664de304627062
parent 783746 5ded36cb383d3ccafd9b6c231c5120dcdae196a2
push id107052
push userbmo:cmanchester@mozilla.com
push dateThu, 19 Apr 2018 07:17:14 +0000
bugs1449965
milestone61.0a1
Bug 1449965 - Output directories during the build as we compile object files. MozReview-Commit-ID: K4RrObGHXIC
config/rules.mk
python/mozbuild/mozbuild/controller/building.py
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -31,17 +31,17 @@ ifdef REBUILD_CHECK
 REPORT_BUILD = $(info $(shell $(PYTHON) $(MOZILLA_DIR)/config/rebuild_check.py $@ $^))
 REPORT_BUILD_VERBOSE = $(REPORT_BUILD)
 else
 REPORT_BUILD = $(info $(notdir $@))
 
 ifdef BUILD_VERBOSE_LOG
 REPORT_BUILD_VERBOSE = $(REPORT_BUILD)
 else
-REPORT_BUILD_VERBOSE =
+REPORT_BUILD_VERBOSE = $(call BUILDSTATUS,BUILD_VERBOSE $(relativesrcdir))
 endif
 
 endif
 
 EXEC			= exec
 
 # ELOG prints out failed command when building silently (gmake -s). Pymake
 # prints out failed commands anyway, so ELOG just makes things worse by
--- a/python/mozbuild/mozbuild/controller/building.py
+++ b/python/mozbuild/mozbuild/controller/building.py
@@ -92,17 +92,17 @@ If you did not modify any test files, it
 and proceed with running tests. To do this run:
 
  $ touch {clobber_file}
 '''.splitlines()])
 
 
 
 BuildOutputResult = namedtuple('BuildOutputResult',
-    ('warning', 'state_changed', 'for_display'))
+    ('warning', 'state_changed', 'message'))
 
 
 class TierStatus(object):
     """Represents the state and progress of tier traversal.
 
     The build system is organized into linear phases called tiers. Each tier
     executes in the order it was defined, 1 at a time.
     """
@@ -224,16 +224,17 @@ class BuildMonitor(MozbuildObject):
             self.warnings_database.insert(warning)
             # Make a copy so mutations don't impact other database.
             self.instance_warnings.insert(warning.copy())
 
         self._warnings_collector = WarningsCollector(on_warning,
                                                      objdir=self.topobjdir)
 
         self.build_objects = []
+        self.build_dirs = set()
 
     def start(self):
         """Record the start of the build."""
         self.start_time = time.time()
         self._finder_start_cpu = self._get_finder_cpu_usage()
 
     def start_resource_recording(self):
         # This should be merged into start() once bug 892342 lands.
@@ -250,20 +251,21 @@ class BuildMonitor(MozbuildObject):
 
         In this named tuple, warning will be an object describing a new parsed
         warning. Otherwise it will be None.
 
         state_changed indicates whether the build system changed state with
         this line. If the build system changed state, the caller may want to
         query this instance for the current state in order to update UI, etc.
 
-        for_display is a boolean indicating whether the line is relevant to the
-        user. This is typically used to filter whether the line should be
-        presented to the user.
+        message is either None, or the content of a message to be
+        displayed to the user.
         """
+        message = None
+
         if line.startswith('BUILDSTATUS'):
             args = line.split()[1:]
 
             action = args.pop(0)
             update_needed = True
 
             if action == 'TIERS':
                 self.tiers.set_tiers(args)
@@ -272,29 +274,36 @@ class BuildMonitor(MozbuildObject):
                 tier = args[0]
                 self.tiers.begin_tier(tier)
             elif action == 'TIER_FINISH':
                 tier, = args
                 self.tiers.finish_tier(tier)
             elif action == 'OBJECT_FILE':
                 self.build_objects.append(args[0])
                 update_needed = False
+            elif action == 'BUILD_VERBOSE':
+                build_dir = args[0]
+                if build_dir not in self.build_dirs:
+                    self.build_dirs.add(build_dir)
+                    message = build_dir
+                update_needed = False
             else:
                 raise Exception('Unknown build status: %s' % action)
 
-            return BuildOutputResult(None, update_needed, False)
+            return BuildOutputResult(None, update_needed, message)
 
         warning = None
 
         try:
             warning = self._warnings_collector.process_line(line)
+            message = line
         except:
             pass
 
-        return BuildOutputResult(warning, False, True)
+        return BuildOutputResult(warning, False, message)
 
     def stop_resource_recording(self):
         if self._resources_started:
             self.resources.stop()
 
         self._resources_started = False
 
     def finish(self, record_usage=True):
@@ -661,20 +670,20 @@ class BuildOutputManager(OutputManager):
 
         # Ensure the resource monitor is stopped because leaving it running
         # could result in the process hanging on exit because the resource
         # collection child process hasn't been told to stop.
         self.monitor.stop_resource_recording()
 
 
     def on_line(self, line):
-        warning, state_changed, relevant = self.monitor.on_line(line)
+        warning, state_changed, message = self.monitor.on_line(line)
 
-        if relevant:
-            self.log(logging.INFO, 'build_output', {'line': line}, '{line}')
+        if message:
+            self.log(logging.INFO, 'build_output', {'line': message}, '{line}')
         elif state_changed:
             have_handler = hasattr(self, 'handler')
             if have_handler:
                 self.handler.acquire()
             try:
                 self.refresh()
             finally:
                 if have_handler: