Bug 1472490 - Make adding a source to SOURCES, UNIFIED_SOURCES, or HOST_SOURCES multiple times an error in moz.build. r=gps
authorChris Manchester <cmanchester@mozilla.com>
Fri, 13 Jul 2018 15:55:45 -0700
changeset 426593 b30d58d58f69
parent 426592 2f80a6085cbb
child 426594 3719d445438c
push id34276
push userncsoregi@mozilla.com
push dateSat, 14 Jul 2018 09:41:08 +0000
treeherdermozilla-central@04dd259d71db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1472490
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
python/mozbuild/mozbuild/frontend/emitter.py
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -844,17 +844,22 @@ class TreeMetadataEmitter(LoggingMixin):
         sources = defaultdict(list)
         gen_sources = defaultdict(list)
         pgo_generate_only = set()
         all_flags = {}
         for symbol in ('SOURCES', 'HOST_SOURCES', 'UNIFIED_SOURCES'):
             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)
                 else:
                     assert isinstance(f, Path)
                     gen_srcs.append(full_path)
                 if symbol == 'SOURCES':
                     flags = context_srcs[f]