Skip to content

Commit

Permalink
backend/ninja: add missing typing annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
dcbaker committed Mar 28, 2024
1 parent 875a9b7 commit 934c907
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions mesonbuild/backend/ninjabackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,8 +855,8 @@ def generate_target(self, target):
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
Expand Down Expand Up @@ -939,7 +939,7 @@ def generate_target(self, target):
# 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):
Expand Down Expand Up @@ -1084,7 +1084,10 @@ def should_use_dyndeps_for_target(self, target: 'build.BuildTarget') -> bool:
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
Expand Down Expand Up @@ -1113,7 +1116,7 @@ def generate_dependency_scan_target(self, target: build.BuildTarget, compiled_so
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.
Expand Down Expand Up @@ -2763,7 +2766,7 @@ def get_link_debugfile_name(self, linker, target) -> T.Optional[str]:
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()
Expand Down Expand Up @@ -2925,7 +2928,8 @@ def generate_single_compile(self, target: build.BuildTarget, src,
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
"""
Expand Down

0 comments on commit 934c907

Please sign in to comment.