aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2022-08-05 10:20:21 -0700
committerEli Schwartz <eschwartz93@gmail.com>2022-08-18 21:57:36 -0400
commit394f734b1d21aff8a7f4f38ec3b46357e54273a5 (patch)
tree2ab05a0497d6bb66ad9b96dfb5cc556719a07afd /mesonbuild/build.py
parentf10967e3f40e1caaddab599c5f76923acf39a2f5 (diff)
downloadmeson-394f734b1d21aff8a7f4f38ec3b46357e54273a5.zip
meson-394f734b1d21aff8a7f4f38ec3b46357e54273a5.tar.gz
meson-394f734b1d21aff8a7f4f38ec3b46357e54273a5.tar.bz2
build: Add a Union alias for all build targets
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 5882133..6f5c9bb 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -58,6 +58,7 @@ if T.TYPE_CHECKING:
GeneratedTypes = T.Union['CustomTarget', 'CustomTargetIndex', 'GeneratedList']
LibTypes = T.Union['SharedLibrary', 'StaticLibrary', 'CustomTarget', 'CustomTargetIndex']
+ BuildTargetTypes = T.Union['BuildTarget', 'CustomTarget', 'CustomTargetIndex']
pch_kwargs = {'c_pch', 'cpp_pch'}
@@ -1066,11 +1067,11 @@ class BuildTarget(Target):
return ExtractedObjects(self, self.sources, self.generated, self.objects,
recursive)
- def get_all_link_deps(self) -> 'ImmutableListProtocol[T.Union[BuildTarget, CustomTarget, CustomTargetIndex]]':
+ def get_all_link_deps(self) -> ImmutableListProtocol[BuildTargetTypes]:
return self.get_transitive_link_deps()
@lru_cache(maxsize=None)
- def get_transitive_link_deps(self) -> 'ImmutableListProtocol[T.Union[BuildTarget, CustomTarget, CustomTargetIndex]]':
+ def get_transitive_link_deps(self) -> ImmutableListProtocol[BuildTargetTypes]:
result: T.List[Target] = []
for i in self.link_targets:
result += i.get_all_link_deps()
@@ -2402,7 +2403,7 @@ class CommandBase:
dependencies: T.List[T.Union[BuildTarget, 'CustomTarget']]
subproject: str
- def flatten_command(self, cmd: T.Sequence[T.Union[str, File, programs.ExternalProgram, 'BuildTarget', 'CustomTarget', 'CustomTargetIndex']]) -> \
+ def flatten_command(self, cmd: T.Sequence[T.Union[str, File, programs.ExternalProgram, BuildTargetTypes]]) -> \
T.List[T.Union[str, File, BuildTarget, 'CustomTarget']]:
cmd = listify(cmd)
final_cmd: T.List[T.Union[str, File, BuildTarget, 'CustomTarget']] = []
@@ -2444,10 +2445,11 @@ class CustomTarget(Target, CommandBase):
subproject: str,
environment: environment.Environment,
command: T.Sequence[T.Union[
- str, BuildTarget, CustomTarget, CustomTargetIndex, GeneratedList, programs.ExternalProgram, File]],
+ str, BuildTargetTypes, GeneratedList,
+ programs.ExternalProgram, File]],
sources: T.Sequence[T.Union[
- str, File, BuildTarget, CustomTarget, CustomTargetIndex,
- ExtractedObjects, GeneratedList, programs.ExternalProgram]],
+ str, File, BuildTargetTypes, ExtractedObjects,
+ GeneratedList, programs.ExternalProgram]],
outputs: T.List[str],
*,
build_always_stale: bool = False,
@@ -2633,7 +2635,7 @@ class RunTarget(Target, CommandBase):
typename = 'run'
def __init__(self, name: str,
- command: T.Sequence[T.Union[str, File, BuildTarget, 'CustomTarget', 'CustomTargetIndex', programs.ExternalProgram]],
+ command: T.Sequence[T.Union[str, File, BuildTargetTypes, programs.ExternalProgram]],
dependencies: T.Sequence[Target],
subdir: str,
subproject: str,