summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/build.py10
-rw-r--r--mesonbuild/interpreter/kwargs.py5
-rw-r--r--mesonbuild/interpreter/type_checking.py7
3 files changed, 14 insertions, 8 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index a198b3973..7bf3a60a8 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -2792,11 +2792,15 @@ class CommandBase:
dependencies: T.List[T.Union[BuildTarget, 'CustomTarget']]
subproject: str
- def flatten_command(self, cmd: T.Sequence[T.Union[str, File, programs.ExternalProgram, BuildTargetTypes]]) -> \
+ def flatten_command(self, cmd: T.Sequence[T.Union[str, File, programs.ExternalProgram, BuildTargetTypes, LocalProgram]]) -> \
T.List[T.Union[str, File, BuildTarget, CustomTarget, programs.ExternalProgram]]:
cmd = listify(cmd)
final_cmd: T.List[T.Union[str, File, BuildTarget, 'CustomTarget']] = []
for c in cmd:
+ if isinstance(c, LocalProgram):
+ self.dependencies.extend(c.depends)
+ self.depend_files.extend(c.depend_files)
+ c = c.program
if isinstance(c, str):
final_cmd.append(c)
elif isinstance(c, File):
@@ -2862,7 +2866,7 @@ class CustomTarget(Target, CustomTargetBase, CommandBase):
environment: environment.Environment,
command: T.Sequence[T.Union[
str, BuildTargetTypes, GeneratedList,
- programs.ExternalProgram, File]],
+ programs.ExternalProgram, File, LocalProgram]],
sources: T.Sequence[T.Union[
str, File, BuildTargetTypes, ExtractedObjects,
GeneratedList, programs.ExternalProgram]],
@@ -3122,7 +3126,7 @@ class RunTarget(Target, CommandBase):
typename = 'run'
def __init__(self, name: str,
- command: T.Sequence[T.Union[str, File, BuildTargetTypes, programs.ExternalProgram]],
+ command: T.Sequence[T.Union[str, File, BuildTargetTypes, programs.ExternalProgram, LocalProgram]],
dependencies: T.Sequence[AnyTargetType],
subdir: str,
subproject: str,
diff --git a/mesonbuild/interpreter/kwargs.py b/mesonbuild/interpreter/kwargs.py
index 1d58aa61f..b7b22827d 100644
--- a/mesonbuild/interpreter/kwargs.py
+++ b/mesonbuild/interpreter/kwargs.py
@@ -171,7 +171,8 @@ class FuncAddLanguages(ExtractRequired):
class RunTarget(TypedDict):
- command: T.List[T.Union[str, build.BuildTarget, build.CustomTarget, ExternalProgram, File]]
+ command: T.List[T.Union[str, build.BuildTarget, build.CustomTarget, ExternalProgram,
+ File, LocalProgram]]
depends: T.List[T.Union[build.BuildTarget, build.CustomTarget]]
env: EnvironmentVariables
@@ -182,7 +183,7 @@ class CustomTarget(TypedDict):
build_always_stale: T.Optional[bool]
build_by_default: T.Optional[bool]
capture: bool
- command: T.List[T.Union[str, build.BuildTargetTypes, ExternalProgram, File]]
+ command: T.List[T.Union[str, build.BuildTargetTypes, ExternalProgram, File, LocalProgram]]
console: bool
depend_files: T.List[FileOrString]
depends: T.List[T.Union[build.BuildTarget, build.CustomTarget]]
diff --git a/mesonbuild/interpreter/type_checking.py b/mesonbuild/interpreter/type_checking.py
index 567cd1e59..50f07699b 100644
--- a/mesonbuild/interpreter/type_checking.py
+++ b/mesonbuild/interpreter/type_checking.py
@@ -10,7 +10,8 @@ import typing as T
from .. import compilers
from ..build import (CustomTarget, BuildTarget,
CustomTargetIndex, ExtractedObjects, GeneratedList, IncludeDirs,
- BothLibraries, SharedLibrary, StaticLibrary, Jar, Executable, StructuredSources)
+ BothLibraries, SharedLibrary, StaticLibrary, Jar, Executable, StructuredSources,
+ LocalProgram)
from ..options import OptionKey, UserFeatureOption
from ..dependencies import Dependency, InternalDependency
from ..interpreterbase.decorators import KwargInfo, ContainerTypeInfo
@@ -284,9 +285,9 @@ DEPEND_FILES_KW: KwargInfo[T.List[T.Union[str, File]]] = KwargInfo(
default=[],
)
-COMMAND_KW: KwargInfo[T.List[T.Union[str, BuildTargetTypes, ExternalProgram, File]]] = KwargInfo(
+COMMAND_KW: KwargInfo[T.List[T.Union[str, BuildTargetTypes, ExternalProgram, File, LocalProgram]]] = KwargInfo(
'command',
- ContainerTypeInfo(list, (str, BuildTarget, CustomTarget, CustomTargetIndex, ExternalProgram, File), allow_empty=False),
+ ContainerTypeInfo(list, (str, BuildTarget, CustomTarget, CustomTargetIndex, ExternalProgram, File, LocalProgram), allow_empty=False),
required=True,
listify=True,
default=[],