diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2025-10-28 13:33:09 +0100 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2025-12-22 12:01:05 +0100 |
| commit | dcf3af6b4e755a5da76eeea91332ca3dce17810f (patch) | |
| tree | c631924f7eafc241806c9d8eb713f1df29f2fd95 /mesonbuild/modules/rust.py | |
| parent | 013121d3dda42b2bf70cb53675e3f3fe432b1d97 (diff) | |
| download | meson-dcf3af6b4e755a5da76eeea91332ca3dce17810f.tar.gz | |
modules: rust: invoke subprojects automatically from dependencies()
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild/modules/rust.py')
| -rw-r--r-- | mesonbuild/modules/rust.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/mesonbuild/modules/rust.py b/mesonbuild/modules/rust.py index c1fcf049d..974d50ae6 100644 --- a/mesonbuild/modules/rust.py +++ b/mesonbuild/modules/rust.py @@ -23,7 +23,7 @@ from ..interpreter.type_checking import ( ) from ..interpreterbase import ContainerTypeInfo, InterpreterException, KwargInfo, typed_kwargs, typed_pos_args, noKwargs, noPosargs, permittedKwargs from ..interpreter.interpreterobjects import Doctest -from ..mesonlib import File, MachineChoice, MesonException, PerMachine +from ..mesonlib import (is_parent_path, File, MachineChoice, MesonException, PerMachine) from ..programs import ExternalProgram, NonExistingExternalProgram if T.TYPE_CHECKING: @@ -116,6 +116,10 @@ class RustWorkspace(ModuleObject): 'subproject': self.subproject_method, }) + @property + def subdir(self) -> str: + return self.ws.subdir + @noPosargs @noKwargs def packages_method(self, state: ModuleState, args: T.List, kwargs: TYPE_kwargs) -> T.List[str]: @@ -245,6 +249,10 @@ class RustPackage(RustCrate): if kwargs['dependencies']: for dep_key, dep_pkg in cfg.dep_packages.items(): if dep_pkg.manifest.lib: + if dep_pkg.ws_subdir != self.rust_ws.subdir or \ + is_parent_path(os.path.join(self.rust_ws.subdir, state.subproject_dir), + dep_pkg.path): + self.rust_ws._do_subproject(dep_pkg) # Get the dependency name for this package depname = dep_pkg.get_dependency_name(None) dependency = state.overridden_dependency(depname) |
