summaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2018-10-28 11:51:13 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2018-10-29 20:22:33 +0200
commitedccb11f015d51a1a45a936751a504f01641e928 (patch)
tree12fa294c49ad4500db93d83a126bf7a07eccbc40 /mesonbuild/interpreter.py
parente4da09b8f9ea1bd66d24e16dc68469148eee9716 (diff)
downloadmeson-edccb11f015d51a1a45a936751a504f01641e928.tar.gz
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/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 66f7f02dd..8717a8343 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2286,7 +2286,8 @@ external dependencies (including libraries) must go to "dependencies".''')
with mlog.nested():
try:
mlog.log('\nExecuting subproject', mlog.bold(dirname), '\n')
- subi = Interpreter(self.build, self.backend, dirname, subdir, self.subproject_dir,
+ new_build = self.build.copy()
+ subi = Interpreter(new_build, self.backend, dirname, subdir, self.subproject_dir,
self.modules, default_options)
subi.subprojects = self.subprojects
@@ -2312,6 +2313,7 @@ external dependencies (including libraries) must go to "dependencies".''')
self.subprojects.update(subi.subprojects)
self.subprojects[dirname] = SubprojectHolder(subi, self.subproject_dir, dirname)
self.build_def_files += subi.build_def_files
+ self.build.merge(subi.build)
return self.subprojects[dirname]
def get_option_internal(self, optname):