Bug 1415971 - Dedent warning printing code; r?build draft
authorGregory Szorc <gps@mozilla.com>
Thu, 09 Nov 2017 13:13:09 -0800
changeset 695817 f042b6c80e49e19d026cce01a631ea3c39b71302
parent 695816 e95a81496408cee83e5a23eab6fdd45617e239a5
child 695818 764f560625377ed30ed8442649a251f7691dc655
child 695845 b05459e523831dde972b2d797ca5aa77873bed1f
push id88551
push userbmo:gps@mozilla.com
push dateThu, 09 Nov 2017 21:57:20 +0000
reviewersbuild
bugs1415971
milestone58.0a1
Bug 1415971 - Dedent warning printing code; r?build This doesn't need to run when the context manager is active. MozReview-Commit-ID: DV3SZyUwxlM
python/mozbuild/mozbuild/controller/building.py
--- a/python/mozbuild/mozbuild/controller/building.py
+++ b/python/mozbuild/mozbuild/controller/building.py
@@ -1123,72 +1123,72 @@ class BuildDriver(MozbuildObject):
                         silent=not verbose, keep_going=keep_going)
 
                 self.log(logging.WARNING, 'warning_summary',
                     {'count': len(monitor.warnings_database)},
                     '{count} compiler warnings present.')
 
             monitor.finish(record_usage=status == 0)
 
-            # Print the collected compiler warnings. This is redundant with
-            # inline output from the compiler itself. However, unlike inline
-            # output, this list is sorted and grouped by file, making it
-            # easier to triage output.
-            #
-            # Only do this if we had a successful build. If the build failed,
-            # there are more important things in the log to look for than
-            # whatever code we warned about.
-            if not status:
-                # Suppress warnings for 3rd party projects in local builds
-                # until we suppress them for real.
-                # TODO remove entries/feature once we stop generating warnings
-                # in these directories.
-                pathToThirdparty = os.path.join(self.topsrcdir,
-                                                "tools",
-                                               "rewriting",
-                                               "ThirdPartyPaths.txt")
+        # Print the collected compiler warnings. This is redundant with
+        # inline output from the compiler itself. However, unlike inline
+        # output, this list is sorted and grouped by file, making it
+        # easier to triage output.
+        #
+        # Only do this if we had a successful build. If the build failed,
+        # there are more important things in the log to look for than
+        # whatever code we warned about.
+        if not status:
+            # Suppress warnings for 3rd party projects in local builds
+            # until we suppress them for real.
+            # TODO remove entries/feature once we stop generating warnings
+            # in these directories.
+            pathToThirdparty = os.path.join(self.topsrcdir,
+                                            "tools",
+                                           "rewriting",
+                                           "ThirdPartyPaths.txt")
 
-                if os.path.exists(pathToThirdparty):
-                    with open(pathToThirdparty) as f:
-                        # Normalize the path (no trailing /)
-                        LOCAL_SUPPRESS_DIRS = tuple(d.rstrip('/') for d in f.read().splitlines())
-                else:
-                    # For application based on gecko like thunderbird
-                    LOCAL_SUPPRESS_DIRS = ()
+            if os.path.exists(pathToThirdparty):
+                with open(pathToThirdparty) as f:
+                    # Normalize the path (no trailing /)
+                    LOCAL_SUPPRESS_DIRS = tuple(d.rstrip('/') for d in f.read().splitlines())
+            else:
+                # For application based on gecko like thunderbird
+                LOCAL_SUPPRESS_DIRS = ()
 
-                suppressed_by_dir = Counter()
+            suppressed_by_dir = Counter()
 
-                for warning in sorted(monitor.instance_warnings):
-                    path = mozpath.normsep(warning['filename'])
-                    if path.startswith(self.topsrcdir):
-                        path = path[len(self.topsrcdir) + 1:]
+            for warning in sorted(monitor.instance_warnings):
+                path = mozpath.normsep(warning['filename'])
+                if path.startswith(self.topsrcdir):
+                    path = path[len(self.topsrcdir) + 1:]
 
-                    warning['normpath'] = path
+                warning['normpath'] = path
 
-                    if (path.startswith(LOCAL_SUPPRESS_DIRS) and
-                            'MOZ_AUTOMATION' not in os.environ):
-                        for d in LOCAL_SUPPRESS_DIRS:
-                            if path.startswith(d):
-                                suppressed_by_dir[d] += 1
-                                break
+                if (path.startswith(LOCAL_SUPPRESS_DIRS) and
+                        'MOZ_AUTOMATION' not in os.environ):
+                    for d in LOCAL_SUPPRESS_DIRS:
+                        if path.startswith(d):
+                            suppressed_by_dir[d] += 1
+                            break
 
-                        continue
+                    continue
 
-                    if warning['column'] is not None:
-                        self.log(logging.WARNING, 'compiler_warning', warning,
-                                 'warning: {normpath}:{line}:{column} [{flag}] '
-                                 '{message}')
-                    else:
-                        self.log(logging.WARNING, 'compiler_warning', warning,
-                                 'warning: {normpath}:{line} [{flag}] {message}')
+                if warning['column'] is not None:
+                    self.log(logging.WARNING, 'compiler_warning', warning,
+                             'warning: {normpath}:{line}:{column} [{flag}] '
+                             '{message}')
+                else:
+                    self.log(logging.WARNING, 'compiler_warning', warning,
+                             'warning: {normpath}:{line} [{flag}] {message}')
 
-                for d, count in sorted(suppressed_by_dir.items()):
-                    self.log(logging.WARNING, 'suppressed_warning',
-                             {'dir': d, 'count': count},
-                             '(suppressed {count} warnings in {dir})')
+            for d, count in sorted(suppressed_by_dir.items()):
+                self.log(logging.WARNING, 'suppressed_warning',
+                         {'dir': d, 'count': count},
+                         '(suppressed {count} warnings in {dir})')
 
         high_finder, finder_percent = monitor.have_high_finder_usage()
         if high_finder:
             print(FINDER_SLOW_MESSAGE % finder_percent)
 
         ccache_end = monitor.ccache_stats()
 
         ccache_diff = None