Bug 1430886 - Disable incremental rust in automation. r?Build draft
authorRalph Giles <giles@mozilla.com>
Wed, 17 Jan 2018 08:32:51 -0800
changeset 721668 5bd64855cf8ca17d31b1b565c2ae73677cf956e4
parent 721495 4e429d313fd2e0f9202271ee8f3fb798817ec3e7
child 746414 0dc3e687cf6b1b8acc1ff97cea43aa9274c8751c
push id95923
push userbmo:giles@thaumas.net
push dateWed, 17 Jan 2018 18:12:08 +0000
reviewersBuild
bugs1430886, 47507
milestone59.0a1
Bug 1430886 - Disable incremental rust in automation. r?Build Work around excessive command-line length issues by disabling incremental rust compilation, which is enabled by default outside `cargo --release` starting with Rust 1.24. Incremental rust builds shouldn't help much in automation, where sccache provides the only continuity between build environments. In the meantime, they add a lot of object files to the link line. See https://github.com/rust-lang/rust/pull/47507 about addressing the underlying issue upstream. MozReview-Commit-ID: LRwUj3fhiaO
config/rules.mk
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -859,16 +859,22 @@ endif
 cargo_rustc_flags = $(CARGO_RUSTCFLAGS)
 ifndef DEVELOPER_OPTIONS
 ifndef MOZ_DEBUG_RUST
 # Enable link-time optimization for release builds.
 cargo_rustc_flags += -C lto
 endif
 endif
 
+# Disable incremental Rust compilation in automation builds, where
+# the lack of environmental continuity makes it unhelpful.
+ifdef MOZ_AUTOMATION
+cargo_incremental := CARGO_INCREMENTAL=0
+endif
+
 rustflags_override = RUSTFLAGS='$(MOZ_RUST_DEFAULT_FLAGS) $(RUSTFLAGS)'
 
 ifdef MOZ_MSVCBITS
 # If we are building a MozillaBuild shell, we want to clear out the
 # vcvars.bat environment variables for cargo builds. This is because
 # a 32-bit MozillaBuild shell on a 64-bit machine will try to use
 # the 32-bit compiler/linker for everything, while cargo/rustc wants
 # to use the 64-bit linker for build.rs scripts. This conflict results
@@ -900,16 +906,17 @@ define RUN_CARGO
 	RUSTC=$(RUSTC) \
 	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) \
 	$(2) \
 	$(CARGO) $(1) $(cargo_build_flags)
 endef
 
 # This function is intended to be called by:
 #
 #   $(call CARGO_BUILD,EXTRA_ENV_VAR1=X EXTRA_ENV_VAR2=Y ...)
 #