diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2023-09-21 11:21:11 -0700 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2023-10-09 17:33:48 -0400 |
commit | cbca1919481902efbd5dadda3cc80db84fd75f0c (patch) | |
tree | 706d343996e1f76481171e7457ed28752552616c /mesonbuild/build.py | |
parent | 8490eaa29dd9b5a7fd36bf9c2f871008139ede7a (diff) | |
download | meson-cbca1919481902efbd5dadda3cc80db84fd75f0c.zip meson-cbca1919481902efbd5dadda3cc80db84fd75f0c.tar.gz meson-cbca1919481902efbd5dadda3cc80db84fd75f0c.tar.bz2 |
interpreter: Handle BuildTarget.vala_args as Files in the interpreter
Way back in Meson 0.25, support was added to `vala_args` for Files.
Strangely, this was never added to any other language, though it's been
discussed before. For type safety, it makes more sense to handle this in
the interpreter level, and pass only strings into the build IR.
This is accomplished by adding a `depend_files` field to the
`BuildTarget` class (which is not exposed to the user), and adding the
depend files into that field, while converting the arguments to relative
string paths. This ensures both the proper build dependencies happen, as
well as that the arguments are always strings.
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r-- | mesonbuild/build.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 8208fa0..9f0abf5 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -735,6 +735,7 @@ class BuildTarget(Target): self.link_language = kwargs.get('link_language') self.link_targets: T.List[LibTypes] = [] self.link_whole_targets: T.List[T.Union[StaticLibrary, CustomTarget, CustomTargetIndex]] = [] + self.depend_files: T.List[File] = [] self.link_depends = [] self.added_deps = set() self.name_prefix_set = False @@ -746,7 +747,7 @@ class BuildTarget(Target): # as Vala which generates .vapi and .h besides the compiled output. self.outputs = [self.filename] self.pch: T.Dict[str, T.List[str]] = {} - self.extra_args: T.Dict[str, T.List['FileOrString']] = {} + self.extra_args: T.Dict[str, T.List[str]] = {} self.sources: T.List[File] = [] self.generated: T.List['GeneratedTypes'] = [] self.extra_files: T.List[File] = [] @@ -1278,7 +1279,7 @@ class BuildTarget(Target): def get_outputs(self) -> T.List[str]: return self.outputs - def get_extra_args(self, language): + def get_extra_args(self, language) -> T.List[str]: return self.extra_args.get(language, []) @lru_cache(maxsize=None) |