Bug 1360764 - Record warnings seen during the current operation; r=froydnj

Currently, the build monitor has a single compiler warnings database
that unions warnings from previous runs with warnings from the current
invocation. I want to introduce functionality that treats warnings
seen during the current invocation differently from "all warnings."
To facilitate this, this commit introduces a 2nd, non-persisted
warnings database to record warnings just for the current invocation.

MozReview-Commit-ID: FIY0GiarDmr

--HG--
extra : rebase_source : b2002e1c248ea65b2c0ee45a78b1e74d61a26f3c
This commit is contained in:
Gregory Szorc 2017-04-28 17:13:10 -07:00
Родитель 435febb8fc
Коммит f1c2887efb
2 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@ -58,6 +58,12 @@ class CompilerWarning(dict):
self['message'] = None
self['flag'] = None
def copy(self):
"""Returns a copy of this compiler warning."""
w = CompilerWarning()
w.update(self)
return w
# Since we inherit from dict, functools.total_ordering gets confused.
# Thus, we define a key function, a generic comparison, and then
# implement all the rich operators with those; approach is from:

Просмотреть файл

@ -172,6 +172,10 @@ class BuildMonitor(MozbuildObject):
except ValueError:
os.remove(warnings_path)
# Contains warnings unique to this invocation. Not populated with old
# warnings.
self.instance_warnings = WarningsDatabase()
def on_warning(warning):
filename = warning['filename']
@ -180,6 +184,8 @@ class BuildMonitor(MozbuildObject):
filename)
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)