Skip to content

Commit 27e81bc

Browse files
committed
Re-add deprecated out-dir
1 parent 6280e4b commit 27e81bc

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/bin/cargo/commands/build.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,18 @@ pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult {
5050
let mut compile_opts =
5151
args.compile_options(gctx, CompileMode::Build, Some(&ws), ProfileChecking::Custom)?;
5252

53-
if let Some(artifact_dir) = args.value_of_path("artifact-dir", gctx) {
53+
let mut artifact_dir_arg = args.value_of_path("artifact-dir", gctx);
54+
55+
if artifact_dir_arg.is_none() {
56+
let out_dir_arg = args.value_of_path("out-dir", gctx);
57+
if out_dir_arg.is_some() {
58+
gctx.shell()
59+
.warn("the --out-dir flag has been changed to --artifact-dir")?;
60+
}
61+
artifact_dir_arg = out_dir_arg
62+
}
63+
64+
if let Some(artifact_dir) = artifact_dir_arg {
5465
compile_opts.build_config.export_dir = Some(artifact_dir);
5566
} else if let Some(out_dir) = gctx.build_config()?.out_dir.as_ref() {
5667
let artifact_dir = out_dir.resolve_path(gctx);

src/cargo/util/command_prelude.rs

+10
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ pub trait CommandExt: Sized {
403403
.action(ArgAction::SetTrue)
404404
.hide(true)
405405
};
406+
406407
self._arg(
407408
opt(
408409
"artifact-dir",
@@ -412,6 +413,15 @@ pub trait CommandExt: Sized {
412413
.help_heading(heading::COMPILATION_OPTIONS),
413414
)
414415
._arg(unsupported_short_arg)
416+
._arg(
417+
opt(
418+
"out-dir",
419+
"Copy final artifacts to this directory (deprecated; use --artifact-dir instead)",
420+
)
421+
.value_name("PATH")
422+
.conflicts_with("artifact-dir")
423+
.hide(true),
424+
)
415425
}
416426
}
417427

0 commit comments

Comments
 (0)