Bug 1478986 - convert rust.configure to use js_option; r=ted.mielczarek
authorNathan Froyd <froydnj@mozilla.com>
Thu, 02 Aug 2018 08:27:11 -0400
changeset 429861 f6c28d1e8a4bee80201f26c5a6bf4d007618bd1a
parent 429860 2785491cf84ef9560c1c3c780609772a9ab4e2b5
child 429862 084b1e903489a2c5643f99da82b2c788f786bd61
push id34375
push usernbeleuzu@mozilla.com
push dateThu, 02 Aug 2018 22:28:56 +0000
treeherdermozilla-central@b1c100e2b29a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1478986
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1478986 - convert rust.configure to use js_option; r=ted.mielczarek This change is necessary for usefully including rust.configure from JS's configure.
build/moz.configure/rust.configure
--- a/build/moz.configure/rust.configure
+++ b/build/moz.configure/rust.configure
@@ -9,18 +9,23 @@
 def add_rustup_path(what):
     # rustup installs rustc/cargo into ~/.cargo/bin by default,
     # so look there if the binaries aren't in $PATH.
     return [what, os.path.join(expanduser('~/.cargo/bin'), what)]
 
 
 # Rust is required by `rust_compiler` below. We allow_missing here
 # to propagate failures to the better error message there.
-rustc = check_prog('RUSTC', add_rustup_path('rustc'), allow_missing=True)
-cargo = check_prog('CARGO', add_rustup_path('cargo'), allow_missing=True)
+js_option(env='RUSTC', nargs=1, help='Path to the rust compiler')
+js_option(env='CARGO', nargs=1, help='Path to the Cargo package manager')
+
+rustc = check_prog('RUSTC', add_rustup_path('rustc'),
+                   input='RUSTC', allow_missing=True)
+cargo = check_prog('CARGO', add_rustup_path('cargo'),
+                   input='CARGO', allow_missing=True)
 
 
 @depends_if(rustc)
 @checking('rustc version', lambda info: info.version)
 def rustc_info(rustc):
     out = check_cmd_output(rustc, '--version', '--verbose').splitlines()
     info = dict((s.strip() for s in line.split(':', 1)) for line in out[1:])
     return namespace(
@@ -254,17 +259,20 @@ set_config('RUST_TARGET_ENV_NAME', rust_
 # This is used for putting source info into symbol files.
 set_config('RUSTC_COMMIT', depends(rustc_info)(lambda i: i.commit))
 
 # Until we remove all the other Rust checks in old-configure.
 add_old_configure_assignment('RUSTC', rustc)
 add_old_configure_assignment('RUST_TARGET', rust_target_triple)
 
 # Rustdoc is required by Rust tests below.
-rustdoc = check_prog('RUSTDOC', add_rustup_path('rustdoc'), allow_missing=True)
+js_option(env='RUSTDOC', nargs=1, help='Path to the rustdoc program')
+
+rustdoc = check_prog('RUSTDOC', add_rustup_path('rustdoc'),
+                     input='RUSTDOC', allow_missing=True)
 
 # This option is separate from --enable-tests because Rust tests are particularly
 # expensive in terms of compile time (especially for code in libxul).
 option('--enable-rust-tests',
        help='Enable building of Rust tests, and build-time execution of them')
 
 
 @depends('--enable-rust-tests', rustdoc)
@@ -272,20 +280,23 @@ def rust_tests(enable_rust_tests, rustdo
     if enable_rust_tests and not rustdoc:
         die('--enable-rust-tests requires rustdoc')
     return bool(enable_rust_tests)
 
 
 set_config('MOZ_RUST_TESTS', rust_tests)
 
 # Bindgen can use rustfmt to format Rust file, but it's not required.
-rustfmt = check_prog('RUSTFMT', add_rustup_path('rustfmt'), allow_missing=True)
+js_option(env='RUSTFMT', nargs=1, help='Path to the rustfmt program')
 
-option(env='WIN64_LINK', nargs=1, help='Path to link.exe that targets win64')
-option(env='WIN64_LIB', nargs=1, help='Paths to libraries for the win64 linker')
+rustfmt = check_prog('RUSTFMT', add_rustup_path('rustfmt'),
+                     input='RUSTFMT', allow_missing=True)
+
+js_option(env='WIN64_LINK', nargs=1, help='Path to link.exe that targets win64')
+js_option(env='WIN64_LIB', nargs=1, help='Paths to libraries for the win64 linker')
 
 set_config('WIN64_LINK', depends('WIN64_LINK')(lambda x: x))
 set_config('WIN64_LIB', depends('WIN64_LIB')(lambda x: x))
 
 
 @depends(target, rustc_info, c_compiler, 'WIN64_LINK', 'WIN64_LIB')
 def win64_cargo_linker(target, rustc_info, compiler_info, link, lib):
     # When we're building a 32-bit Windows build with a 64-bit rustc, we