backend/ninja: add missing typing annotations

pull/13021/head
Dylan Baker 1 year ago
parent 875a9b789f
commit 934c9074bd
  1. 18
      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
"""

Loading…
Cancel
Save