diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2018-10-28 11:51:13 -0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-10-29 20:22:33 +0200 |
commit | edccb11f015d51a1a45a936751a504f01641e928 (patch) | |
tree | 12fa294c49ad4500db93d83a126bf7a07eccbc40 /mesonbuild/build.py | |
parent | e4da09b8f9ea1bd66d24e16dc68469148eee9716 (diff) | |
download | meson-edccb11f015d51a1a45a936751a504f01641e928.zip meson-edccb11f015d51a1a45a936751a504f01641e928.tar.gz meson-edccb11f015d51a1a45a936751a504f01641e928.tar.bz2 |
Rollback if an optional subproject fails
If a subproject is not required and fails during its configuration, the
parent project continues, but should not include any target or state set
by the failed subproject. This fix ninja still trying to build targets
generated by subprojects before they fail in their configuration.
The 'build' object is now per-interpreter instead of being global. Once
a subproject interpreter succeed, values from its 'build' object are
merged back into its parent 'build' object.
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r-- | mesonbuild/build.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index f2a6d9c..df67c8e 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -138,6 +138,19 @@ class Build: self.find_overrides = {} self.searched_programs = set() # The list of all programs that have been searched for. + def copy(self): + other = Build(self.environment) + for k, v in self.__dict__.items(): + if isinstance(v, (list, dict, set, OrderedDict)): + other.__dict__[k] = v.copy() + else: + other.__dict__[k] = v + return other + + def merge(self, other): + for k, v in other.__dict__.items(): + self.__dict__[k] = v + def add_compiler(self, compiler): if self.static_linker is None and compiler.needs_static_linker(): self.static_linker = self.environment.detect_static_linker(compiler) |