Bug 1457524 part 3 - Check rustdoc for rust tests. r?froydnj
MozReview-Commit-ID: 4qRccUcXq6O
--- a/build/moz.configure/rust.configure
+++ b/build/moz.configure/rust.configure
@@ -253,22 +253,33 @@ 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)
+
# 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) \