summaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorGerion Entrup <gerion.entrup@flump.de>2024-03-11 11:21:56 +0100
committerDylan Baker <dylan@pnwbakers.com>2024-04-05 09:36:59 -0700
commit06bc8a8d37620506ec5d176577fdc9f6ae5f011b (patch)
tree35a4c860c6b33e2948a66fb0392f000d96301cc3 /mesonbuild
parent30c38e2bd69b2bab74b6e76da1c626f3c9853613 (diff)
downloadmeson-06bc8a8d37620506ec5d176577fdc9f6ae5f011b.tar.gz
depends keyword argument: accept CustomTargetIndex
That holds for all of these meson function: run_target, generator and custom_target and additionally to the Windows and Gnome module.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/vs2010backend.py5
-rw-r--r--mesonbuild/build.py8
-rw-r--r--mesonbuild/interpreter/type_checking.py6
3 files changed, 11 insertions, 8 deletions
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py
index a2ece96a3..20ad266f0 100644
--- a/mesonbuild/backend/vs2010backend.py
+++ b/mesonbuild/backend/vs2010backend.py
@@ -324,9 +324,12 @@ class Vs2010Backend(backends.Backend):
result[o.target.get_id()] = o.target
return result.items()
- def get_target_deps(self, t: T.Dict[T.Any, build.Target], recursive=False):
+ def get_target_deps(self, t: T.Dict[T.Any, T.Union[build.Target, build.CustomTargetIndex]], recursive=False):
all_deps: T.Dict[str, build.Target] = {}
for target in t.values():
+ if isinstance(target, build.CustomTargetIndex):
+ # just transfer it to the CustomTarget code
+ target = target.target
if isinstance(target, build.CustomTarget):
for d in target.get_target_dependencies():
# FIXME: this isn't strictly correct, as the target doesn't
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 2b6ce8875..6f0d6a2dd 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -2815,11 +2815,11 @@ class RunTarget(Target, CommandBase):
def __init__(self, name: str,
command: T.Sequence[T.Union[str, File, BuildTargetTypes, programs.ExternalProgram]],
- dependencies: T.Sequence[Target],
+ dependencies: T.Sequence[T.Union[Target, CustomTargetIndex]],
subdir: str,
subproject: str,
environment: environment.Environment,
- env: T.Optional['EnvironmentVariables'] = None,
+ env: T.Optional[EnvironmentVariables] = None,
default_env: bool = True):
# These don't produce output artifacts
super().__init__(name, subdir, subproject, False, MachineChoice.BUILD, environment)
@@ -2834,10 +2834,10 @@ class RunTarget(Target, CommandBase):
repr_str = "<{0} {1}: {2}>"
return repr_str.format(self.__class__.__name__, self.get_id(), self.command[0])
- def get_dependencies(self) -> T.List[T.Union[BuildTarget, 'CustomTarget']]:
+ def get_dependencies(self) -> T.List[T.Union[BuildTarget, CustomTarget, CustomTargetIndex]]:
return self.dependencies
- def get_generated_sources(self) -> T.List['GeneratedTypes']:
+ def get_generated_sources(self) -> T.List[GeneratedTypes]:
return []
def get_sources(self) -> T.List[File]:
diff --git a/mesonbuild/interpreter/type_checking.py b/mesonbuild/interpreter/type_checking.py
index 1256495d1..9b7e35c63 100644
--- a/mesonbuild/interpreter/type_checking.py
+++ b/mesonbuild/interpreter/type_checking.py
@@ -268,12 +268,12 @@ DEPFILE_KW: KwargInfo[T.Optional[str]] = KwargInfo(
validator=lambda x: 'Depfile must be a plain filename with a subdirectory' if has_path_sep(x) else None
)
-# TODO: CustomTargetIndex should be supported here as well
-DEPENDS_KW: KwargInfo[T.List[T.Union[BuildTarget, CustomTarget]]] = KwargInfo(
+DEPENDS_KW: KwargInfo[T.List[T.Union[BuildTarget, CustomTarget, CustomTargetIndex]]] = KwargInfo(
'depends',
- ContainerTypeInfo(list, (BuildTarget, CustomTarget)),
+ ContainerTypeInfo(list, (BuildTarget, CustomTarget, CustomTargetIndex)),
listify=True,
default=[],
+ since_values={CustomTargetIndex: '1.5.0'},
)
DEPEND_FILES_KW: KwargInfo[T.List[T.Union[str, File]]] = KwargInfo(