Bug 1551368 - Part 3: Don't remove the rust incremental cache when clobbering. r=chmanchester

Skips over the incremental cache when performing a clobber. The incremental compilation cache is located at:
  `$(objdir)/$(rust_target)/$(rust_build_kind)/incremental`

When cross compiling there can be two caches, one for the host and one for the target so we handle both.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Eric Rahm 2019-06-06 18:35:33 +00:00
Родитель d84fd94a97
Коммит 984d318461
1 изменённых файлов: 17 добавлений и 0 удалений

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

@ -136,12 +136,22 @@ class Clobberer(object):
some directories (e.g. Visual Studio Project Files) will not be
deleted.
"""
# Determine where cargo build artifacts are stored
RUST_TARGET_VARS = ('RUST_HOST_TARGET', 'RUST_TARGET')
rust_targets = set([self.substs[x] for x in RUST_TARGET_VARS if x in self.substs])
rust_build_kind = 'release'
if self.substs.get('MOZ_DEBUG_RUST'):
rust_build_kind = 'debug'
# Top-level files and directories to not clobber by default.
no_clobber = {
'.mozbuild',
'msvc',
}
# Hold off on clobbering cargo build artifacts
no_clobber |= rust_targets
if full:
# mozfile doesn't like unicode arguments (bug 818783).
paths = [self.topobjdir.encode('utf-8')]
@ -150,6 +160,13 @@ class Clobberer(object):
self.delete_dirs(self.topobjdir, paths)
# Now handle cargo's build artifacts and skip removing the incremental
# compilation cache.
for target in rust_targets:
cargo_path = os.path.join(self.topobjdir, target, rust_build_kind)
paths = self.collect_subdirs(cargo_path, {'incremental', })
self.delete_dirs(cargo_path, paths)
def ensure_objdir_state(self):
"""Ensure the CLOBBER file in the objdir exists.