Skip to content

Conversation

@bonzini
Copy link
Collaborator

@bonzini bonzini commented Aug 5, 2025

My own cleaned up and fixed version of #14681. While crates.io splits member of a workspace into separate packages, it's still useful to support workspaces for "git" wraps.

There is one important change compared to both current versions and that PR: Meson will now parse a Cargo.lock in the toplevel source directory, and use it to resolve the versions of Cargo subprojects in preference to per-subproject Cargo.lock files. This makes sure that all subprojects use a consistent version of a crate. This is logically a separate change, so I have pulled it out in #14906 merged

@bonzini bonzini added the dependencies:cargo Issues related to using cargo subprojects label Aug 5, 2025
@bonzini bonzini force-pushed the cargo-workspace2 branch 4 times, most recently from 0726b0e to 40d7758 Compare August 13, 2025 17:27
@bonzini bonzini added this to the 1.10 milestone Aug 25, 2025
@bonzini bonzini marked this pull request as ready for review August 25, 2025 14:50
@bonzini bonzini requested a review from jpakkane as a code owner August 25, 2025 14:50
@bonzini
Copy link
Collaborator Author

bonzini commented Sep 23, 2025

@xclaesse can you take a look? It does work with your gstreamer plugins testcase.

@bonzini bonzini changed the title Cargo workspace support Workspace support for Cargo subprojects Sep 24, 2025
@bonzini bonzini force-pushed the cargo-workspace2 branch 2 times, most recently from a558538 to 7bb6efc Compare October 7, 2025 16:38
@xclaesse
Copy link
Member

LGTM, thanks for rebasing my work!

Extracted from a patch by Xavier Claessens <xclaessens@netflix.com>
With workspace support, backslashes can appear in subdir() invocations
generated by the Cargo interpreter.

If the arguments form valid escapes, for example subdir('dir\foo'),
the interpreter will parse the '\f' as a single form feed character,
and produce errors such as

       os.makedirs(os.path.join(self.environment.build_dir, subdir), exist_ok=True)
     File "C:\hostedtoolcache\windows\Python\3.7.9\x64\lib\os.py", line 223, in makedirs
       mkdir(name, mode)
   OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'D:\\a\\1\\s\\b c09188aed5\\subprojects\\foo\\dir\x0coo'

Use escape=False just like the cmake interpreter does.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Extracted from a patch by Xavier Claessens <xclaessens@netflix.com>
Extracted from a patch by Xavier Claessens <xclaessens@netflix.com>
xclaesse and others added 4 commits October 17, 2025 11:51
Cargo workspaces will use this to have a single subproject defining
multiple crates.
Extracted from a patch by Xavier Claessens <xclaessens@netflix.com>
Extracted from a patch by Xavier Claessens <xclaessens@netflix.com>
Extracted from a patch by Xavier Claessens <xclaessens@netflix.com>,
adjusted to make it compile with cargo.
@xclaesse xclaesse merged commit ca8b6eb into mesonbuild:master Oct 17, 2025
34 of 62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies:cargo Issues related to using cargo subprojects

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants