|
|
@ -31,7 +31,7 @@ from ..interpreterbase import InterpreterException, InvalidArguments, InvalidCod |
|
|
|
from ..interpreterbase import Disabler, disablerIfNotFound |
|
|
|
from ..interpreterbase import Disabler, disablerIfNotFound |
|
|
|
from ..interpreterbase import FeatureNew, FeatureDeprecated, FeatureBroken, FeatureNewKwargs |
|
|
|
from ..interpreterbase import FeatureNew, FeatureDeprecated, FeatureBroken, FeatureNewKwargs |
|
|
|
from ..interpreterbase import ObjectHolder, ContextManagerObject |
|
|
|
from ..interpreterbase import ObjectHolder, ContextManagerObject |
|
|
|
from ..interpreterbase import stringifyUserArguments |
|
|
|
from ..interpreterbase import stringifyUserArguments, resolve_second_level_holders |
|
|
|
from ..modules import ExtensionModule, ModuleObject, MutableModuleObject, NewExtensionModule, NotFoundExtensionModule |
|
|
|
from ..modules import ExtensionModule, ModuleObject, MutableModuleObject, NewExtensionModule, NotFoundExtensionModule |
|
|
|
from ..optinterpreter import optname_regex |
|
|
|
from ..optinterpreter import optname_regex |
|
|
|
|
|
|
|
|
|
|
@ -1876,6 +1876,7 @@ class Interpreter(InterpreterBase, HoldableObject): |
|
|
|
@permittedKwargs(known_library_kwargs) |
|
|
|
@permittedKwargs(known_library_kwargs) |
|
|
|
@typed_pos_args('both_libraries', str, varargs=SOURCES_VARARGS) |
|
|
|
@typed_pos_args('both_libraries', str, varargs=SOURCES_VARARGS) |
|
|
|
@typed_kwargs('both_libraries', *LIBRARY_KWS, allow_unknown=True) |
|
|
|
@typed_kwargs('both_libraries', *LIBRARY_KWS, allow_unknown=True) |
|
|
|
|
|
|
|
@noSecondLevelHolderResolving |
|
|
|
def func_both_lib(self, node: mparser.BaseNode, |
|
|
|
def func_both_lib(self, node: mparser.BaseNode, |
|
|
|
args: T.Tuple[str, SourcesVarargsType], |
|
|
|
args: T.Tuple[str, SourcesVarargsType], |
|
|
|
kwargs: kwtypes.Library) -> build.BothLibraries: |
|
|
|
kwargs: kwtypes.Library) -> build.BothLibraries: |
|
|
@ -1893,6 +1894,7 @@ class Interpreter(InterpreterBase, HoldableObject): |
|
|
|
@permittedKwargs(known_library_kwargs) |
|
|
|
@permittedKwargs(known_library_kwargs) |
|
|
|
@typed_pos_args('library', str, varargs=SOURCES_VARARGS) |
|
|
|
@typed_pos_args('library', str, varargs=SOURCES_VARARGS) |
|
|
|
@typed_kwargs('library', *LIBRARY_KWS, allow_unknown=True) |
|
|
|
@typed_kwargs('library', *LIBRARY_KWS, allow_unknown=True) |
|
|
|
|
|
|
|
@noSecondLevelHolderResolving |
|
|
|
def func_library(self, node: mparser.BaseNode, |
|
|
|
def func_library(self, node: mparser.BaseNode, |
|
|
|
args: T.Tuple[str, SourcesVarargsType], |
|
|
|
args: T.Tuple[str, SourcesVarargsType], |
|
|
|
kwargs: kwtypes.Library) -> build.Executable: |
|
|
|
kwargs: kwtypes.Library) -> build.Executable: |
|
|
@ -1910,12 +1912,16 @@ class Interpreter(InterpreterBase, HoldableObject): |
|
|
|
@permittedKwargs(known_build_target_kwargs) |
|
|
|
@permittedKwargs(known_build_target_kwargs) |
|
|
|
@typed_pos_args('build_target', str, varargs=SOURCES_VARARGS) |
|
|
|
@typed_pos_args('build_target', str, varargs=SOURCES_VARARGS) |
|
|
|
@typed_kwargs('build_target', *BUILD_TARGET_KWS, allow_unknown=True) |
|
|
|
@typed_kwargs('build_target', *BUILD_TARGET_KWS, allow_unknown=True) |
|
|
|
|
|
|
|
@noSecondLevelHolderResolving |
|
|
|
def func_build_target(self, node: mparser.BaseNode, |
|
|
|
def func_build_target(self, node: mparser.BaseNode, |
|
|
|
args: T.Tuple[str, SourcesVarargsType], |
|
|
|
args: T.Tuple[str, SourcesVarargsType], |
|
|
|
kwargs: kwtypes.BuildTarget |
|
|
|
kwargs: kwtypes.BuildTarget |
|
|
|
) -> T.Union[build.Executable, build.StaticLibrary, build.SharedLibrary, |
|
|
|
) -> T.Union[build.Executable, build.StaticLibrary, build.SharedLibrary, |
|
|
|
build.SharedModule, build.BothLibraries, build.Jar]: |
|
|
|
build.SharedModule, build.BothLibraries, build.Jar]: |
|
|
|
target_type = kwargs['target_type'] |
|
|
|
target_type = kwargs['target_type'] |
|
|
|
|
|
|
|
if target_type not in {'both_libraries', 'library'}: |
|
|
|
|
|
|
|
args, kwargs = resolve_second_level_holders(args, kwargs) |
|
|
|
|
|
|
|
|
|
|
|
if target_type == 'executable': |
|
|
|
if target_type == 'executable': |
|
|
|
return self.build_target(node, args, kwargs, build.Executable) |
|
|
|
return self.build_target(node, args, kwargs, build.Executable) |
|
|
|
elif target_type == 'shared_library': |
|
|
|
elif target_type == 'shared_library': |
|
|
@ -3272,8 +3278,10 @@ class Interpreter(InterpreterBase, HoldableObject): |
|
|
|
default_library = self.coredata.get_option(OptionKey('default_library', subproject=self.subproject)) |
|
|
|
default_library = self.coredata.get_option(OptionKey('default_library', subproject=self.subproject)) |
|
|
|
assert isinstance(default_library, str), 'for mypy' |
|
|
|
assert isinstance(default_library, str), 'for mypy' |
|
|
|
if default_library == 'shared': |
|
|
|
if default_library == 'shared': |
|
|
|
|
|
|
|
args, kwargs = resolve_second_level_holders(args, kwargs) |
|
|
|
return self.build_target(node, args, T.cast('kwtypes.StaticLibrary', kwargs), build.SharedLibrary) |
|
|
|
return self.build_target(node, args, T.cast('kwtypes.StaticLibrary', kwargs), build.SharedLibrary) |
|
|
|
elif default_library == 'static': |
|
|
|
elif default_library == 'static': |
|
|
|
|
|
|
|
args, kwargs = resolve_second_level_holders(args, kwargs) |
|
|
|
return self.build_target(node, args, T.cast('kwtypes.SharedLibrary', kwargs), build.StaticLibrary) |
|
|
|
return self.build_target(node, args, T.cast('kwtypes.SharedLibrary', kwargs), build.StaticLibrary) |
|
|
|
elif default_library == 'both': |
|
|
|
elif default_library == 'both': |
|
|
|
return self.build_both_libraries(node, args, kwargs) |
|
|
|
return self.build_both_libraries(node, args, kwargs) |
|
|
|