aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2023-04-21 16:21:48 -0400
committerXavier Claessens <xclaesse@gmail.com>2023-09-19 13:54:49 -0400
commit10dcd87d002f6f36b1f60371dc807b8d9959d97b (patch)
tree676b5597a7accdd4e2853d7c53f3453535dc5727 /mesonbuild/interpreter
parent8ccdb881374084ddb90ef259539cfd3bb748c904 (diff)
downloadmeson-10dcd87d002f6f36b1f60371dc807b8d9959d97b.zip
meson-10dcd87d002f6f36b1f60371dc807b8d9959d97b.tar.gz
meson-10dcd87d002f6f36b1f60371dc807b8d9959d97b.tar.bz2
Rust: Replace rust_crate_type with rust_abi
Meson already knows if it's a shared or static library, user only need to specify the ABI (Rust or C).
Diffstat (limited to 'mesonbuild/interpreter')
-rw-r--r--mesonbuild/interpreter/type_checking.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/mesonbuild/interpreter/type_checking.py b/mesonbuild/interpreter/type_checking.py
index 59dae9a..9a1904d 100644
--- a/mesonbuild/interpreter/type_checking.py
+++ b/mesonbuild/interpreter/type_checking.py
@@ -498,6 +498,21 @@ TEST_KWS: T.List[KwargInfo] = [
KwargInfo('verbose', bool, default=False, since='0.62.0'),
]
+# Cannot have a default value because we need to check that rust_crate_type and
+# rust_abi are mutually exclusive.
+RUST_CRATE_TYPE_KW: KwargInfo[T.Union[str, None]] = KwargInfo(
+ 'rust_crate_type', (str, NoneType),
+ since='0.42.0',
+ since_values={'proc-macro': '0.62.0'},
+ deprecated='1.3.0',
+ deprecated_message='Use rust_abi or rust.proc_macro() instead.',
+ validator=in_set_validator({'bin', 'lib', 'rlib', 'dylib', 'cdylib', 'staticlib', 'proc-macro'}))
+
+RUST_ABI_KW: KwargInfo[T.Union[str, None]] = KwargInfo(
+ 'rust_abi', (str, NoneType),
+ since='1.3.0',
+ validator=in_set_validator({'rust', 'c'}))
+
# Applies to all build_target like classes
_ALL_TARGET_KWS: T.List[KwargInfo] = [
OVERRIDE_OPTIONS_KW,
@@ -506,6 +521,7 @@ _ALL_TARGET_KWS: T.List[KwargInfo] = [
# Applies to all build_target classes except jar
_BUILD_TARGET_KWS: T.List[KwargInfo] = [
*_ALL_TARGET_KWS,
+ RUST_CRATE_TYPE_KW,
]
def _validate_win_subsystem(value: T.Optional[str]) -> T.Optional[str]:
@@ -575,6 +591,11 @@ EXECUTABLE_KWS = [
*_EXCLUSIVE_EXECUTABLE_KWS,
]
+# Arguments exclusive to library types
+_EXCLUSIVE_LIB_KWS: T.List[KwargInfo] = [
+ RUST_ABI_KW,
+]
+
# Arguments exclusive to StaticLibrary. These are separated to make integrating
# them into build_target easier
_EXCLUSIVE_STATIC_LIB_KWS: T.List[KwargInfo] = []
@@ -583,6 +604,7 @@ _EXCLUSIVE_STATIC_LIB_KWS: T.List[KwargInfo] = []
STATIC_LIB_KWS = [
*_BUILD_TARGET_KWS,
*_EXCLUSIVE_STATIC_LIB_KWS,
+ *_EXCLUSIVE_LIB_KWS,
]
# Arguments exclusive to SharedLibrary. These are separated to make integrating
@@ -597,6 +619,7 @@ _EXCLUSIVE_SHARED_LIB_KWS: T.List[KwargInfo] = [
SHARED_LIB_KWS = [
*_BUILD_TARGET_KWS,
*_EXCLUSIVE_SHARED_LIB_KWS,
+ *_EXCLUSIVE_LIB_KWS,
]
# Arguments exclusive to SharedModule. These are separated to make integrating
@@ -607,6 +630,7 @@ _EXCLUSIVE_SHARED_MOD_KWS: T.List[KwargInfo] = []
SHARED_MOD_KWS = [
*_BUILD_TARGET_KWS,
*_EXCLUSIVE_SHARED_MOD_KWS,
+ *_EXCLUSIVE_LIB_KWS,
]
# Arguments exclusive to JAR. These are separated to make integrating
@@ -625,6 +649,7 @@ JAR_KWS = [
# Arguments used by both_library and library
LIBRARY_KWS = [
*_BUILD_TARGET_KWS,
+ *_EXCLUSIVE_LIB_KWS,
*_EXCLUSIVE_SHARED_LIB_KWS,
*_EXCLUSIVE_SHARED_MOD_KWS,
*_EXCLUSIVE_STATIC_LIB_KWS,