# HG changeset patch
# User Chris Manchester <cmanchester@mozilla.com>
# Date 1524122217 25200
# Node ID 9c246c15f12a2eb0ed20188b2c8c504baf5f1aec
# Parent  573a198b7fdf076e27eb1f468162df101246d7b3
Bug 1449965 - Output directories during the build as we compile object files. r=ted

MozReview-Commit-ID: K4RrObGHXIC

diff --git a/config/rules.mk b/config/rules.mk
--- 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
diff --git a/python/mozbuild/mozbuild/controller/building.py b/python/mozbuild/mozbuild/controller/building.py
--- 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:

