aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2022-03-28 14:54:54 -0700
committerEli Schwartz <eschwartz93@gmail.com>2023-03-09 15:03:03 -0500
commita769a0de3506e58b264861539a20799fb6559f3e (patch)
tree4886b9faca3164478f2e311eea2fe5a80509c8f9 /mesonbuild/build.py
parent6dc96e7266613d00bfead7ed7b5fed1ae4fa92e8 (diff)
downloadmeson-a769a0de3506e58b264861539a20799fb6559f3e.zip
meson-a769a0de3506e58b264861539a20799fb6559f3e.tar.gz
meson-a769a0de3506e58b264861539a20799fb6559f3e.tar.bz2
build: Add some missing annotations to BuildTarget initializer
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py82
1 files changed, 62 insertions, 20 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 40f6f25..d389f03 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -61,6 +61,7 @@ if T.TYPE_CHECKING:
GeneratedTypes = T.Union['CustomTarget', 'CustomTargetIndex', 'GeneratedList']
LibTypes = T.Union['SharedLibrary', 'StaticLibrary', 'CustomTarget', 'CustomTargetIndex']
BuildTargetTypes = T.Union['BuildTarget', 'CustomTarget', 'CustomTargetIndex']
+ ObjectTypes = T.Union[str, 'File', 'ExtractedObjects', 'GeneratedTypes']
pch_kwargs = {'c_pch', 'cpp_pch'}
@@ -697,13 +698,22 @@ class BuildTarget(Target):
install_dir: T.List[T.Union[str, Literal[False]]]
- def __init__(self, name: str, subdir: str, subproject: SubProject, for_machine: MachineChoice,
- sources: T.List['SourceOutputs'], structured_sources: T.Optional[StructuredSources],
- objects, environment: environment.Environment, compilers: T.Dict[str, 'Compiler'], kwargs):
+ def __init__(
+ self,
+ name: str,
+ subdir: str,
+ subproject: SubProject,
+ for_machine: MachineChoice,
+ sources: T.List['SourceOutputs'],
+ structured_sources: T.Optional[StructuredSources],
+ objects: T.List[ObjectTypes],
+ environment: environment.Environment,
+ compilers: T.Dict[str, 'Compiler'],
+ kwargs):
super().__init__(name, subdir, subproject, True, for_machine, environment)
self.all_compilers = compilers
self.compilers = OrderedDict() # type: OrderedDict[str, Compiler]
- self.objects: T.List[T.Union[str, 'File', 'ExtractedObjects']] = []
+ self.objects: T.List[ObjectTypes] = []
self.structured_sources = structured_sources
self.external_deps: T.List[dependencies.Dependency] = []
self.include_dirs: T.List['IncludeDirs'] = []
@@ -1796,10 +1806,18 @@ class Executable(BuildTarget):
typename = 'executable'
- def __init__(self, name: str, subdir: str, subproject: str, for_machine: MachineChoice,
- sources: T.List[SourceOutputs], structured_sources: T.Optional['StructuredSources'],
- objects, environment: environment.Environment, compilers: T.Dict[str, 'Compiler'],
- kwargs):
+ def __init__(
+ self,
+ name: str,
+ subdir: str,
+ subproject: SubProject,
+ for_machine: MachineChoice,
+ sources: T.List['SourceOutputs'],
+ structured_sources: T.Optional[StructuredSources],
+ objects: T.List[ObjectTypes],
+ environment: environment.Environment,
+ compilers: T.Dict[str, 'Compiler'],
+ kwargs):
key = OptionKey('b_pie')
if 'pie' not in kwargs and key in environment.coredata.options:
kwargs['pie'] = environment.coredata.options[key].value
@@ -1934,10 +1952,18 @@ class StaticLibrary(BuildTarget):
typename = 'static library'
- def __init__(self, name: str, subdir: str, subproject: str, for_machine: MachineChoice,
- sources: T.List[SourceOutputs], structured_sources: T.Optional['StructuredSources'],
- objects, environment: environment.Environment, compilers: T.Dict[str, 'Compiler'],
- kwargs):
+ def __init__(
+ self,
+ name: str,
+ subdir: str,
+ subproject: SubProject,
+ for_machine: MachineChoice,
+ sources: T.List['SourceOutputs'],
+ structured_sources: T.Optional[StructuredSources],
+ objects: T.List[ObjectTypes],
+ environment: environment.Environment,
+ compilers: T.Dict[str, 'Compiler'],
+ kwargs):
self.prelink = kwargs.get('prelink', False)
if not isinstance(self.prelink, bool):
raise InvalidArguments('Prelink keyword argument must be a boolean.')
@@ -2006,10 +2032,18 @@ class SharedLibrary(BuildTarget):
typename = 'shared library'
- def __init__(self, name: str, subdir: str, subproject: str, for_machine: MachineChoice,
- sources: T.List[SourceOutputs], structured_sources: T.Optional['StructuredSources'],
- objects, environment: environment.Environment, compilers: T.Dict[str, 'Compiler'],
- kwargs):
+ def __init__(
+ self,
+ name: str,
+ subdir: str,
+ subproject: SubProject,
+ for_machine: MachineChoice,
+ sources: T.List['SourceOutputs'],
+ structured_sources: T.Optional[StructuredSources],
+ objects: T.List[ObjectTypes],
+ environment: environment.Environment,
+ compilers: T.Dict[str, 'Compiler'],
+ kwargs):
self.soversion = None
self.ltversion = None
# Max length 2, first element is compatibility_version, second is current_version
@@ -2340,10 +2374,18 @@ class SharedModule(SharedLibrary):
typename = 'shared module'
- def __init__(self, name: str, subdir: str, subproject: str, for_machine: MachineChoice,
- sources: T.List[SourceOutputs], structured_sources: T.Optional['StructuredSources'],
- objects, environment: environment.Environment,
- compilers: T.Dict[str, 'Compiler'], kwargs):
+ def __init__(
+ self,
+ name: str,
+ subdir: str,
+ subproject: SubProject,
+ for_machine: MachineChoice,
+ sources: T.List['SourceOutputs'],
+ structured_sources: T.Optional[StructuredSources],
+ objects: T.List[ObjectTypes],
+ environment: environment.Environment,
+ compilers: T.Dict[str, 'Compiler'],
+ kwargs):
if 'version' in kwargs:
raise MesonException('Shared modules must not specify the version kwarg.')
if 'soversion' in kwargs: