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

Package workspaces #13947

Merged
merged 3 commits into from
Jul 26, 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
20 changes: 20 additions & 0 deletions src/bin/cargo/commands/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use cargo::ops::{self, PackageOpts};
pub fn cli() -> Command {
epage marked this conversation as resolved.
Show resolved Hide resolved
subcommand("package")
.about("Assemble the local package into a distributable tarball")
.arg_index("Registry index URL to prepare the package for (unstable)")
.arg_registry("Registry to prepare the package for (unstable)")
.arg(
flag(
"list",
Expand Down Expand Up @@ -41,6 +43,23 @@ pub fn cli() -> Command {
}

pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult {
if args._value_of("registry").is_some() {
gctx.cli_unstable().fail_if_stable_opt_custom_z(
"--registry",
13947,
"package-workspace",
gctx.cli_unstable().package_workspace,
)?;
}
if args._value_of("index").is_some() {
gctx.cli_unstable().fail_if_stable_opt_custom_z(
"--index",
13947,
"package-workspace",
gctx.cli_unstable().package_workspace,
)?;
}
let reg_or_index = args.registry_or_index(gctx)?;
let ws = args.workspace(gctx)?;
if ws.root_maybe().is_embedded() {
return Err(anyhow::format_err!(
Expand All @@ -64,6 +83,7 @@ pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult {
jobs: args.jobs()?,
keep_going: args.keep_going(),
cli_features: args.cli_features()?,
reg_or_index,
},
)?;

Expand Down
2 changes: 2 additions & 0 deletions src/cargo/core/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,7 @@ unstable_cli_options!(
mtime_on_use: bool = ("Configure Cargo to update the mtime of used files"),
next_lockfile_bump: bool,
no_index_update: bool = ("Do not update the registry index even if the cache is outdated"),
package_workspace: bool = ("Handle intra-workspace dependencies when packaging"),
panic_abort_tests: bool = ("Enable support to run tests with -Cpanic=abort"),
profile_rustflags: bool = ("Enable the `rustflags` option in profiles in .cargo/config.toml file"),
public_dependency: bool = ("Respect a dependency's `public` field in Cargo.toml to control public/private dependencies"),
Expand Down Expand Up @@ -1276,6 +1277,7 @@ impl CliUnstable {
// can also be set in .cargo/config or with and ENV
"mtime-on-use" => self.mtime_on_use = parse_empty(k, v)?,
"no-index-update" => self.no_index_update = parse_empty(k, v)?,
"package-workspace" => self.package_workspace= parse_empty(k, v)?,
"panic-abort-tests" => self.panic_abort_tests = parse_empty(k, v)?,
"public-dependency" => self.public_dependency = parse_empty(k, v)?,
"profile-rustflags" => self.profile_rustflags = parse_empty(k, v)?,
Expand Down
Loading