Bug 1237140 - Add support for local defines in generate_symbols_file. r=gps

generate_symbols_file only supports the global defines, and completely
ignores DEFINES from the same moz.build the SYMBOLS_FILE is defined.
This fixes this misfeature.
This commit is contained in:
Mike Hommey 2016-01-19 10:38:52 +09:00
parent 5aba5600b3
commit ba8b3a8a41
2 changed files with 15 additions and 3 deletions

View File

@ -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'

View File

@ -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)