Skip to content

Commit

Permalink
fix(publish): Override default-members
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed May 26, 2022
1 parent 9dcdcc7 commit ba6d4f1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ pub fn package_content(manifest_path: &Path) -> Result<Vec<std::path::PathBuf>,
}
}

#[allow(clippy::too_many_arguments)]
pub fn publish(
dry_run: bool,
verify: bool,
manifest_path: &Path,
pkgid: Option<&str>,
features: &Features,
registry: Option<&str>,
token: Option<&str>,
Expand All @@ -66,6 +68,11 @@ pub fn publish(
manifest_path.to_str().unwrap(),
];

if let Some(pkgid) = pkgid {
command.push("--package");
command.push(pkgid);
}

if let Some(registry) = registry {
command.push("--registry");
command.push(registry);
Expand Down
10 changes: 9 additions & 1 deletion src/release.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,22 +488,30 @@ fn release_packages<'m>(
};
// 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
};
if !cargo::publish(
dry_run,
verify,
pkg.manifest_path,
pkgid,
features,
pkg.config.registry(),
args.token.as_ref().map(AsRef::as_ref),
pkg.config.target.as_ref().map(AsRef::as_ref),
)? {
return Ok(103);
}
let timeout = std::time::Duration::from_secs(300);

if pkg.config.registry().is_none() {
let mut index = crates_index::Index::new_cargo_default()?;

let timeout = std::time::Duration::from_secs(300);
let version = pkg.version.as_ref().unwrap_or(&pkg.prev_version);
cargo::wait_for_publish(
&mut index,
Expand Down

0 comments on commit ba6d4f1

Please sign in to comment.