Bug 1472490 - Make adding a source to SOURCES, UNIFIED_SOURCES, or HOST_SOURCES multiple times an error in moz.build. r=gps

MozReview-Commit-ID: FtPF3dxUxb5

--HG--
extra : rebase_source : ad380999c41830ea0f088bdacf5fc04c95783f04
This commit is contained in:
Chris Manchester 2018-07-13 15:55:45 -07:00
parent dbf1f2b689
commit d6b368dff1

View File

@ -849,7 +849,12 @@ class TreeMetadataEmitter(LoggingMixin):
srcs = sources[symbol]
gen_srcs = gen_sources[symbol]
context_srcs = context.get(symbol, [])
seen_sources = set()
for f in context_srcs:
if f in seen_sources:
raise SandboxValidationError('Source file should only '
'be added to %s once: %s' % (symbol, f), context)
seen_sources.add(f)
full_path = f.full_path
if isinstance(f, SourcePath):
srcs.append(full_path)