Bug 1576030 - Disable cargo incremental when using sccache. r=nalexander

For some reason, cargo incremental doesn't work as well as it should,
and doesn't perform as well as sccache does. So when building with
sccache, disable cargo incremental. This brought a no-change clobber
build with 100% cache from 3:50 to 2:05 on a beefy AWS instance I was
testing this with.

Differential Revision: https://phabricator.services.mozilla.com/D43188

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Hommey 2019-08-23 04:50:55 +00:00
Родитель a650fac7b0
Коммит 3e303cdeb9
1 изменённых файлов: 15 добавлений и 2 удалений

Просмотреть файл

@ -1886,13 +1886,17 @@ def rust_compile_flags(opt_level, debug_rust, debug_symbols, frame_pointers):
# Rust incremental compilation
# ==============================================================
js_option(env='RUSTC_WRAPPER', nargs=1,
help='Wrap rust compilation with given tool')
js_option('--disable-cargo-incremental',
help='Disable incremental rust compilation.')
@depends(rustc_opt_level, debug_rust, 'MOZ_AUTOMATION', code_coverage,
'--disable-cargo-incremental')
'--disable-cargo-incremental', using_sccache, 'RUSTC_WRAPPER')
@imports('os')
def cargo_incremental(opt_level, debug_rust, automation, code_coverage,
enabled):
enabled, using_sccache, rustc_wrapper):
"""Return a value for the CARGO_INCREMENTAL environment variable."""
if not enabled:
@ -1909,6 +1913,15 @@ def cargo_incremental(opt_level, debug_rust, automation, code_coverage,
if code_coverage:
return '0'
# Incremental compilation doesn't work as well as it should, and if we're
# using sccache, it's better to use sccache than incremental compilation.
if not using_sccache and rustc_wrapper:
rustc_wrapper = os.path.basename(rustc_wrapper[0])
if os.path.splitext(rustc_wrapper)[0].lower() == 'sccache':
using_sccache = True
if using_sccache:
return '0'
# Incremental compilation is automatically turned on for debug builds, so
# we don't need to do anything special here.
if debug_rust: