interpreter: use typed_kwargs for build_target.build_by_default
This allows a little bit of cleanup in the build layer, since there is code now that would always be true and we shouldn't do that.
This commit is contained in:
parent
bd0ab92bba
commit
507d8bf4d7
|
@ -652,7 +652,8 @@ class Target(HoldableObject, metaclass=abc.ABCMeta):
|
||||||
self.build_by_default = kwargs['build_by_default']
|
self.build_by_default = kwargs['build_by_default']
|
||||||
if not isinstance(self.build_by_default, bool):
|
if not isinstance(self.build_by_default, bool):
|
||||||
raise InvalidArguments('build_by_default must be a boolean value.')
|
raise InvalidArguments('build_by_default must be a boolean value.')
|
||||||
elif kwargs.get('install', False):
|
|
||||||
|
if not self.build_by_default and kwargs.get('install', False):
|
||||||
# For backward compatibility, if build_by_default is not explicitly
|
# For backward compatibility, if build_by_default is not explicitly
|
||||||
# set, use the value of 'install' if it's enabled.
|
# set, use the value of 'install' if it's enabled.
|
||||||
self.build_by_default = True
|
self.build_by_default = True
|
||||||
|
|
|
@ -3314,7 +3314,6 @@ class Interpreter(InterpreterBase, HoldableObject):
|
||||||
targetclass: T.Type[T.Union[build.Executable, build.StaticLibrary, build.SharedModule, build.SharedLibrary, build.Jar]]
|
targetclass: T.Type[T.Union[build.Executable, build.StaticLibrary, build.SharedModule, build.SharedLibrary, build.Jar]]
|
||||||
) -> T.Union[build.Executable, build.StaticLibrary, build.SharedModule, build.SharedLibrary, build.Jar]:
|
) -> T.Union[build.Executable, build.StaticLibrary, build.SharedModule, build.SharedLibrary, build.Jar]:
|
||||||
@FeatureNewKwargs('build target', '0.42.0', ['build_rpath', 'implicit_include_directories'])
|
@FeatureNewKwargs('build target', '0.42.0', ['build_rpath', 'implicit_include_directories'])
|
||||||
@FeatureNewKwargs('build target', '0.38.0', ['build_by_default'])
|
|
||||||
@FeatureNewKwargs('build target', '0.48.0', ['gnu_symbol_visibility'])
|
@FeatureNewKwargs('build target', '0.48.0', ['gnu_symbol_visibility'])
|
||||||
def build_target_decorator_caller(self, node, args, kwargs):
|
def build_target_decorator_caller(self, node, args, kwargs):
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -325,6 +325,7 @@ class _BaseBuildTarget(TypedDict):
|
||||||
BuildTarget functions.
|
BuildTarget functions.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
build_by_default: bool
|
||||||
override_options: T.Dict[OptionKey, T.Union[str, int, bool, T.List[str]]]
|
override_options: T.Dict[OptionKey, T.Union[str, int, bool, T.List[str]]]
|
||||||
depend_files: NotRequired[T.List[File]]
|
depend_files: NotRequired[T.List[File]]
|
||||||
|
|
||||||
|
|
|
@ -552,6 +552,7 @@ _JAVA_LANG_KW: KwargInfo[T.List[str]] = _BASE_LANG_KW.evolve(
|
||||||
# Applies to all build_target like classes
|
# Applies to all build_target like classes
|
||||||
_ALL_TARGET_KWS: T.List[KwargInfo] = [
|
_ALL_TARGET_KWS: T.List[KwargInfo] = [
|
||||||
OVERRIDE_OPTIONS_KW,
|
OVERRIDE_OPTIONS_KW,
|
||||||
|
KwargInfo('build_by_default', bool, default=True, since='0.38.0'),
|
||||||
]
|
]
|
||||||
|
|
||||||
# Applies to all build_target classes except jar
|
# Applies to all build_target classes except jar
|
||||||
|
|
Loading…
Reference in New Issue