Bug 1319345 - Add flags to GENERATED_FILES. r?mshal
--- a/python/mozbuild/mozbuild/frontend/context.py
+++ b/python/mozbuild/mozbuild/frontend/context.py
@@ -958,23 +958,25 @@ VARIABLES = {
This variable contains a list of source code files to compile,
that can be concatenated all together and built as a single source
file. This can help make the build faster and reduce the debug info
size.
"""),
'GENERATED_FILES': (StrictOrderingOnAppendListWithFlagsFactory({
'script': unicode,
- 'inputs': list }), list,
+ 'inputs': list,
+ 'flags': list, }), list,
"""Generic generated files.
This variable contains a list of files for the build system to
generate at export time. The generation method may be declared
- with optional ``script`` and ``inputs`` flags on individual entries.
- If the optional ``script`` flag is not present on an entry, it
+ with optional ``script``, ``inputs`` and ``flags`` attributes on
+ individual entries.
+ If the optional ``script`` attribute is not present on an entry, it
is assumed that rules for generating the file are present in
the associated Makefile.in.
Example::
GENERATED_FILES += ['bar.c', 'baz.c', 'foo.c']
bar = GENERATED_FILES['bar.c']
bar.script = 'generate.py'
@@ -998,16 +1000,19 @@ VARIABLES = {
into ``script`` can be specified::
GENERATED_FILES += ['bar.c']
bar = GENERATED_FILES['bar.c']
bar.script = 'generate.py:make_bar'
The chosen script entry point may optionally return a set of strings,
indicating extra files the output depends on.
+
+ When the ``flags`` attribute is present, the given list of flags is
+ passed as extra arguments following the inputs.
"""),
'DEFINES': (InitializedDefines, dict,
"""Dictionary of compiler defines to declare.
These are passed in to the compiler as ``-Dkey='value'`` for string
values, ``-Dkey=value`` for numeric values, or ``-Dkey`` if the
value is True. Note that for string values, the outer-level of
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -1237,17 +1237,18 @@ class TreeMetadataEmitter(LoggingMixin):
not os.path.exists(p.full_path)):
raise SandboxValidationError(
'Input for generating %s does not exist: %s'
% (f, p.full_path), context)
inputs.append(p)
else:
script = None
method = None
- yield GeneratedFile(context, script, method, outputs, inputs)
+ yield GeneratedFile(context, script, method, outputs, inputs,
+ flags.flags)
def _process_test_manifests(self, context):
for prefix, info in TEST_MANIFESTS.items():
for path, manifest in context.get('%s_MANIFESTS' % prefix, []):
for obj in self._process_test_manifest(context, info, path, manifest):
yield obj
for flavor in REFTEST_FLAVORS: