interpreter: use typed_kwargs for build_target(vs_module_defs)

pull/12302/head
Dylan Baker 1 year ago committed by Eli Schwartz
parent f485a8cf16
commit f4ea89be60
  1. 2
      mesonbuild/build.py
  2. 4
      mesonbuild/interpreter/kwargs.py
  3. 8
      mesonbuild/interpreter/type_checking.py

@ -2321,7 +2321,7 @@ class SharedLibrary(BuildTarget):
self.darwin_versions = (self.soversion, self.soversion)
# Visual Studio module-definitions file
if 'vs_module_defs' in kwargs:
if kwargs.get('vs_module_defs') is not None:
path = kwargs['vs_module_defs']
if isinstance(path, str):
if os.path.isabs(path):

@ -359,6 +359,7 @@ class _SharedLibMixin(TypedDict):
darwin_versions: T.Optional[T.Tuple[str, str]]
soversion: T.Optional[str]
version: T.Optional[str]
vs_module_defs: T.Optional[T.Union[str, File, build.CustomTarget]]
class SharedLibrary(_BuildTarget, _SharedLibMixin, _LibraryMixin):
@ -366,7 +367,8 @@ class SharedLibrary(_BuildTarget, _SharedLibMixin, _LibraryMixin):
class SharedModule(_BuildTarget, _LibraryMixin):
pass
vs_module_defs: T.Optional[T.Union[str, File, build.CustomTarget]]
class Library(_BuildTarget, _SharedLibMixin, _StaticLibMixin, _LibraryMixin):

@ -513,6 +513,11 @@ RUST_ABI_KW: KwargInfo[T.Union[str, None]] = KwargInfo(
since='1.3.0',
validator=in_set_validator({'rust', 'c'}))
_VS_MODULE_DEFS_KW: KwargInfo[T.Optional[T.Union[str, File, CustomTarget]]] = KwargInfo(
'vs_module_defs',
(str, File, CustomTarget, NoneType),
)
# Applies to all build_target like classes
_ALL_TARGET_KWS: T.List[KwargInfo] = [
OVERRIDE_OPTIONS_KW,
@ -629,6 +634,7 @@ SHARED_LIB_KWS = [
*_BUILD_TARGET_KWS,
*_EXCLUSIVE_SHARED_LIB_KWS,
*_EXCLUSIVE_LIB_KWS,
_VS_MODULE_DEFS_KW,
]
# Arguments exclusive to SharedModule. These are separated to make integrating
@ -640,6 +646,7 @@ SHARED_MOD_KWS = [
*_BUILD_TARGET_KWS,
*_EXCLUSIVE_SHARED_MOD_KWS,
*_EXCLUSIVE_LIB_KWS,
_VS_MODULE_DEFS_KW,
]
# Arguments exclusive to JAR. These are separated to make integrating
@ -662,6 +669,7 @@ LIBRARY_KWS = [
*_EXCLUSIVE_SHARED_LIB_KWS,
*_EXCLUSIVE_SHARED_MOD_KWS,
*_EXCLUSIVE_STATIC_LIB_KWS,
_VS_MODULE_DEFS_KW,
]
# Arguments used by build_Target

Loading…
Cancel
Save