diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2020-10-27 15:48:32 -0700 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2020-11-01 19:26:31 +0200 |
commit | 47d071a34f1e1539b1b354cfda309dac1b905232 (patch) | |
tree | bc31a740d67259768fea0e9d74069be9c36363f3 /mesonbuild/interpreter.py | |
parent | d4eec9664bb96a093b92c3e1f565806686ea0ccb (diff) | |
download | meson-47d071a34f1e1539b1b354cfda309dac1b905232.zip meson-47d071a34f1e1539b1b354cfda309dac1b905232.tar.gz meson-47d071a34f1e1539b1b354cfda309dac1b905232.tar.bz2 |
interpreter: store correct files for project regeneration
Right now sub-sub projects are not correctly registered, because we
don't have a way to pass up past the first level of subproject. This
patch changes that by making the build_Def_files as defined in the
Interpreter initializer accurate for translated dependencies, ie, cmake
dependencies won't define a dependency on a non-existent meson.build.
This means that it can always add the subi.build_def_files because they
are always accurate.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter.py | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 6222f97..28ac74f 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2383,6 +2383,7 @@ class Interpreter(InterpreterBase): default_project_options: T.Optional[T.Dict[str, str]] = None, mock: bool = False, ast: T.Optional[mparser.CodeBlockNode] = None, + is_translated: bool = False, ) -> None: super().__init__(build.environment.get_source_dir(), subdir, subproject) self.an_unpicklable_object = mesonlib.an_unpicklable_object @@ -2421,8 +2422,16 @@ class Interpreter(InterpreterBase): self.default_project_options = {} self.project_default_options = {} self.build_func_dict() + # build_def_files needs to be defined before parse_project is called - self.build_def_files = [os.path.join(self.subdir, environment.build_filename)] + # + # For non-meson subprojects, we'll be using the ast. Even if it does + # exist we don't want to add a dependency on it, it's autogenerated + # from the actual build files, and is just for reference. + self.build_def_files = [] + build_filename = os.path.join(self.subdir, environment.build_filename) + if not is_translated: + self.build_def_files.append(build_filename) if not mock: self.parse_project() self._redetect_machines() @@ -2941,11 +2950,14 @@ external dependencies (including libraries) must go to "dependencies".''') return self.disabled_subproject(subp_name, exception=e) raise e - def _do_subproject_meson(self, subp_name, subdir, default_options, kwargs, ast=None, build_def_files=None): + def _do_subproject_meson(self, subp_name: str, subdir: str, default_options, kwargs, + ast: T.Optional[mparser.CodeBlockNode] = None, + build_def_files: T.Optional[T.List[str]] = None, + is_translated: bool = False) -> SubprojectHolder: with mlog.nested(): new_build = self.build.copy() subi = Interpreter(new_build, self.backend, subp_name, subdir, self.subproject_dir, - self.modules, default_options, ast=ast) + self.modules, default_options, ast=ast, is_translated=is_translated) subi.subprojects = self.subprojects subi.subproject_stack = self.subproject_stack + [subp_name] @@ -2971,8 +2983,8 @@ external dependencies (including libraries) must go to "dependencies".''') # Duplicates are possible when subproject uses files from project root if build_def_files: self.build_def_files = list(set(self.build_def_files + build_def_files)) - else: - self.build_def_files = list(set(self.build_def_files + subi.build_def_files)) + # We always need the subi.build_def_files, to propgate sub-sub-projects + self.build_def_files = list(set(self.build_def_files + subi.build_def_files)) self.build.merge(subi.build) self.build.subprojects[subp_name] = subi.project_version self.summary.update(subi.summary) @@ -3016,7 +3028,7 @@ external dependencies (including libraries) must go to "dependencies".''') mlog.cmd_ci_include(meson_filename) mlog.log() - result = self._do_subproject_meson(subp_name, subdir, default_options, kwargs, ast, cm_int.bs_files) + result = self._do_subproject_meson(subp_name, subdir, default_options, kwargs, ast, cm_int.bs_files, is_translated=True) result.cm_interpreter = cm_int mlog.log() |