Bug 1296530 - Replace include_when with include, and remove include_when. r?chmanchester draft
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 13 Oct 2016 17:15:24 +0900
changeset 425041 1572d1ca4787888a74175dc135ff45935d10575d
parent 425040 753c1e3022c343e4988e6b773d457c5709451fef
child 533826 c6f272a5b313a01617ea099cd6fa5db40c21f0d4
push id32321
push userbmo:mh+mozilla@glandium.org
push dateFri, 14 Oct 2016 02:53:47 +0000
reviewerschmanchester
bugs1296530
milestone52.0a1
Bug 1296530 - Replace include_when with include, and remove include_when. r?chmanchester
build/moz.configure/compilers-util.configure
build/moz.configure/toolchain.configure
build/moz.configure/util.configure
js/moz.configure
moz.configure
--- a/build/moz.configure/compilers-util.configure
+++ b/build/moz.configure/compilers-util.configure
@@ -42,17 +42,17 @@ def compiler_class(compiler):
             else:
                 def checking_fn(fn):
                     return fn
 
             @depends_when(self, dependable(flags), extra_toolchain_flags, when=when)
             @checking_fn
             def func(compiler, flags, extra_flags):
                 flags = flags or []
-                flags += extra_flags
+                flags += extra_flags or []
                 flags.append('-c')
 
                 if try_invoke_compiler(
                     compiler.wrapper + [compiler.compiler] + compiler.flags,
                     compiler.language, source, flags,
                     onerror=onerror) is not None:
                     return True
 
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -57,30 +57,24 @@ set_config('YASM_ASFLAGS', yasm_asflags)
 def have_yasm(value):
     if value:
         return True
 
 set_config('HAVE_YASM', have_yasm)
 # Until the YASM variable is not necessary in old-configure.
 add_old_configure_assignment('YASM', have_yasm)
 
-@dependable
-def extra_toolchain_flags():
-    # This value will be overriden for android builds, where
-    # extra flags are required to do basic checks.
-    return []
-
 # Android NDK
 # ==============================================================
 
 @depends('--disable-compile-environment', build_project, gonkdir, '--help')
 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)
+include('android-ndk.configure', when=compiling_android)
 
 # MacOS deployment target version
 # ==============================================================
 # This needs to happen before any compilation test is done.
 
 option('--enable-macos-target', env='MACOSX_DEPLOYMENT_TARGET', nargs=1,
        default='10.7', help='Set the minimum MacOS version needed at runtime')
 
--- a/build/moz.configure/util.configure
+++ b/build/moz.configure/util.configure
@@ -400,18 +400,8 @@ def depends_when(*args, **kwargs):
 
     def decorator(fn):
         @depends(when, *args)
         def wrapper(val, *args):
             if val:
                 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)
--- a/js/moz.configure
+++ b/js/moz.configure
@@ -230,9 +230,9 @@ def js_has_ctypes(ctypes, js):
 set_config('JS_HAS_CTYPES', js_has_ctypes)
 set_define('JS_HAS_CTYPES', js_has_ctypes)
 add_old_configure_assignment('JS_HAS_CTYPES', js_has_ctypes)
 
 @depends('--enable-ctypes', '--enable-compile-environment', '--help')
 def ctypes_and_compile_environment(ctypes, compile_environment, _):
     return ctypes and compile_environment
 
-include_when('ffi.configure', when=ctypes_and_compile_environment)
+include('ffi.configure', when=ctypes_and_compile_environment)
--- a/moz.configure
+++ b/moz.configure
@@ -103,24 +103,24 @@ js_option('--enable-debug',
 add_old_configure_assignment('MOZ_DEBUG',
                              depends('--enable-debug')(lambda v: bool(v)))
 
 include('build/moz.configure/pkg.configure')
 # Make this assignment here rather than in pkg.configure to avoid
 # requiring this file in unit tests.
 add_old_configure_assignment('PKG_CONFIG', pkg_config)
 
-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')
-include_when('build/moz.configure/warnings.configure',
-             when='--enable-compile-environment')
+include('build/moz.configure/toolchain.configure',
+        when='--enable-compile-environment')
+include('build/moz.configure/memory.configure',
+        when='--enable-compile-environment')
+include('build/moz.configure/headers.configure',
+        when='--enable-compile-environment')
+include('build/moz.configure/warnings.configure',
+        when='--enable-compile-environment')
 
 include(include_project_configure)
 
 @dependable
 @imports(_from='mozbuild.backend', _import='backends')
 def build_backends_choices():
     return tuple(backends)