Bug 991983 - Use objdir-relative SOURCES instead of GENERATED_SOURCES. r=gps

This commit is contained in:
Mike Hommey 2015-05-19 17:41:09 +09:00
parent 2c863b9fe4
commit d03760e105
18 changed files with 88 additions and 123 deletions

View File

@ -6,14 +6,14 @@
GeckoSharedLibrary('AccessibleMarshal', linkage=None)
GENERATED_SOURCES += [
'dlldata.c',
'ISimpleDOMDocument_i.c',
'ISimpleDOMDocument_p.c',
'ISimpleDOMNode_i.c',
'ISimpleDOMNode_p.c',
'ISimpleDOMText_i.c',
'ISimpleDOMText_p.c',
SOURCES += [
'!dlldata.c',
'!ISimpleDOMDocument_i.c',
'!ISimpleDOMDocument_p.c',
'!ISimpleDOMNode_i.c',
'!ISimpleDOMNode_p.c',
'!ISimpleDOMText_i.c',
'!ISimpleDOMText_p.c',
]
DEFINES['REGISTER_PROXY_DLL'] = True

View File

@ -20,8 +20,8 @@ UNIFIED_SOURCES += [
'xpcAccessibleValue.cpp',
]
GENERATED_SOURCES += [
'xpcAccEvents.cpp',
SOURCES += [
'!xpcAccEvents.cpp',
]
LOCAL_INCLUDES += [

View File

@ -13,8 +13,8 @@ elif CONFIG['TARGET_CPU'].startswith('arm'):
else:
cpu = CONFIG['TARGET_CPU']
GENERATED_SOURCES += [
"%s.c" % cpu,
SOURCES += [
"!%s.c" % cpu,
]
NO_PGO = True

View File

@ -68,10 +68,8 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
]
if CONFIG['MOZ_ENABLE_QT']:
GENERATED_SOURCES += [
'moc_NestedLoopTimer.cpp',
]
SOURCES += [
'!moc_NestedLoopTimer.cpp',
'NestedLoopTimer.cpp',
'PluginHelperQt.cpp',
]

View File

@ -5,10 +5,8 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['MOZ_ENABLE_QT5GEOPOSITION']:
GENERATED_SOURCES += [
'moc_QTMLocationProvider.cpp',
]
SOURCES += [
'!moc_QTMLocationProvider.cpp',
'QTMLocationProvider.cpp',
]

View File

@ -202,11 +202,9 @@ if os_linux:
]
if CONFIG['MOZ_ENABLE_QT']:
SOURCES += [
'!moc_message_pump_qt.cc',
'src/base/message_pump_qt.cc',
]
GENERATED_SOURCES += [
'moc_message_pump_qt.cc',
]
if not CONFIG['MOZ_NATIVE_LIBEVENT']:
if CONFIG['OS_TARGET'] != 'Android':
SOURCES += [
@ -239,11 +237,9 @@ if os_bsd:
]
if CONFIG['MOZ_ENABLE_QT']:
SOURCES += [
'!moc_message_pump_qt.cc',
'src/base/message_pump_qt.cc',
]
GENERATED_SOURCES += [
'moc_message_pump_qt.cc',
]
if not CONFIG['MOZ_NATIVE_LIBEVENT']:
SOURCES += [
'src/third_party/libevent/kqueue.c',

View File

@ -55,14 +55,11 @@ if CONFIG['OS_ARCH'] == 'Linux':
]
SOURCES += [
'!IPDLUnitTests.cpp',
'IPDLUnitTestProcessChild.cpp',
'IPDLUnitTestSubprocess.cpp',
]
GENERATED_SOURCES += [
'IPDLUnitTests.cpp',
]
IPDL_SOURCES += [
'PTestActorPunning.ipdl',
'PTestActorPunningPunned.ipdl',

View File

@ -89,9 +89,9 @@ else:
if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_AS']:
SOURCES += celt_sources_arm
GENERATED_SOURCES += [ '%s.%s' % (f, CONFIG['ASM_SUFFIX']) for f in [
'celt_pitch_xcorr_arm-gnu',
]]
SOURCES += [
'!celt_pitch_xcorr_arm-gnu.%s' % CONFIG['ASM_SUFFIX']
]
# -Os is significantly slower, enable -O3 unless optimization is disabled
if CONFIG['MOZ_OPTIMIZE']:
CFLAGS += [

View File

@ -86,7 +86,7 @@ if CONFIG['GNU_AS']:
if CONFIG['OS_TARGET'] == 'Android':
DEFINES['__linux__'] = True
GENERATED_SOURCES += [ '%s.%s' % (f, CONFIG['ASM_SUFFIX']) for f in [
SOURCES += [ '!%s.%s' % (f, CONFIG['ASM_SUFFIX']) for f in [
'armbits-gnu',
'armfrag-gnu',
'armidct-gnu',

View File

@ -53,12 +53,11 @@ if CONFIG['VPX_ARM_ASM']:
arm_asm_files += files['ARM_ASM']
if CONFIG['VPX_AS_CONVERSION']:
GENERATED_SOURCES += [ "%s.%s" % (f, CONFIG['VPX_ASM_SUFFIX'])
for f in sorted(arm_asm_files) if f.endswith('.asm')
]
SOURCES += [
f for f in sorted(arm_asm_files) if not f.endswith('.asm')
]
SOURCES += sorted([
"!%s.%s" % (f, CONFIG['VPX_ASM_SUFFIX'])
if f.endswith('.asm') else f
for f in sorted(arm_asm_files)
])
else:
SOURCES += sorted(arm_asm_files)

View File

@ -5,14 +5,11 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
SOURCES += [
'!moc_nsQtNetworkManager.cpp',
'nsQtNetworkLinkService.cpp',
'nsQtNetworkManager.cpp',
]
GENERATED_SOURCES += [
'moc_nsQtNetworkManager.cpp',
]
FAIL_ON_WARNINGS = True
FINAL_LIBRARY = 'xul'

View File

@ -664,20 +664,13 @@ VARIABLES = {
populated by calling add_android_eclipse{_library}_project().
""", 'export'),
'SOURCES': (ContextDerivedTypedListWithItems(SourcePath, StrictOrderingOnAppendListWithFlagsFactory({'no_pgo': bool, 'flags': List})), list,
'SOURCES': (ContextDerivedTypedListWithItems(Path, StrictOrderingOnAppendListWithFlagsFactory({'no_pgo': bool, 'flags': List})), list,
"""Source code files.
This variable contains a list of source code files to compile.
Accepts assembler, C, C++, Objective C/C++.
""", None),
'GENERATED_SOURCES': (StrictOrderingOnAppendList, list,
"""Generated source code files.
This variable contains a list of generated source code files to
compile. Accepts assembler, C, C++, Objective C/C++.
""", None),
'FILES_PER_UNIFIED_FILE': (int, int,
"""The number of source files to compile into each unified source file.
@ -692,15 +685,6 @@ VARIABLES = {
size.
""", None),
'GENERATED_UNIFIED_SOURCES': (StrictOrderingOnAppendList, list,
"""Generated source code files that can be compiled together.
This variable contains a list of generated source code files to
compile, that can be concatenated all together, with UNIFIED_SOURCES,
and built as a single source file. This can help make the build faster
and reduce the debug info size.
""", None),
'GENERATED_FILES': (StrictOrderingOnAppendListWithFlagsFactory({
'script': unicode,
'inputs': list }), list,

View File

@ -78,6 +78,8 @@ from .reader import SandboxValidationError
from .context import (
Context,
ObjDirPath,
SourcePath,
SubContext,
TemplateContext,
)
@ -712,29 +714,33 @@ class TreeMetadataEmitter(LoggingMixin):
return sub
def _process_sources(self, context, passthru):
all_sources = {}
sources = defaultdict(list)
gen_sources = defaultdict(list)
all_flags = {}
for symbol in ('SOURCES', 'HOST_SOURCES', 'UNIFIED_SOURCES',
'GENERATED_SOURCES'):
srcs = all_sources[symbol] = []
for symbol in ('SOURCES', 'HOST_SOURCES', 'UNIFIED_SOURCES'):
srcs = sources[symbol]
gen_srcs = gen_sources[symbol]
context_srcs = context.get(symbol, [])
for f in context_srcs:
if symbol.startswith('GENERATED_'):
full_path = mozpath.normpath(
mozpath.join(context.objdir, f))
else:
full_path = f.full_path
if isinstance(f, SourcePath):
srcs.append(full_path)
else:
assert isinstance(f, ObjDirPath)
gen_srcs.append(full_path)
if symbol == 'SOURCES':
flags = context_srcs[f]
if flags:
all_flags[full_path] = flags
for symbol in ('SOURCES', 'HOST_SOURCES', 'UNIFIED_SOURCES'):
for src in all_sources[symbol]:
if not os.path.exists(src):
if isinstance(f, SourcePath) and not os.path.exists(full_path):
raise SandboxValidationError('File listed in %s does not '
'exist: \'%s\'' % (symbol, src), context)
'exist: \'%s\'' % (symbol, full_path), context)
# HOST_SOURCES and UNIFIED_SOURCES only take SourcePaths, so
# there should be no generated source in here
assert not gen_sources['HOST_SOURCES']
assert not gen_sources['UNIFIED_SOURCES']
no_pgo = context.get('NO_PGO')
no_pgo_sources = [f for f, flags in all_flags.iteritems()
@ -777,32 +783,33 @@ class TreeMetadataEmitter(LoggingMixin):
# kinds that can be listed therein.
all_suffixes = list(suffix_map.keys())
varmap = dict(
SOURCES=(Sources, all_suffixes),
HOST_SOURCES=(HostSources, ['.c', '.mm', '.cpp']),
UNIFIED_SOURCES=(UnifiedSources, ['.c', '.mm', '.cpp']),
GENERATED_SOURCES=(GeneratedSources, all_suffixes),
SOURCES=(Sources, GeneratedSources, all_suffixes),
HOST_SOURCES=(HostSources, None, ['.c', '.mm', '.cpp']),
UNIFIED_SOURCES=(UnifiedSources, None, ['.c', '.mm', '.cpp']),
)
for variable, (klass, suffixes) in varmap.items():
for variable, (klass, gen_klass, suffixes) in varmap.items():
allowed_suffixes = set().union(*[suffix_map[s] for s in suffixes])
# First ensure that we haven't been given filetypes that we don't
# recognize.
for f in all_sources[variable]:
for f in itertools.chain(sources[variable], gen_sources[variable]):
ext = mozpath.splitext(f)[1]
if ext not in allowed_suffixes:
raise SandboxValidationError(
'%s has an unknown file type.' % f, context)
for srcs, cls in ((sources[variable], klass),
(gen_sources[variable], gen_klass)):
# Now sort the files to let groupby work.
sorted_files = sorted(all_sources[variable],
key=canonical_suffix_for_file)
sorted_files = sorted(srcs, key=canonical_suffix_for_file)
for canonical_suffix, files in itertools.groupby(
sorted_files, canonical_suffix_for_file):
arglist = [context, list(files), canonical_suffix]
if variable.startswith('UNIFIED_') and 'FILES_PER_UNIFIED_FILE' in context:
if (variable.startswith('UNIFIED_') and
'FILES_PER_UNIFIED_FILE' in context):
arglist.append(context['FILES_PER_UNIFIED_FILE'])
yield klass(*arglist)
yield cls(*arglist)
for f, flags in all_flags.iteritems():
if flags.flags:

View File

@ -2,29 +2,29 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
GENERATED_SOURCES += [
'a.cpp',
'b.cc',
'c.cxx',
SOURCES += [
'!a.cpp',
'!b.cc',
'!c.cxx',
]
GENERATED_SOURCES += [
'd.c',
SOURCES += [
'!d.c',
]
GENERATED_SOURCES += [
'e.m',
SOURCES += [
'!e.m',
]
GENERATED_SOURCES += [
'f.mm',
SOURCES += [
'!f.mm',
]
GENERATED_SOURCES += [
'g.S',
SOURCES += [
'!g.S',
]
GENERATED_SOURCES += [
'h.s',
'i.asm',
SOURCES += [
'!h.s',
'!i.asm',
]

View File

@ -42,10 +42,8 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
EXPORTS += ['nsQAppInstance.h']
GENERATED_SOURCES += [
'moc_nsNativeAppSupportQt.cpp',
]
SOURCES += [
'!moc_nsNativeAppSupportQt.cpp',
'nsNativeAppSupportQt.cpp',
'nsQAppInstance.cpp',
]

View File

@ -11,21 +11,21 @@ generated = [
'SurfaceTexture',
]
GENERATED_SOURCES += [stem + '.cpp' for stem in generated]
SOURCES += ['!%s.cpp' % stem for stem in generated]
# We'd like to add these to a future GENERATED_EXPORTS list, but for now we mark
# them as generated here and manually install them in Makefile.in.
GENERATED_FILES += [stem + '.h' for stem in generated]
# There is an unfortunate race condition when using GENERATED_SOURCES and
# There is an unfortunate race condition when using generated SOURCES and
# pattern rules (see Makefile.in) that manifests itself as a VPATH resolution
# conflict: MediaCodec.o looks for MediaCodec.cpp and $(CURDIR)/MediaCodec.cpp,
# and the pattern rule is matched but doesn't resolve both sources, causing a
# failure. Adding the GENERATED_SOURCES to GENERATED_FILES causes the sources
# failure. Adding the SOURCES to GENERATED_FILES causes the sources
# to be built at export time, which is before MediaCodec.o needs them; and by
# the time MediaCodec.o is built, the source is in place and the VPATH
# resolution works as expected.
GENERATED_FILES += GENERATED_SOURCES
GENERATED_FILES += [f[1:] for f in SOURCES]
FAIL_ON_WARNINGS = True
FINAL_LIBRARY = 'xul'

View File

@ -4,12 +4,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
GENERATED_SOURCES += [
'moc_mozqwidget.cpp',
'moc_nsAppShell.cpp',
]
SOURCES += [
'!moc_mozqwidget.cpp',
'!moc_nsAppShell.cpp',
'mozqwidget.cpp',
'nsAppShell.cpp',
'nsBidiKeyboard.cpp',

View File

@ -11,11 +11,9 @@ if CONFIG['OS_ARCH'] == 'Darwin':
]
if CONFIG['OS_TEST'] == 'powerpc':
SOURCES += [
'!xptcstubs_asm_ppc_darwin.s',
'xptcinvoke_asm_ppc_rhapsody.s',
]
GENERATED_SOURCES += [
'xptcstubs_asm_ppc_darwin.s',
]
if '86' in CONFIG['OS_TEST'] and CONFIG['OS_TEST'] != 'x86_64':
DEFINES['MOZ_NEED_LEADING_UNDERSCORE'] = True
@ -179,15 +177,14 @@ if CONFIG['OS_ARCH'] == 'Linux':
if CONFIG['OS_ARCH'] == 'AIX':
if CONFIG['HAVE_64BIT_BUILD']:
SOURCES += [
'!xptcstubs_asm_ppc_aix64.s',
'xptcinvoke_asm_ppc_aix64.s',
'xptcinvoke_ppc_aix64.cpp',
'xptcstubs_ppc_aix64.cpp',
]
GENERATED_SOURCES += [
'xptcstubs_asm_ppc_aix64.s',
]
else:
SOURCES += [
'!xptcstubs_asm_ppc_aix.s',
'xptcinvoke_ppc_aix.cpp',
'xptcstubs_ppc_aix.cpp',
]
@ -199,9 +196,6 @@ if CONFIG['OS_ARCH'] == 'AIX':
SOURCES += [
'xptcinvoke_asm_ppc_aix.s',
]
GENERATED_SOURCES += [
'xptcstubs_asm_ppc_aix.s',
]
if CONFIG['OS_TEST'] == 'powerpc':
if CONFIG['OS_ARCH'] in ('Linux', 'FreeBSD'):