summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2023-11-20 23:41:12 -0800
committerDylan Baker <dylan@pnwbakers.com>2024-03-28 15:30:16 -0700
commit934c9074bdd81c31a67d87a290247007332cdbcf (patch)
treec89226b2818c679d786db147ef74f748223ec9ff
parent875a9b789f2f53fe0bd35d2bbe8277e8294e59f6 (diff)
downloadmeson-934c9074bdd81c31a67d87a290247007332cdbcf.tar.gz
backend/ninja: add missing typing annotations
-rw-r--r--mesonbuild/backend/ninjabackend.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 4987d75a9..d729d1989 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -855,8 +855,8 @@ class NinjaBackend(backends.Backend):
self.generate_custom_target(target)
if isinstance(target, build.RunTarget):
self.generate_run_target(target)
- compiled_sources = []
- source2object = {}
+ compiled_sources: T.List[str] = []
+ source2object: T.Dict[str, str] = {}
name = target.get_id()
if name in self.processed_targets:
return
@@ -939,7 +939,7 @@ class NinjaBackend(backends.Backend):
# this target's sources (generated sources and preexisting sources).
# This will be set as dependencies of all the target's sources. At the
# same time, also deal with generated sources that need to be compiled.
- generated_source_files = []
+ generated_source_files: T.List[File] = []
for rel_src in generated_sources.keys():
raw_src = File.from_built_relative(rel_src)
if self.environment.is_source(rel_src):
@@ -1084,7 +1084,10 @@ class NinjaBackend(backends.Backend):
return False
return True
- def generate_dependency_scan_target(self, target: build.BuildTarget, compiled_sources, source2object, generated_source_files: T.List[mesonlib.File],
+ def generate_dependency_scan_target(self, target: build.BuildTarget,
+ compiled_sources: T.List[str],
+ source2object: T.Dict[str, str],
+ generated_source_files: T.List[mesonlib.File],
object_deps: T.List['mesonlib.FileOrString']) -> None:
if not self.should_use_dyndeps_for_target(target):
return
@@ -1113,7 +1116,7 @@ class NinjaBackend(backends.Backend):
pickle.dump(scaninfo, p)
self.add_build(elem)
- def select_sources_to_scan(self, compiled_sources):
+ def select_sources_to_scan(self, compiled_sources: T.List[str]) -> T.List[str]:
# in practice pick up C++ and Fortran files. If some other language
# requires scanning (possibly Java to deal with inner class files)
# then add them here.
@@ -2763,7 +2766,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
def get_link_debugfile_args(self, linker, target):
return linker.get_link_debugfile_args(self.get_target_debug_filename(target))
- def generate_llvm_ir_compile(self, target, src):
+ def generate_llvm_ir_compile(self, target, src: mesonlib.FileOrString):
base_proxy = target.get_options()
compiler = get_compiler_for_source(target.compilers.values(), src)
commands = compiler.compiler_args()
@@ -2925,7 +2928,8 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
is_generated: bool = False, header_deps=None,
order_deps: T.Optional[T.List['mesonlib.FileOrString']] = None,
extra_args: T.Optional[T.List[str]] = None,
- unity_sources: T.Optional[T.List[mesonlib.FileOrString]] = None) -> None:
+ unity_sources: T.Optional[T.List[mesonlib.FileOrString]] = None,
+ ) -> T.Tuple[str, str]:
"""
Compiles C/C++, ObjC/ObjC++, Fortran, and D sources
"""