-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support glob patterns for crate arguments to --package and --exclude flags #8582
Comments
I am interesting in this and wrote a proof-of-concept. However I need guidance on some design topics. First, we know that cargo uses an onion model to determine the final compilation targets (borrows from @ehuss's comment):
Supposed this issue is trying to deal with workspace level and we can just stick to the function
Here is my proof-of-concept on opt-out process: Packages::OptOut(opt_out) => {
let opt_out = opt_out
.iter()
.map(|pat| (glob::Pattern::new(pat).unwrap(), 0))
.collect::<Vec<_>>();
let packages = ws
.members()
.filter(|pkg| opt_out.iter().any(|(pat, _)| pat.matches(pkg.name().as_str())))
.map(Package::package_id)
.map(PackageIdSpec::from_package_id)
.collect();
let not_match = opt_out
.iter()
.filter(|(_, count)| *count == 0)
.map(|(pat, _)| pat.as_str())
.collect::<Vec<_>>();
if !not_match.is_empty() {
ws.config().shell().warn(format!(
"excluded package(s) {} not found in workspace `{}`",
not_match.join(", "),
ws.root().display(),
))?;
}
packages
} |
Based on the documentation changes, yes. I am not familiar enough with the cargo codebase to comment on the implementation. |
Describe the problem you are trying to solve
In workspaces where there are many crates, I would like to only build/test the crates that share the "peepmatic-" name prefix. Or I would like to exclude all of the crates with the "wasmtime-" name prefix.
Describe the solution you'd like
Support glob-style
*
wildcards for the-p
/--package
and--exclude
flags when building in a workspace, likeNotes
Would help cut down on monstrosities like this:
We could collapse all those excludes into just
--exlude lightbeam --exclude peepmatic*
.The text was updated successfully, but these errors were encountered: