build: fully type CompileTarget

Which is pretty trivial
pull/11463/head
Dylan Baker 2 years ago committed by Eli Schwartz
parent a769a0de35
commit 162ac25beb
  1. 11
      mesonbuild/build.py
  2. 10
      mesonbuild/interpreter/compiler.py

@ -26,7 +26,6 @@ import re
import textwrap
import typing as T
from . import environment
from . import dependencies
from . import mlog
@ -2665,8 +2664,16 @@ class CompileTarget(BuildTarget):
output_templ: str,
compiler: Compiler,
backend: Backend,
kwargs):
compile_args: T.List[str],
include_directories: T.List[IncludeDirs],
dependencies: T.List[dependencies.Dependency]):
compilers = {compiler.get_language(): compiler}
kwargs = {
'build_by_default': False,
f'{compiler.language}_args': compile_args,
'include_directories': include_directories,
'dependencies': dependencies,
}
super().__init__(name, subdir, subproject, compiler.for_machine,
sources, None, [], environment, compilers, kwargs)
self.filename = name

@ -773,12 +773,6 @@ class CompilerHolder(ObjectHolder['Compiler']):
if any(isinstance(s, (build.CustomTarget, build.CustomTargetIndex, build.GeneratedList)) for s in sources):
FeatureNew.single_use('compiler.preprocess with generated sources', '1.1.0', self.subproject,
location=self.current_node)
tg_kwargs = {
f'{self.compiler.language}_args': kwargs['compile_args'],
'build_by_default': False,
'include_directories': kwargs['include_directories'],
'dependencies': kwargs['dependencies'],
}
tg_name = f'preprocessor_{next(self.preprocess_uid)}'
tg = build.CompileTarget(
tg_name,
@ -789,7 +783,9 @@ class CompilerHolder(ObjectHolder['Compiler']):
kwargs['output'],
compiler,
self.interpreter.backend,
tg_kwargs)
kwargs['compile_args'],
kwargs['include_directories'],
kwargs['dependencies'])
self.interpreter.add_target(tg.name, tg)
# Expose this target as list of its outputs, so user can pass them to
# other targets, list outputs, etc.

Loading…
Cancel
Save