Bug 1275419 - Deprecate --enable-build-backend and add --build-backends. r?chmanchester draft
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 25 May 2016 16:23:51 +0900
changeset 370669 1364500a9fa8246b7d1b7b89fd795ef3d66b801b
parent 370668 5f7f21ff104e2d8b1adf2fe389b1aff4ea4e6417
child 521812 bdc4bfcaebfb4c9d7913de3bc045e54232ff3c7f
push id19130
push userbmo:mh+mozilla@glandium.org
push dateWed, 25 May 2016 07:42:09 +0000
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)