зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1264527 - Remove wanted_mozconfig_variables. r=nalexander
While forgetting about it was warned about, having to add every new environment option to wanted_mozconfig_variables is cumbersome. It turns out there is a hackish way to make things work without that list, which, all things considered, is not worse than the hacks around the wanted_mozconfig_variables function, and are certainly an improvement as it doesn't require an ever growing list of environment options.
This commit is contained in:
Родитель
5728cb1467
Коммит
f9f9e3be56
|
@ -254,65 +254,10 @@ def 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',
|
||||
'AWK',
|
||||
'CC',
|
||||
'CCACHE',
|
||||
'CXX',
|
||||
'COMPILER_WRAPPER',
|
||||
'DISABLE_EXPORT_JS',
|
||||
'DISABLE_SHARED_JS',
|
||||
'DOXYGEN',
|
||||
'DSYMUTIL',
|
||||
'EXTERNAL_SOURCE_DIR',
|
||||
'GENISOIMAGE',
|
||||
'GRADLE',
|
||||
'GRADLE_FLAGS',
|
||||
'GRADLE_MAVEN_REPOSITORY',
|
||||
'HOST_CC',
|
||||
'HOST_CXX',
|
||||
'JS_STANDALONE',
|
||||
'L10NBASEDIR',
|
||||
'MOZILLABUILD',
|
||||
'MOZ_ARTIFACT_BUILDS',
|
||||
'MOZ_BUILD_APP',
|
||||
'MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE',
|
||||
'MOZ_CALLGRIND',
|
||||
'MOZ_DMD',
|
||||
'MOZ_FMP4',
|
||||
'MOZ_INSTRUMENT_EVENT_LOOP',
|
||||
'MOZ_INSTRUMENTS',
|
||||
'MOZ_JPROF',
|
||||
'MOZ_PROFILING',
|
||||
'MOZ_USE_SYSTRACE',
|
||||
'MOZ_VTUNE',
|
||||
'MOZTTDIR',
|
||||
'PERL',
|
||||
'RPMBUILD',
|
||||
'TAR',
|
||||
'TOOLCHAIN_PREFIX',
|
||||
'UNZIP',
|
||||
'USE_FC_FREETYPE',
|
||||
'WITHOUT_X',
|
||||
'XARGS',
|
||||
'YASM',
|
||||
'ZIP',
|
||||
])
|
||||
|
||||
|
||||
@depends(mozconfig, wanted_mozconfig_variables, '--help')
|
||||
@depends(mozconfig, '--help')
|
||||
# This gives access to the sandbox. Don't copy this blindly.
|
||||
@imports('__sandbox__')
|
||||
def mozconfig_options(mozconfig, wanted_mozconfig_variables, help):
|
||||
def mozconfig_options(mozconfig, help):
|
||||
if mozconfig['path']:
|
||||
helper = __sandbox__._helper
|
||||
log.info('Adding configure options from %s' % mozconfig['path'])
|
||||
|
@ -324,8 +269,7 @@ def mozconfig_options(mozconfig, wanted_mozconfig_variables, help):
|
|||
helper.add(arg, origin='mozconfig', args=helper._args)
|
||||
|
||||
def add(key, value):
|
||||
# See comment above wanted_mozconfig_variables
|
||||
if key in wanted_mozconfig_variables:
|
||||
if key.isupper():
|
||||
arg = '%s=%s' % (key, value)
|
||||
log.info(' %s' % arg)
|
||||
helper.add(arg, origin='mozconfig', args=helper._args)
|
||||
|
@ -335,7 +279,9 @@ def mozconfig_options(mozconfig, wanted_mozconfig_variables, help):
|
|||
for key, (_, value) in mozconfig['env']['modified'].iteritems():
|
||||
add(key, value)
|
||||
for key, value in mozconfig['vars']['added'].iteritems():
|
||||
add(key, value)
|
||||
# mozconfig_loader adds _IS_SET variables that are irrelevant
|
||||
if not key.endswith('_IS_SET'):
|
||||
add(key, value)
|
||||
for key, (_, value) in mozconfig['vars']['modified'].iteritems():
|
||||
add(key, value)
|
||||
|
||||
|
|
|
@ -58,26 +58,6 @@ def autoconf(mozconfig, autoconf):
|
|||
set_config('AUTOCONF', autoconf)
|
||||
|
||||
|
||||
# See comment in mozconfig_options() from build/moz.configure/init.configure
|
||||
@template
|
||||
# This gives access to the sandbox. Don't copy this blindly.
|
||||
@imports('__sandbox__')
|
||||
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 = __sandbox__._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):
|
||||
die('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, build_project)
|
||||
@imports(_from='__builtin__', _import='open')
|
||||
|
@ -466,3 +446,25 @@ def post_old_configure(raw_config):
|
|||
|
||||
set_old_configure_config('non_global_defines',
|
||||
raw_config['non_global_defines'])
|
||||
|
||||
|
||||
# Assuming no other option is declared after this function, handle the
|
||||
# env options that were injected by mozconfig_options by creating dummy
|
||||
# Option instances and having the sandbox's CommandLineHelper handle
|
||||
# them. We only do so for options that haven't been declared so far,
|
||||
# which should be a proxy for the options that old-configure handles
|
||||
# and that we don't know anything about.
|
||||
@depends('--help')
|
||||
@imports('__sandbox__')
|
||||
@imports(_from='mozbuild.configure.options', _import='Option')
|
||||
def remaining_mozconfig_options(_):
|
||||
helper = __sandbox__._helper
|
||||
for arg in helper:
|
||||
if helper._origins[arg] != 'mozconfig':
|
||||
continue
|
||||
name = arg.split('=', 1)[0]
|
||||
if name.isupper() and name not in __sandbox__._options:
|
||||
option = Option(env=name, nargs='*', help=name)
|
||||
helper.handle(option)
|
||||
|
||||
# Please do not add anything after remaining_mozconfig_options()
|
||||
|
|
|
@ -166,3 +166,4 @@ check_prog('RPMBUILD', delayed_getattr(extra_programs, 'RPMBUILD'),
|
|||
|
||||
# Fallthrough to autoconf-based configure
|
||||
include('build/moz.configure/old.configure')
|
||||
# Please do not add anything after the include of old.configure.
|
||||
|
|
Загрузка…
Ссылка в новой задаче