From d5917c1b87aa38b8297f17586b470bcf07da0594 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Thu, 10 Jun 2021 09:28:05 -0400 Subject: [PATCH] coredata: Invalidate deps cache when changing wrap_mode option Fixes: #8858 --- mesonbuild/coredata.py | 9 +++++++++ mesonbuild/mconf.py | 3 +-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index f34f7b8cb..89cec46df 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -634,6 +634,15 @@ class CoreData: if key.name == 'buildtype': self._set_others_from_buildtype(value) + elif key.name in {'wrap_mode', 'force_fallback_for'}: + # We could have the system dependency cached for a dependency that + # is now forced to use subproject fallback. We probably could have + # more fine grained cache invalidation, but better be safe. + self.clear_deps_cache() + + def clear_deps_cache(self): + self.deps.host.clear() + self.deps.build.clear() def get_nondefault_buildtype_args(self): result= [] diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py index 20f31d1c7..4b3f33179 100644 --- a/mesonbuild/mconf.py +++ b/mesonbuild/mconf.py @@ -85,8 +85,7 @@ class Conf: raise ConfException(f'Directory {build_dir} is neither a Meson build directory nor a project source directory.') def clear_cache(self): - self.coredata.deps.host.clear() - self.coredata.deps.build.clear() + self.coredata.clear_deps_cache() def set_options(self, options): self.coredata.set_options(options)