summaryrefslogtreecommitdiff
path: root/mesonbuild/modules
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-10-24 09:37:54 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2025-12-22 11:59:07 +0100
commitf87cc4da40693345103264e205463e1689c7a956 (patch)
tree5e37048e2983a770fbb03a5449341ebafc0eec03 /mesonbuild/modules
parent71e56514f07ab972375bde5f094ad7a39d996ac0 (diff)
downloadmeson-f87cc4da40693345103264e205463e1689c7a956.tar.gz
modules: rust: add workspace methods returning arguments for build targets
Add rustc_args(), env(), and rust_dependency_map() methods to the RustPackage class. They simply delegate to PackageState and PackageConfiguration. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r--mesonbuild/modules/rust.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/mesonbuild/modules/rust.py b/mesonbuild/modules/rust.py
index 186774413..0ea1c8f7e 100644
--- a/mesonbuild/modules/rust.py
+++ b/mesonbuild/modules/rust.py
@@ -158,6 +158,9 @@ class RustCrate(ModuleObject):
'features': self.features_method,
'name': self.name_method,
'version': self.version_method,
+ 'rust_args': self.rust_args_method,
+ 'env': self.env_method, # type: ignore[dict-item]
+ 'rust_dependency_map': self.rust_dependency_map_method, # type: ignore[dict-item]
})
@noPosargs
@@ -190,6 +193,24 @@ class RustCrate(ModuleObject):
"""Returns chosen features for specific package."""
return sorted(list(self.package.cfg.features))
+ @noPosargs
+ @noKwargs
+ def rust_args_method(self, state: ModuleState, args: T.List, kwargs: TYPE_kwargs) -> T.List[str]:
+ """Returns rustc arguments for this package."""
+ return self.package.get_rustc_args(state.environment, state.subdir, mesonlib.MachineChoice.HOST)
+
+ @noPosargs
+ @noKwargs
+ def env_method(self, state: ModuleState, args: T.List, kwargs: TYPE_kwargs) -> T.Dict[str, str]:
+ """Returns environment variables for this package."""
+ return self.package.get_env_dict(state.environment, state.subdir)
+
+ @noPosargs
+ @noKwargs
+ def rust_dependency_map_method(self, state: ModuleState, args: T.List, kwargs: TYPE_kwargs) -> T.Dict[str, str]:
+ """Returns rust dependency mapping for this package."""
+ return self.package.cfg.get_dependency_map(self.package.manifest)
+
class RustPackage(RustCrate):
"""Represents a Rust package within a workspace."""