Bug 1287924 - Add a template for conditionally including moz.configure files. r=glandium

MozReview-Commit-ID: FyT7jLmTxvP
This commit is contained in:
Chris Manchester 2016-07-26 15:27:19 -07:00
Родитель 84564f1ce1
Коммит b7387e8701
3 изменённых файлов: 19 добавлений и 25 удалений

Просмотреть файл

@ -65,12 +65,10 @@ def extra_toolchain_flags(_):
# ==============================================================
@depends('--disable-compile-environment', build_project, gonkdir, '--help')
def android_ndk_include(compile_env, build_project, gonkdir, _):
if compile_env and (gonkdir or build_project in ('mobile/android', 'js')):
return 'android-ndk.configure'
include(android_ndk_include)
def compiling_android(compile_env, build_project, gonkdir, _):
return compile_env and (gonkdir or build_project in ('mobile/android', 'js'))
include_when('android-ndk.configure', when=compiling_android)
# MacOS deployment target version
# ==============================================================

Просмотреть файл

@ -214,3 +214,13 @@ def depends_when(*args, **kwargs):
return fn(*args)
return wrapper
return decorator
# Includes a file when the given condition evaluates to a truthy value.
@template
def include_when(filename, when):
# Assume, for now, our condition already depends on --help.
@depends(when, '--help')
def conditional_include(value, _):
if value:
return filename
include(conditional_include)

Просмотреть файл

@ -93,26 +93,12 @@ js_option('--enable-debug',
add_old_configure_assignment('MOZ_DEBUG',
depends('--enable-debug')(lambda v: bool(v)))
@depends('--disable-compile-environment', '--help')
def toolchain_include(compile_env, help):
if compile_env:
return 'build/moz.configure/toolchain.configure'
include(toolchain_include)
@depends('--disable-compile-environment', '--help')
def memory_include(compile_env, help):
if compile_env:
return 'build/moz.configure/memory.configure'
include(memory_include)
@depends('--disable-compile-environment', '--help')
def headers_check_include(compile_env, help):
if compile_env:
return 'build/moz.configure/headers.configure'
include(headers_check_include)
include_when('build/moz.configure/toolchain.configure',
when='--enable-compile-environment')
include_when('build/moz.configure/memory.configure',
when='--enable-compile-environment')
include_when('build/moz.configure/headers.configure',
when='--enable-compile-environment')
@depends('--help')
@imports(_from='mozbuild.backend', _import='backends')