Skip to content

Commit

Permalink
Merge pull request #139 from slonopotamus/cargo-metadata-lookup
Browse files Browse the repository at this point in the history
Fix package lookup in Cargo metadata
  • Loading branch information
mdsteele authored Mar 17, 2023
2 parents 0b31194 + 759a23b commit eb9fe1b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/bundle/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,11 @@ impl Settings {
let features = matches.value_of("features").map(|features| features.into());
let cargo_settings = load_metadata(&current_dir)?;
// TODO: support multiple packages?
let package = match cargo_settings.packages.get(0) {
let package_id = match cargo_settings.workspace_members.get(0) {
Some(package_info) => package_info,
None => bail!("No 'package' info found in 'Cargo.toml'"),
None => bail!("Cargo workspace is empty"),
};
let package = cargo_settings[package_id].clone();
let workspace_dir = Settings::get_workspace_dir(current_dir);
let target_dir =
Settings::get_target_dir(&workspace_dir, &target, &profile, &build_artifact);
Expand All @@ -169,7 +170,7 @@ impl Settings {
};
let binary_path = target_dir.join(&binary_name);
Ok(Settings {
package: package.clone(),
package,
package_type,
target,
features,
Expand Down

0 comments on commit eb9fe1b

Please sign in to comment.