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

manifest: Skip non-directories when resolving workspace members #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ pub use args::Args;
pub use artifact::{Artifact, ArtifactType};
pub use config::{EnvError, EnvOption, LocalizedConfig};
pub use error::Error;
pub use manifest::CrateType;
pub use manifest::{CrateType, Manifest};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting complains that one field is not read inside Manifest -> Workspace. We don't expose any public API with Manifest yet but might as well export it.

Or should we mark it all pub(crate)?

pub use profile::Profile;
pub use subcommand::Subcommand;
8 changes: 8 additions & 0 deletions src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,16 @@ impl Manifest {
let mut all_members = HashMap::new();

for member in &workspace.members {
// XXX: Cargo would fail if the glob yielded no file results. But it allows cases where
// the only results are non-directories, including non-glob *file* paths in `members`...
for manifest_dir in glob::glob(workspace_root.join(member).to_str().unwrap())? {
let manifest_dir = manifest_dir?;
if !dunce::canonicalize(&manifest_dir)
.map_err(|e| Error::Io(manifest_dir.clone(), e))?
.is_dir()
{
continue;
}
let manifest_path = manifest_dir.join("Cargo.toml");
let manifest = Manifest::parse_from_toml(&manifest_path)?;

Expand Down
2 changes: 1 addition & 1 deletion src/subcommand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl Subcommand {
args.package.len() < 2,
"Multiple packages are not supported yet by `cargo-subcommand`"
);
let package = args.package.get(0).map(|s| s.as_str());
let package = args.package.first().map(|s| s.as_str());
assert!(
!args.workspace,
"`--workspace` is not supported yet by `cargo-subcommand`"
Expand Down
Loading