Skip to content
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

Error: src/examples/README.md/Cargo.toml: Not a directory #29

Open
parasyte opened this issue Oct 28, 2024 · 1 comment
Open

Error: src/examples/README.md/Cargo.toml: Not a directory #29

parasyte opened this issue Oct 28, 2024 · 1 comment

Comments

@parasyte
Copy link

When parsing workspace.members, the result of glob matching doesn't filter directories. It will gladly append Cargo.toml to file paths like README.md:

for member in &workspace.members {
for manifest_dir in glob::glob(workspace_root.join(member).to_str().unwrap())? {
let manifest_dir = manifest_dir?;
let manifest_path = manifest_dir.join("Cargo.toml");
let manifest = Manifest::parse_from_toml(&manifest_path)?;

Assumes a manifest being parsed contains:

[workspace]
members = [
    "examples/*",
    "tests/*",
]

... and these directories contain a README.md or other files as direct children. An example repo in the wild where this is done:

This kind of setup causes Subcommand::new() to return an error here:

utils::find_package_manifest_in_workspace(
workspace_manifest,
potential_manifest,
package,
)?

The glob result needs to be filtered to match directories. Checking manifest_dir.is_dir() is a good start, but symlinks also need to be followed.

@MarijnS95
Copy link
Member

Looks like xbuild suffers the same issue too: rust-mobile/xbuild#183 / rust-mobile/xbuild#184

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants