diff --git a/python/mozbuild/mozbuild/action/generate_symbols_file.py b/python/mozbuild/mozbuild/action/generate_symbols_file.py index 9f76f9823e3f..ba1d562a9bc6 100644 --- a/python/mozbuild/mozbuild/action/generate_symbols_file.py +++ b/python/mozbuild/mozbuild/action/generate_symbols_file.py @@ -4,18 +4,30 @@ from __future__ import absolute_import, print_function, unicode_literals +import argparse import buildconfig import os from StringIO import StringIO from mozbuild.preprocessor import Preprocessor +from mozbuild.util import DefinesAction -def generate_symbols_file(output, input): +def generate_symbols_file(output, *args): ''' ''' - input = os.path.abspath(input) + parser = argparse.ArgumentParser() + parser.add_argument('input') + parser.add_argument('-D', action=DefinesAction) + parser.add_argument('-U', action='append', default=[]) + args = parser.parse_args(args) + input = os.path.abspath(args.input) pp = Preprocessor() pp.context.update(buildconfig.defines) + if args.D: + pp.context.update(args.D) + for undefine in args.U: + if undefine in pp.context: + del pp.context[undefine] # Hack until MOZ_DEBUG_FLAGS are simply part of buildconfig.defines if buildconfig.substs['MOZ_DEBUG']: pp.context['DEBUG'] = '1' diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py index ac364b3ed398..0c1e99562422 100644 --- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -538,7 +538,7 @@ class TreeMetadataEmitter(LoggingMixin): 'action', 'generate_symbols_file.py') yield GeneratedFile(context, script, 'generate_symbols_file', lib.symbols_file, - [symbols_file.full_path]) + [symbols_file.full_path], lib.defines.get_defines()) if static_lib: lib = StaticLibrary(context, libname, **static_args) self._libs[libname].append(lib)