Bug 1457524 part 3 - Check rustdoc for rust tests. r=froydnj
authorXidorn Quan <me@upsuper.org>
Wed, 02 May 2018 20:02:04 +1000
changeset 417008 4340083e6691e1d2aaec806461fd8d355fcf451b
parent 417007 e8616e9830d785506c79ed0280dc8486067c9d46
child 417009 904aaf73eb3a620cb2ea3f44ee35243e0b385ca9
push id33948
push userncsoregi@mozilla.com
push dateSat, 05 May 2018 09:49:52 +0000
treeherdermozilla-central@51d020e4c2cb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1457524
milestone61.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 1457524 part 3 - Check rustdoc for rust tests. r=froydnj MozReview-Commit-ID: 4qRccUcXq6O
build/moz.configure/rust.configure
build/mozconfig.rust
config/rules.mk
--- a/build/moz.configure/rust.configure
+++ b/build/moz.configure/rust.configure
@@ -255,22 +255,33 @@ set_config('RUST_TARGET_ENV_NAME', rust_
 set_config('RUSTC_COMMIT', depends(rustc_info)(lambda i: i.commit))
 
 set_config('RUSTC_VERSION', depends(rustc_info)(lambda i: str(i.version)))
 
 # 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)
+
 # 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')
 
-set_config('MOZ_RUST_TESTS', depends('--enable-rust-tests')(lambda v: bool(v)))
+
+@depends('--enable-rust-tests', rustdoc)
+def rust_tests(enable_rust_tests, rustdoc):
+    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)
 
 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')
 
 set_config('WIN64_LINK', depends('WIN64_LINK')(lambda x: x))
 set_config('WIN64_LIB', depends('WIN64_LIB')(lambda x: x))
 
 
--- a/build/mozconfig.rust
+++ b/build/mozconfig.rust
@@ -1,9 +1,10 @@
 # Options to enable rust in automation builds.
 
 TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
 
 # Tell configure to use the tooltool rustc.
 RUSTC="$TOOLTOOL_DIR/rustc/bin/rustc"
 CARGO="$TOOLTOOL_DIR/rustc/bin/cargo"
+RUSTDOC="$TOOLTOOL_DIR/rustc/bin/rustdoc"
 
 ac_add_options --enable-rust-simd
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -876,16 +876,17 @@ endif
 
 # We use the + prefix to pass down the jobserver fds to cargo, but we
 # don't use the prefix when make -n is used, so that cargo doesn't run
 # in that case)
 define RUN_CARGO
 $(if $(findstring n,$(filter-out --%, $(MAKEFLAGS))),,+)env $(environment_cleaner) $(rust_unlock_unstable) $(rustflags_override) $(sccache_wrap) \
 	CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) \
 	RUSTC=$(RUSTC) \
+	RUSTDOC=$(RUSTDOC) \
 	MOZ_SRC=$(topsrcdir) \
 	MOZ_DIST=$(ABS_DIST) \
 	LIBCLANG_PATH="$(MOZ_LIBCLANG_PATH)" \
 	CLANG_PATH="$(MOZ_CLANG_PATH)" \
 	PKG_CONFIG_ALLOW_CROSS=1 \
 	RUST_BACKTRACE=full \
 	MOZ_TOPOBJDIR=$(topobjdir) \
 	$(cargo_incremental) \