Bug 1275419 - Deprecate --enable-build-backend and add --build-backends. r=chmanchester
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 25 May 2016 16:23:51 +0900
changeset 328156 27108dad917e666a72ba384ac2311217158aa0c2
parent 328155 429f5a3ae4badce551053d5697914d710301233e
child 328157 65806002153d3ede2fab5d77c466926a56de160e
push idunknown
push userunknown
push dateunknown
reviewerschmanchester
bugs1275419
milestone49.0a1
Bug 1275419 - Deprecate --enable-build-backend and add --build-backends. r=chmanchester --enable-build-backend was taking a list of additional backends to add to the defaults. Changes to allow to disable some of the defaults is not possible in a straightforward way, so introduce a new --build-backends option that sets the exact set of wanted backends, but also allows to add and remove from the defaults with + or -. --build-backends=+CompileDB is equivalent to --enable-build-backend=CompileDB. --build-backends=-VisualStudio disables the VS backend when it's automatically enabled.
moz.configure
--- a/moz.configure
+++ b/moz.configure
@@ -101,32 +101,47 @@ include(memory_include)
 
 
 @depends('--help')
 @imports(_from='mozbuild.backend', _import='backends')
 def build_backends_choices(help):
     return tuple(backends)
 
 
-option('--enable-build-backend', nargs='+', choices=build_backends_choices,
-       help='Enable additional build backends')
+@deprecated_option('--enable-build-backend', nargs='+',
+                   choices=build_backends_choices)
+def build_backend(backends):
+    if backends:
+        return tuple('+%s' % b for b in backends)
 
-@depends('--enable-build-backend', '--enable-artifact-builds', target,
-         compile_environment)
-def build_backend(backends, artifact_builds, target, compile_environment):
+imply_option('--build-backends', build_backend)
+
+
+@depends('--enable-artifact-builds', '--disable-compile-environment', '--help')
+@imports('sys')
+def build_backend_defaults(artifact_builds, compile_environment, _):
     if artifact_builds:
         all_backends = ['FasterMake+RecursiveMake']
     else:
         all_backends = ['RecursiveMake', 'FasterMake']
-    if target.os == 'WINNT' and compile_environment:
+    # Normally, we'd use target.os == 'WINNT', but a dependency on target
+    # would require target to depend on --help, as well as host and shell,
+    # and this is not a can of worms we can open at the moment.
+    if sys.platform == 'win32' and compile_environment:
         all_backends.append('VisualStudio')
-    all_backends.extend(backends)
-    return unique_list(all_backends)
+    return tuple(all_backends)
+
+option('--build-backends', nargs='+', default=build_backend_defaults,
+       choices=build_backends_choices, help='Build backends to generate')
 
-set_config('BUILD_BACKENDS', build_backend)
+@depends('--build-backends')
+def build_backends(backends):
+    return backends
+
+set_config('BUILD_BACKENDS', build_backends)
 
 
 # Awk detection
 # ==============================================================
 awk = check_prog('AWK', ('gawk', 'mawk', 'nawk', 'awk'))
 
 # Until the AWK variable is not necessary in old-configure
 @depends(awk)