rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.71k stars 2.42k forks source link

Make workspace member inclusion/exclusion more useful, consistent, and intuitive #11405

Open weihanglo opened 1 year ago

weihanglo commented 1 year ago

Problem

As of now, Cargo supports glob syntax for workspace.member to include crates as workspace members. However, for workspace.exclude it is implemented by a plain starts_with comparing with manifest path of certain crates. This confuses people as they need to figure out which rules overrides the other. It is also inconsistent with package.include and package.exclude, as they choose gitignore syntax.

For workspace.member, it proactively checks the existence of Cargo.toml to include a member, and throws an errors if Cargo.toml doesn't exist, which makes globbing **/* often invalid.

Similar issues have been raised from time to time:

Proposed Solution

There are several possible ways to "fix" the situation (to some extent).

There might be other possible solution I am not aware of here.

[^1]: An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded. See https://git-scm.com/docs/gitignore#_pattern_format

Notes

I would keep this as the main issue and close some. If this is inappropriate, please say it out load, and we can reopen the original issues.

Rustin170506 commented 1 year ago

I would like to find a solution to this issue. @rustbot claim