Skip to content

improve support for cargo workspaces #273

@0xalpharush

Description

@0xalpharush

I am getting an error like Error: package '/Users/alpharush/tob/../Cargo.toml' is a member of the wrong workspace. Can we improve support for cargo workspaces?

Probably relevant to the fix:

siderophile/src/main.rs

Lines 41 to 67 in debb857

let config = cargo::Config::default()?;
let workspace_root = cargo::util::important_paths::find_root_manifest_for_wd(config.cwd())?;
let ws = cargo::core::Workspace::new(&workspace_root, &config)?;
let mut ws = if let Some(name) = &args.package {
let package =
find_package(&ws, name).ok_or_else(|| anyhow!("Could not find package `{}`", name))?;
Workspace::ephemeral(package.clone(), &config, None, false)?
} else {
ws
};
let tempdir = tempdir_in(config.cwd())?;
ws.set_target_dir(Filesystem::new(tempdir.path().to_path_buf()));
let crate_name = crate_name(&ws, &args.package)?;
if let Some(deprecated_crate_name) = &args.crate_name {
eprintln!("Warning: `--crate-name` is deprecated. Use `--package` instead.");
if deprecated_crate_name != &crate_name {
bail!(
"Crate `{}` was specified, but crate `{}` was found",
deprecated_crate_name,
crate_name
);
}
}

Maybe related to #31

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions