import changes from `dev' branch of rmottola/Arctic-Fox:

- Bug 1235132 - Convert sqlite and nss to SYMBOLS_FILE. r=gps (6226ec1478)
- x Bug 1235132 - Remove _PR_* symbols from nss.symbols. r=gps (6f60da6bb0)
- Bug 1235132 - Remove convert_def_file.py. r=gps (6123f01415)
- Bug 1235132 - Remove whitespaces from sqlite.symbols. r=gps (e17095caec)
- Bug 1237140 - Pass NSS_EXTRA_SYMBOLS_FILE down to nss.symbols processing. r=gps (741a50896a)
- Bug 1233282 - Move mozilla-config.h's export to moz.build. r=gps (4b71f7a7ed)
- Bug 1241416 - Create a tier for things happening before export. r=gps (7e85cb7093)
- bump version (2e6b73a8d3)
- Bug 1246881 - Stop using config/buildid in few remaining places. r=mshal (6fb8bd6d52)
- var-let (b34ac5a287)
- Bug 1229330 - fix import, r=glandium (f566b08c72)
- Bug 1244997 - Remove TOOLKIT_EM_VERSION from toolkit/xre/Makefile.in. r=mshal (8d3d03b1a2)
- Bug 1246874 - Unify GRE_BUILDID and MOZ_APP_BUILDID at the build system level. r=mshal (d6aeacc605)
- Bug 1240657 - Fix FasterMake race condition leading to missing "manifest interfaces.manifest" entries. r=gps (410dd7df88)
- Bug 1242074 - Avoid going back and forth between FasterMake and RecursiveMake; r=gps (b298cc46db)
- Bug 1246871 - Generate platform.ini with the preprocessor instead of an ad-hoc script. r=mshal (8ff678ece4)
- Bug 1246881 - Generate a header defining MOZ_BUILDID. r=mshal (afc37d0ee2)
- Bug 1249441 - Remove topsrcdir!=objdir exemption for l10n builds. r=mshal (110204f03e)
- Bug 1220476 - Make --disable-compile-environment work for Android (89154229ce)
- Fixup for b2g bustage from bug 1164921. r=me (06cb06fbb5)
- Bug 1243861 - Specify SSE_FLAGS and SSE2_FLAGS when compiling with MSVC; r=glandium (b6df32a59e)
- Bug 1222578 - remove workaround for clang-cl not understanding -arch:IA32; r=glandium (fcf84ff832)
- Bug 1245013 - Move CMFLAGS/CMMFLAGS from config.mk to configure. r=mshal (89e9505913)
- Bug 1245422 - Remove -UDEBUG -DNDEBUG flags on Windows opt builds. r=mshal (e95c822055)
- Bug 1245422 - Remove MOZ_OPTIMIZE_FLAGS override when building with DMD enabled on Windows. r=mshal (9f5b60b58f)
- Bug 1245763 - Group sources and linkables handling function cals in mozbuild.emitter. r=gps (f2c37381e4)
- Bug 852931 - cmd+click jumps to function defintion in the debugger. r=jlongster (123996737e)
- Bug 1216217 - Make selecting a worker from the debugger's worker list work;r=jlongster (436cbc6c91)
- Bug 1218586 - use \u0020 instead of backspace protected whitespace in watchExpressionsSeparatorLabel to suppress warning from compare-locales. r=jryans (f245032c52)
- Bug 1084430 - fix styling of <return> and <exception> in variable view; r=vporof (072785ca68)
- Bug 1245763 - Move the _handle_programs and _process_sources around. r=gps (482391dddc)
- Bug 1245763 - Don't emit Sources objects when there is no Linkable in the same directory. r=gps (9b39ebf589)
- Bug 1245764 - Move Windows RTL flags (-MD/-MT) flags out of config.mk. r=gps (a04616505e)
This commit is contained in:
2023-10-02 10:42:06 +08:00
parent 4670d0edfa
commit b4d32ea807
67 changed files with 1352 additions and 794 deletions
+2 -2
View File
@@ -2,7 +2,7 @@
# 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/.
from __future__ import print_function, unicode_literals
from __future__ import absolute_import, print_function, unicode_literals
from mach.decorators import (
CommandArgument,
@@ -14,7 +14,7 @@ from mozbuild.base import (
MachCommandBase,
)
import mozpack
import mozpack.path as mozpath
MERGE_HELP = '''Directory to merge to. Will be removed to before running
@@ -1,112 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.
# Convert Windows-style export files into a single Unix-style linker
# script, applying any necessary preprocessing.
from __future__ import absolute_import
import itertools
import re
import sys
from StringIO import StringIO
from mozbuild.preprocessor import Preprocessor
from mozbuild.util import FileAvoidWrite
def preprocess_file(pp, deffile):
pp.out = StringIO()
with open(deffile, 'rU') as input:
pp.do_include(input, False)
return pp.out.getvalue().splitlines()
# NSS .def files serve multiple masters, as this copied comment indicates:
#
# OK, this file is meant to support SUN, LINUX, AIX and WINDOWS
# 1. For all unix platforms, the string ";-" means "remove this line"
# 2. For all unix platforms, the string " DATA " will be removed from any
# line on which it occurs.
# 3. Lines containing ";+" will have ";+" removed on SUN and LINUX.
# On AIX, lines containing ";+" will be removed.
# 4. For all unix platforms, the string ";;" will have the ";;" removed.
# 5. For all unix platforms, after the above processing has taken place,
# all characters after the first ";" on the line will be removed.
# And for AIX, the first ";" will also be removed.
# This file is passed directly to windows. Since ';' is a comment, all UNIX
# directives are hidden behind ";", ";+", and ";-"
#
# We don't care about rule 1, as that mainly serves to eliminate LIBRARY
# and EXPORTS lines. Our symbol extraction routines handle DATA, so we
# don't need to bother with rule 2. We don't want to enforce rule 3, as
# we know how to eliminate comments. ';+' also tends to hide Unix
# linker-script specific things, which we don't want to deal with here.
# Rule 5 is also unnecessary; later comment-aware processing will deal
# with that.
#
# We need to handle rule 4, since ';;' often hides things marked with DATA.
def nss_preprocess_file(deffile):
with open(deffile, 'r') as input:
for line in input:
yield line.replace(';;', '')
COMMENT = re.compile(';.*')
def extract_symbols(lines):
# Filter comments.
nocomments = iter(COMMENT.sub('', s).strip() for s in lines)
lines = iter(s for s in nocomments if len(s))
exports = itertools.dropwhile(lambda s: 'EXPORTS' not in s, lines)
symbols = set()
for line in exports:
if 'EXPORTS' in line:
# Handle the case where symbols are specified along with EXPORT.
fields = line.split()[1:]
if len(fields) == 0:
continue
else:
fields = line.split()
# We don't support aliases, and we only support the DATA keyword on
# symbols. But since aliases can also be specified as 'SYM=ALIAS'
# with no whitespace, we need extra checks on the original symbol.
if '=' in fields[0]:
raise BaseException, 'aliases are not supported (%s)' % line
if len(fields) == 1:
pass
elif len(fields) != 2 or fields[1] != 'DATA':
raise BaseException, 'aliases and keywords other than DATA are not supported (%s)' % line
symbols.add(fields[0])
return symbols
def main(args):
pp = Preprocessor()
optparser = pp.getCommandLineParser()
optparser.add_option('--nss-file', action='append',
type='string', dest='nss_files', default=[],
help='Specify a .def file that should have NSS\'s processing rules applied to it')
options, deffiles = optparser.parse_args(args)
symbols = set()
for f in options.nss_files:
symbols |= extract_symbols(nss_preprocess_file(f))
for f in deffiles:
# Start each deffile off with a clean slate.
defpp = pp.clone()
symbols |= extract_symbols(preprocess_file(defpp, f))
script = """{
global:
%s
local:
*;
};
"""
with FileAvoidWrite(options.output) as f:
f.write(script % '\n '.join("%s;" % s for s in sorted(symbols)))
if __name__ == '__main__':
main(sys.argv[1:])
+160 -139
View File
@@ -371,7 +371,39 @@ class TreeMetadataEmitter(LoggingMixin):
else:
return ExternalSharedLibrary(context, name)
def _handle_libraries(self, context):
def _handle_linkables(self, context, passthru):
has_linkables = False
for kind, cls in [('PROGRAM', Program), ('HOST_PROGRAM', HostProgram)]:
program = context.get(kind)
if program:
if program in self._binaries:
raise SandboxValidationError(
'Cannot use "%s" as %s name, '
'because it is already used in %s' % (program, kind,
self._binaries[program].relativedir), context)
self._binaries[program] = cls(context, program)
self._linkage.append((context, self._binaries[program],
kind.replace('PROGRAM', 'USE_LIBS')))
has_linkables = True
for kind, cls in [
('SIMPLE_PROGRAMS', SimpleProgram),
('CPP_UNIT_TESTS', SimpleProgram),
('HOST_SIMPLE_PROGRAMS', HostSimpleProgram)]:
for program in context[kind]:
if program in self._binaries:
raise SandboxValidationError(
'Cannot use "%s" in %s, '
'because it is already used in %s' % (program, kind,
self._binaries[program].relativedir), context)
self._binaries[program] = cls(context, program,
is_unit_test=kind == 'CPP_UNIT_TESTS')
self._linkage.append((context, self._binaries[program],
'HOST_USE_LIBS' if kind == 'HOST_SIMPLE_PROGRAMS'
else 'USE_LIBS'))
has_linkables = True
host_libname = context.get('HOST_LIBRARY_NAME')
libname = context.get('LIBRARY_NAME')
@@ -382,6 +414,7 @@ class TreeMetadataEmitter(LoggingMixin):
lib = HostLibrary(context, host_libname)
self._libs[host_libname].append(lib)
self._linkage.append((context, lib, 'HOST_USE_LIBS'))
has_linkables = True
final_lib = context.get('FINAL_LIBRARY')
if not libname and final_lib:
@@ -528,6 +561,7 @@ class TreeMetadataEmitter(LoggingMixin):
lib = SharedLibrary(context, libname, **shared_args)
self._libs[libname].append(lib)
self._linkage.append((context, lib, 'USE_LIBS'))
has_linkables = True
if is_component and not context['NO_COMPONENTS_MANIFEST']:
yield ChromeManifestEntry(context,
'components/components.manifest',
@@ -543,6 +577,7 @@ class TreeMetadataEmitter(LoggingMixin):
lib = StaticLibrary(context, libname, **static_args)
self._libs[libname].append(lib)
self._linkage.append((context, lib, 'USE_LIBS'))
has_linkables = True
if lib_defines:
if not libname:
@@ -550,6 +585,115 @@ class TreeMetadataEmitter(LoggingMixin):
'LIBRARY_NAME to take effect', context)
lib.lib_defines.update(lib_defines)
# Only emit sources if we have linkables defined in the same context.
# Note the linkables are not emitted in this function, but much later,
# after aggregation (because of e.g. USE_LIBS processing).
if not has_linkables:
return
sources = defaultdict(list)
gen_sources = defaultdict(list)
all_flags = {}
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:
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]
if flags:
all_flags[full_path] = flags
if isinstance(f, SourcePath) and not os.path.exists(full_path):
raise SandboxValidationError('File listed in %s does not '
'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()
if flags.no_pgo]
if no_pgo:
if no_pgo_sources:
raise SandboxValidationError('NO_PGO and SOURCES[...].no_pgo '
'cannot be set at the same time', context)
passthru.variables['NO_PROFILE_GUIDED_OPTIMIZE'] = no_pgo
if no_pgo_sources:
passthru.variables['NO_PROFILE_GUIDED_OPTIMIZE'] = no_pgo_sources
# A map from "canonical suffixes" for a particular source file
# language to the range of suffixes associated with that language.
#
# We deliberately don't list the canonical suffix in the suffix list
# in the definition; we'll add it in programmatically after defining
# things.
suffix_map = {
'.s': set(['.asm']),
'.c': set(),
'.m': set(),
'.mm': set(),
'.cpp': set(['.cc', '.cxx']),
'.rs': set(),
'.S': set(),
}
# The inverse of the above, mapping suffixes to their canonical suffix.
canonicalized_suffix_map = {}
for suffix, alternatives in suffix_map.iteritems():
alternatives.add(suffix)
for a in alternatives:
canonicalized_suffix_map[a] = suffix
def canonical_suffix_for_file(f):
return canonicalized_suffix_map[mozpath.splitext(f)[1]]
# A map from moz.build variables to the canonical suffixes of file
# kinds that can be listed therein.
all_suffixes = list(suffix_map.keys())
varmap = dict(
SOURCES=(Sources, GeneratedSources, all_suffixes),
HOST_SOURCES=(HostSources, None, ['.c', '.mm', '.cpp']),
UNIFIED_SOURCES=(UnifiedSources, None, ['.c', '.mm', '.cpp']),
)
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 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(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):
arglist.append(context['FILES_PER_UNIFIED_FILE'])
yield cls(*arglist)
for f, flags in all_flags.iteritems():
if flags.flags:
ext = mozpath.splitext(f)[1]
yield PerSourceFlag(context, f, flags.flags)
def emit_from_context(self, context):
"""Convert a Context to tree metadata objects.
@@ -585,7 +729,6 @@ class TreeMetadataEmitter(LoggingMixin):
'ANDROID_GENERATED_RESFILES',
'DISABLE_STL_WRAPPING',
'EXTRA_DSO_LDOPTS',
'USE_STATIC_LIBS',
'PYTHON_UNIT_TESTS',
'RCFILE',
'RESFILE',
@@ -625,8 +768,20 @@ class TreeMetadataEmitter(LoggingMixin):
elif dist_install is False:
passthru.variables['NO_DIST_INSTALL'] = True
for obj in self._process_sources(context, passthru):
yield obj
# Ideally, this should be done in templates, but this is difficult at
# the moment because USE_STATIC_LIBS can be set after a template
# returns. Eventually, with context-based templates, it will be
# possible.
if (context.config.substs.get('OS_ARCH') == 'WINNT' and
not context.config.substs.get('GNU_CC')):
use_static_lib = (context.get('USE_STATIC_LIBS') and
not context.config.substs.get('MOZ_ASAN'))
rtl_flag = '-MT' if use_static_lib else '-MD'
if (context.config.substs.get('MOZ_DEBUG') and
not context.config.substs.get('MOZ_NO_DEBUG_RTL')):
rtl_flag += 'd'
# Use a list, like MOZBUILD_*FLAGS variables
passthru.variables['RTL_FLAGS'] = [rtl_flag]
generated_files = set()
for obj in self._process_generated_files(context):
@@ -644,8 +799,6 @@ class TreeMetadataEmitter(LoggingMixin):
if host_defines:
yield HostDefines(context, host_defines)
self._handle_programs(context)
simple_lists = [
('GENERATED_EVENTS_WEBIDL_FILES', GeneratedEventWebIDLFile),
('GENERATED_WEBIDL_FILES', GeneratedWebIDLFile),
@@ -745,7 +898,7 @@ class TreeMetadataEmitter(LoggingMixin):
Manifest('components',
mozpath.basename(c)))
for obj in self._handle_libraries(context):
for obj in self._handle_linkables(context, passthru):
yield obj
for obj in self._process_test_manifests(context):
@@ -789,108 +942,6 @@ class TreeMetadataEmitter(LoggingMixin):
return sub
def _process_sources(self, context, passthru):
sources = defaultdict(list)
gen_sources = defaultdict(list)
all_flags = {}
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:
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]
if flags:
all_flags[full_path] = flags
if isinstance(f, SourcePath) and not os.path.exists(full_path):
raise SandboxValidationError('File listed in %s does not '
'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()
if flags.no_pgo]
if no_pgo:
if no_pgo_sources:
raise SandboxValidationError('NO_PGO and SOURCES[...].no_pgo '
'cannot be set at the same time', context)
passthru.variables['NO_PROFILE_GUIDED_OPTIMIZE'] = no_pgo
if no_pgo_sources:
passthru.variables['NO_PROFILE_GUIDED_OPTIMIZE'] = no_pgo_sources
# A map from "canonical suffixes" for a particular source file
# language to the range of suffixes associated with that language.
#
# We deliberately don't list the canonical suffix in the suffix list
# in the definition; we'll add it in programmatically after defining
# things.
suffix_map = {
'.s': set(['.asm']),
'.c': set(),
'.m': set(),
'.mm': set(),
'.cpp': set(['.cc', '.cxx']),
'.S': set(),
}
# The inverse of the above, mapping suffixes to their canonical suffix.
canonicalized_suffix_map = {}
for suffix, alternatives in suffix_map.iteritems():
alternatives.add(suffix)
for a in alternatives:
canonicalized_suffix_map[a] = suffix
def canonical_suffix_for_file(f):
return canonicalized_suffix_map[mozpath.splitext(f)[1]]
# A map from moz.build variables to the canonical suffixes of file
# kinds that can be listed therein.
all_suffixes = list(suffix_map.keys())
varmap = dict(
SOURCES=(Sources, GeneratedSources, all_suffixes),
HOST_SOURCES=(HostSources, None, ['.c', '.mm', '.cpp']),
UNIFIED_SOURCES=(UnifiedSources, None, ['.c', '.mm', '.cpp']),
)
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 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(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):
arglist.append(context['FILES_PER_UNIFIED_FILE'])
yield cls(*arglist)
for f, flags in all_flags.iteritems():
if flags.flags:
ext = mozpath.splitext(f)[1]
yield PerSourceFlag(context, f, flags.flags)
def _process_xpidl(self, context):
# XPIDL source files get processed and turned into .h and .xpt files.
# If there are multiple XPIDL files in a directory, they get linked
@@ -1003,37 +1054,7 @@ class TreeMetadataEmitter(LoggingMixin):
yield TestHarnessFiles(context, srcdir_files,
srcdir_pattern_files, objdir_files)
def _handle_programs(self, context):
for kind, cls in [('PROGRAM', Program), ('HOST_PROGRAM', HostProgram)]:
program = context.get(kind)
if program:
if program in self._binaries:
raise SandboxValidationError(
'Cannot use "%s" as %s name, '
'because it is already used in %s' % (program, kind,
self._binaries[program].relativedir), context)
self._binaries[program] = cls(context, program)
self._linkage.append((context, self._binaries[program],
kind.replace('PROGRAM', 'USE_LIBS')))
for kind, cls in [
('SIMPLE_PROGRAMS', SimpleProgram),
('CPP_UNIT_TESTS', SimpleProgram),
('HOST_SIMPLE_PROGRAMS', HostSimpleProgram)]:
for program in context[kind]:
if program in self._binaries:
raise SandboxValidationError(
'Cannot use "%s" in %s, '
'because it is already used in %s' % (program, kind,
self._binaries[program].relativedir), context)
self._binaries[program] = cls(context, program,
is_unit_test=kind == 'CPP_UNIT_TESTS')
self._linkage.append((context, self._binaries[program],
'HOST_USE_LIBS' if kind == 'HOST_SIMPLE_PROGRAMS'
else 'USE_LIBS'))
def _process_test_manifests(self, context):
for prefix, info in TEST_MANIFESTS.items():
for path in context.get('%s_MANIFESTS' % prefix, []):
for obj in self._process_test_manifest(context, info, path):
@@ -51,6 +51,14 @@ CONFIGS = defaultdict(lambda: {
('LIB_SUFFIX', 'a'),
],
},
'sources': {
'defines': [],
'non_global_defines': [],
'substs': [
('LIB_PREFIX', 'lib'),
('LIB_SUFFIX', 'a'),
],
},
'stub0': {
'defines': [
('MOZ_TRUE_1', '1'),
@@ -2,6 +2,13 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
@template
def Library(name):
'''Template for libraries.'''
LIBRARY_NAME = name
Library('dummy')
SOURCES += ['bar.s', 'foo.asm']
HOST_SOURCES += ['bar.cpp', 'foo.cpp']
@@ -11,8 +11,6 @@ RESFILE = 'bar.res'
RCINCLUDE = 'bar.rc'
DEFFILE = 'baz.def'
USE_STATIC_LIBS = True
CFLAGS += ['-fno-exceptions', '-w']
CXXFLAGS += ['-fcxx-exceptions', '-option with spaces']
LDFLAGS += ['-ld flag with spaces', '-x']
@@ -292,9 +292,6 @@ class TestRecursiveMakeBackend(BackendTester):
'DEFFILE': [
'DEFFILE := baz.def',
],
'USE_STATIC_LIBS': [
'USE_STATIC_LIBS := 1',
],
'MOZBUILD_CFLAGS': [
'MOZBUILD_CFLAGS += -fno-exceptions',
'MOZBUILD_CFLAGS += -w',
@@ -2,6 +2,13 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
@template
def Library(name):
'''Template for libraries.'''
LIBRARY_NAME = name
Library('dummy')
SOURCES += [
'!a.cpp',
'!b.cc',
@@ -2,6 +2,13 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
@template
def HostLibrary(name):
'''Template for libraries.'''
HOST_LIBRARY_NAME = name
HostLibrary('dummy')
HOST_SOURCES += [
'a.cpp',
'b.cc',
@@ -2,6 +2,13 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
@template
def Library(name):
'''Template for libraries.'''
LIBRARY_NAME = name
Library('dummy')
SOURCES += [
'a.cpp',
'b.cc',
@@ -2,6 +2,13 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
@template
def Library(name):
'''Template for libraries.'''
LIBRARY_NAME = name
Library('dummy')
UNIFIED_SOURCES += [
'bar.cxx',
'foo.cpp',
@@ -2,6 +2,13 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
@template
def Library(name):
'''Template for libraries.'''
LIBRARY_NAME = name
Library('dummy')
UNIFIED_SOURCES += [
'bar.cxx',
'foo.cpp',
@@ -13,8 +13,6 @@ RESFILE = 'bar.res'
RCINCLUDE = 'bar.rc'
DEFFILE = 'baz.def'
USE_STATIC_LIBS = True
CFLAGS += ['-fno-exceptions', '-w']
CXXFLAGS += ['-fcxx-exceptions', '-include foo.h']
LDFLAGS += ['-framework Foo', '-x']
@@ -179,7 +179,6 @@ class TestEmitterBasic(unittest.TestCase):
'RESFILE': 'bar.res',
'RCINCLUDE': 'bar.rc',
'DEFFILE': 'baz.def',
'USE_STATIC_LIBS': True,
'MOZBUILD_CFLAGS': ['-fno-exceptions', '-w'],
'MOZBUILD_CXXFLAGS': ['-fcxx-exceptions', '-include foo.h'],
'MOZBUILD_LDFLAGS': ['-framework Foo', '-x', '-DELAYLOAD:foo.dll',
@@ -741,6 +740,8 @@ class TestEmitterBasic(unittest.TestCase):
reader = self.reader('sources')
objs = self.read_topsrcdir(reader)
# The last object is a Linkable, ignore it
objs = objs[:-1]
self.assertEqual(len(objs), 6)
for o in objs:
self.assertIsInstance(o, Sources)
@@ -767,6 +768,8 @@ class TestEmitterBasic(unittest.TestCase):
reader = self.reader('generated-sources')
objs = self.read_topsrcdir(reader)
# The last object is a Linkable, ignore it
objs = objs[:-1]
self.assertEqual(len(objs), 6)
generated_sources = [o for o in objs if isinstance(o, GeneratedSources)]
@@ -794,6 +797,8 @@ class TestEmitterBasic(unittest.TestCase):
reader = self.reader('host-sources')
objs = self.read_topsrcdir(reader)
# The last object is a Linkable, ignore it
objs = objs[:-1]
self.assertEqual(len(objs), 3)
for o in objs:
self.assertIsInstance(o, HostSources)
@@ -817,6 +822,8 @@ class TestEmitterBasic(unittest.TestCase):
reader = self.reader('unified-sources')
objs = self.read_topsrcdir(reader)
# The last object is a Linkable, ignore it
objs = objs[:-1]
self.assertEqual(len(objs), 3)
for o in objs:
self.assertIsInstance(o, UnifiedSources)
@@ -841,6 +848,8 @@ class TestEmitterBasic(unittest.TestCase):
reader = self.reader('unified-sources-non-unified')
objs = self.read_topsrcdir(reader)
# The last object is a Linkable, ignore it
objs = objs[:-1]
self.assertEqual(len(objs), 3)
for o in objs:
self.assertIsInstance(o, UnifiedSources)