зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1256568 - Inject some variables set in mozconfig into moz.configure. r=gps
Because some of the existing mozconfigs may be setting some variables, we need to inject those that are handled by moz.configure now. It likely doesn't matter for the variables currently in moz.configure, but it will soon become important when more things are moved to moz.configure. In fact, it is necessary for GENISOIMAGE and DSYMUTIL that we're going to move in this bug, set in automation mozconfigs. The implementation is cumbersome and quite horrible. We could do better by changing the execution model in mozbuild.configure, which is probably necessary for other reasons as well, but that requires more work and testing.
This commit is contained in:
Родитель
84027af8da
Коммит
dedfa183e2
|
@ -222,8 +222,43 @@ def command_line_helper():
|
|||
return depends.__self__._helper
|
||||
|
||||
|
||||
@depends(mozconfig)
|
||||
def mozconfig_options(mozconfig):
|
||||
# All options defined above this point can't be injected in mozconfig_options
|
||||
# below, so collect them.
|
||||
@template
|
||||
@advanced
|
||||
def early_options():
|
||||
@depends('--help')
|
||||
def early_options(help):
|
||||
return set(
|
||||
option.env
|
||||
for option in depends.__self__._options.itervalues()
|
||||
if option.env
|
||||
)
|
||||
return early_options
|
||||
|
||||
early_options = early_options()
|
||||
|
||||
# At the moment, moz.configure doesn't have complete knowledge of all the
|
||||
# supported options in mozconfig because of all that is still in old.configure.
|
||||
# But we don't know all the options that moz.configure knows about until all
|
||||
# moz.configure files are executed, so we keep a manual list here, that is
|
||||
# checked in old.configure (we'll assume it's the last moz.configure file
|
||||
# processed). This is tedious but necessary for now.
|
||||
@depends('--help')
|
||||
def wanted_mozconfig_variables(help):
|
||||
return set([
|
||||
'AUTOCONF',
|
||||
'DISABLE_EXPORT_JS',
|
||||
'DISABLE_SHARED_JS',
|
||||
'EXTERNAL_SOURCE_DIR',
|
||||
'MOZILLABUILD',
|
||||
'MOZ_ARTIFACT_BUILDS',
|
||||
'MOZ_BUILD_APP',
|
||||
])
|
||||
|
||||
|
||||
@depends(mozconfig, wanted_mozconfig_variables)
|
||||
def mozconfig_options(mozconfig, wanted_mozconfig_variables):
|
||||
if mozconfig['path']:
|
||||
helper = command_line_helper()
|
||||
warn('Adding configure options from %s' % mozconfig['path'])
|
||||
|
@ -234,11 +269,22 @@ def mozconfig_options(mozconfig):
|
|||
# emulation that mozconfig provides.
|
||||
helper.add(arg, origin='mozconfig', args=helper._args)
|
||||
|
||||
# Ideally we'd handle mozconfig['env'] and mozconfig['vars'] here,
|
||||
# but at the moment, moz.configure has no knowledge of the options
|
||||
# that may appear there. We'll opt-in when we move things from
|
||||
# old-configure.in, which will be tedious but necessary until we
|
||||
# can discriminate what old-configure.in supports.
|
||||
def add(key, value):
|
||||
# See comment above wanted_mozconfig_variables
|
||||
if key in wanted_mozconfig_variables:
|
||||
arg = '%s=%s' % (key, value)
|
||||
warn(' %s' % arg)
|
||||
helper.add(arg, origin='mozconfig', args=helper._args)
|
||||
|
||||
for key, value in mozconfig['env']['added'].iteritems():
|
||||
add(key, value)
|
||||
for key, (_, value) in mozconfig['env']['modified'].iteritems():
|
||||
add(key, value)
|
||||
for key, value in mozconfig['vars']['added'].iteritems():
|
||||
add(key, value)
|
||||
for key, (_, value) in mozconfig['vars']['modified'].iteritems():
|
||||
add(key, value)
|
||||
|
||||
|
||||
del command_line_helper
|
||||
|
||||
|
|
|
@ -60,6 +60,26 @@ def autoconf(mozconfig, autoconf):
|
|||
return autoconf
|
||||
|
||||
|
||||
# See comment in mozconfig_options() from build/moz.configure/init.configure
|
||||
@template
|
||||
@advanced
|
||||
def check_mozconfig_variables():
|
||||
# This escapes the sandbox. Don't copy this. This is only here because it
|
||||
# is a one off until old-configure is gone.
|
||||
all_options = depends.__self__._options.itervalues()
|
||||
|
||||
@depends(early_options, wanted_mozconfig_variables)
|
||||
def check_mozconfig_variables(early_options, wanted_mozconfig_variables):
|
||||
for option in all_options:
|
||||
if (option.env and option.env not in early_options and
|
||||
option.env not in wanted_mozconfig_variables):
|
||||
error(
|
||||
'You need to add `%s` to the `wanted_mozconfig_variables` '
|
||||
'list in build/moz.configure/init.configure.' % option.env)
|
||||
|
||||
check_mozconfig_variables()
|
||||
|
||||
|
||||
@depends('OLD_CONFIGURE', mozconfig, autoconf, check_build_environment, shell,
|
||||
old_configure_assignments)
|
||||
@advanced
|
||||
|
|
Загрузка…
Ссылка в новой задаче