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

fix(publish): Be precise in PackageId used #827

Merged
merged 3 commits into from
Oct 7, 2024
Merged
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
<!-- next-header -->
## [Unreleased] - ReleaseDate

### Compatibility

- Runtime MSRV is now 1.77

## [0.25.12] - 2024-10-07

### Compatibility
Expand Down
8 changes: 4 additions & 4 deletions src/ops/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ fn do_call(
dry_run: bool,
) -> CargoResult<bool> {
let command: Vec<_> = command.into_iter().map(|s| s.into()).collect();
if path.is_some() {
log::trace!("cd {}", path.unwrap().display());
}
log::trace!("{}", command.join(" "));
if dry_run {
if path.is_some() {
log::trace!("cd {}", path.unwrap().display());
}
log::trace!("{}", command.join(" "));
return Ok(true);
}
let mut iter = command.iter();
Expand Down
17 changes: 4 additions & 13 deletions src/steps/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl PublishStep {
super::confirm("Publish", &selected_pkgs, self.no_confirm, dry_run)?;

// STEP 3: cargo publish
publish(&ws_meta, &selected_pkgs, dry_run)?;
publish(&selected_pkgs, dry_run)?;

super::finish(failed, dry_run)
}
Expand All @@ -164,11 +164,7 @@ impl PublishStep {
}
}

pub fn publish(
ws_meta: &cargo_metadata::Metadata,
pkgs: &[plan::PackageRelease],
dry_run: bool,
) -> Result<(), CliError> {
pub fn publish(pkgs: &[plan::PackageRelease], dry_run: bool) -> Result<(), CliError> {
for pkg in pkgs {
if !pkg.config.publish() {
continue;
Expand All @@ -187,13 +183,8 @@ pub fn publish(
};
// feature list to release
let features = &pkg.features;
let pkgid = if 1 < ws_meta.workspace_members.len() {
// Override `workspace.default-members`
Some(crate_name)
} else {
// `-p` is not recommended outside of a workspace
None
};
// Despite `cargo_metadata`s docs, `id` was stabilized as `cargo pkgid` as of 1.77
let pkgid = Some(pkg.meta.id.repr.as_str());
if !crate::ops::cargo::publish(
dry_run,
verify,
Expand Down
2 changes: 1 addition & 1 deletion src/steps/release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ impl ReleaseStep {
}

// STEP 3: cargo publish
super::publish::publish(&ws_meta, &selected_pkgs, dry_run)?;
super::publish::publish(&selected_pkgs, dry_run)?;
super::owner::ensure_owners(&selected_pkgs, dry_run)?;

// STEP 5: Tag
Expand Down
Loading