bug 1357825 - use sccache for caching Rust compilation. r?froydnj draft
authorTed Mielczarek <ted@mielczarek.org>
Mon, 01 May 2017 11:58:45 -0400
changeset 593498 5a1ab7e5ff5831cdabe35a26d1717b3d8e72c531
parent 593497 560c9c18d0cb660e9dad19439d1877615894e595
child 633133 a7debc251ce412fa311c934964eca698c238031c
push id63720
push userbmo:ted@mielczarek.org
push dateTue, 13 Jun 2017 19:25:40 +0000
reviewersfroydnj
bugs1357825
milestone55.0a1
bug 1357825 - use sccache for caching Rust compilation. r?froydnj MozReview-Commit-ID: 84PCmiVBlrV
config/rules.mk
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -958,25 +958,29 @@ ifdef MOZ_MSVCBITS
 environment_cleaner = PATH='' LIB='' LIBPATH=''
 # The servo build needs to know where python is, and we're removing the PATH
 # so we tell it explicitly via the PYTHON env var.
 environment_cleaner += PYTHON='$(shell which $(PYTHON))'
 else
 environment_cleaner =
 endif
 
+ifdef MOZ_USING_SCCACHE
+sccache_wrap := RUSTC_WRAPPER='$(CCACHE)'
+endif
+
 # This function is intended to be called by:
 #
 #   $(call CARGO_BUILD,EXTRA_ENV_VAR1=X EXTRA_ENV_VAR2=Y ...)
 #
 # but, given the idiosyncracies of make, can also be called without arguments:
 #
 #   $(call CARGO_BUILD)
 define CARGO_BUILD
-env $(environment_cleaner) $(rustflags_override) \
+env $(environment_cleaner) $(rustflags_override) $(sccache_wrap) \
 	CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) \
 	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=1 \