bug 1357825 - use sccache for caching Rust compilation. r?froydnj
MozReview-Commit-ID: 84PCmiVBlrV
--- 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 \