From 4b309bc47a78c18acad3daaae4084b2374b1aabf Mon Sep 17 00:00:00 2001
From: valadaptive CARGO_TARGET_DIR
environment variable, or the
Defaults to target
in the root of the workspace.
---out-dir
directory--artifact-dir
directory
This option is unstable and available only on the
nightly channel
diff --git a/src/doc/src/reference/unstable.md b/src/doc/src/reference/unstable.md
index fce26e146c5..5e871aca5ae 100644
--- a/src/doc/src/reference/unstable.md
+++ b/src/doc/src/reference/unstable.md
@@ -28,9 +28,9 @@ how the feature works:
* New command-line flags, options, and subcommands require the `-Z
unstable-options` CLI option to also be included. For example, the new
- `--out-dir` option is only available on nightly:
+ `--artifact-dir` option is only available on nightly:
- ```cargo +nightly build --out-dir=out -Z unstable-options```
+ ```cargo +nightly build --artifact-dir=out -Z unstable-options```
* `-Z` command-line flags are used to enable new functionality that may not
have an interface, or the interface has not yet been designed, or for more
@@ -74,7 +74,7 @@ For the latest nightly, see the [nightly version] of this page.
* [msrv-policy](#msrv-policy) --- MSRV-aware resolver and version selection
* [precise-pre-release](#precise-pre-release) --- Allows pre-release versions to be selected with `update --precise`
* Output behavior
- * [out-dir](#out-dir) --- Adds a directory where artifacts are copied to.
+ * [artifact-dir](#artifact-dir) --- Adds a directory where artifacts are copied to.
* [Different binary name](#different-binary-name) --- Assign a name to the built binary that is separate from the crate name.
* Compile behavior
* [mtime-on-use](#mtime-on-use) --- Updates the last-modified timestamp on every dependency every time it is used, to provide a mechanism to delete unused artifacts.
@@ -206,27 +206,27 @@ minimum versions that you are actually using. That is, if Cargo.toml says
Indirect dependencies are resolved as normal so as not to be blocked on their
minimal version validation.
-## out-dir
+## artifact-dir
* Original Issue: [#4875](https://github.com/rust-lang/cargo/issues/4875)
* Tracking Issue: [#6790](https://github.com/rust-lang/cargo/issues/6790)
-This feature allows you to specify the directory where artifacts will be
-copied to after they are built. Typically artifacts are only written to the
-`target/release` or `target/debug` directories. However, determining the
-exact filename can be tricky since you need to parse JSON output. The
-`--out-dir` flag makes it easier to predictably access the artifacts. Note
-that the artifacts are copied, so the originals are still in the `target`
-directory. Example:
+This feature allows you to specify the directory where artifacts will be copied
+to after they are built. Typically artifacts are only written to the
+`target/release` or `target/debug` directories. However, determining the exact
+filename can be tricky since you need to parse JSON output. The `--artifact-dir`
+flag makes it easier to predictably access the artifacts. Note that the
+artifacts are copied, so the originals are still in the `target` directory.
+Example:
```sh
-cargo +nightly build --out-dir=out -Z unstable-options
+cargo +nightly build --artifact-dir=out -Z unstable-options
```
This can also be specified in `.cargo/config.toml` files.
```toml
[build]
-out-dir = "out"
+artifact-dir = "out"
```
## doctest-xcompile
diff --git a/src/etc/man/cargo-build.1 b/src/etc/man/cargo-build.1
index 9b7a08e4ed1..23e49a15e16 100644
--- a/src/etc/man/cargo-build.1
+++ b/src/etc/man/cargo-build.1
@@ -222,7 +222,7 @@ specified with the \fBCARGO_TARGET_DIR\fR environment variable, or the
Defaults to \fBtarget\fR in the root of the workspace.
.RE
.sp
-\fB\-\-out\-dir\fR \fIdirectory\fR
+\fB\-\-artifact\-dir\fR \fIdirectory\fR
.RS 4
Copy final artifacts to this directory.
.sp
diff --git a/tests/testsuite/out_dir.rs b/tests/testsuite/artifact_dir.rs
similarity index 83%
rename from tests/testsuite/out_dir.rs
rename to tests/testsuite/artifact_dir.rs
index 1b3d4a64ad1..47ef7bfc34e 100644
--- a/tests/testsuite/out_dir.rs
+++ b/tests/testsuite/artifact_dir.rs
@@ -1,4 +1,4 @@
-//! Tests for --out-dir flag.
+//! Tests for --artifact-dir flag.
use cargo_test_support::sleep_ms;
use cargo_test_support::{basic_manifest, project};
@@ -12,8 +12,8 @@ fn binary_with_debug() {
.file("src/main.rs", r#"fn main() { println!("Hello, World!") }"#)
.build();
- p.cargo("build -Z unstable-options --out-dir out")
- .masquerade_as_nightly_cargo(&["out-dir"])
+ p.cargo("build -Z unstable-options --artifact-dir out")
+ .masquerade_as_nightly_cargo(&["artifact-dir"])
.enable_mac_dsym()
.run();
check_dir_contents(
@@ -49,8 +49,8 @@ fn static_library_with_debug() {
)
.build();
- p.cargo("build -Z unstable-options --out-dir out")
- .masquerade_as_nightly_cargo(&["out-dir"])
+ p.cargo("build -Z unstable-options --artifact-dir out")
+ .masquerade_as_nightly_cargo(&["artifact-dir"])
.run();
check_dir_contents(
&p.root().join("out"),
@@ -85,8 +85,8 @@ fn dynamic_library_with_debug() {
)
.build();
- p.cargo("build -Z unstable-options --out-dir out")
- .masquerade_as_nightly_cargo(&["out-dir"])
+ p.cargo("build -Z unstable-options --artifact-dir out")
+ .masquerade_as_nightly_cargo(&["artifact-dir"])
.enable_mac_dsym()
.run();
check_dir_contents(
@@ -121,8 +121,8 @@ fn rlib_with_debug() {
)
.build();
- p.cargo("build -Z unstable-options --out-dir out")
- .masquerade_as_nightly_cargo(&["out-dir"])
+ p.cargo("build -Z unstable-options --artifact-dir out")
+ .masquerade_as_nightly_cargo(&["artifact-dir"])
.run();
check_dir_contents(
&p.root().join("out"),
@@ -165,8 +165,8 @@ fn include_only_the_binary_from_the_current_package() {
.file("utils/src/lib.rs", "")
.build();
- p.cargo("build -Z unstable-options --bin foo --out-dir out")
- .masquerade_as_nightly_cargo(&["out-dir"])
+ p.cargo("build -Z unstable-options --bin foo --artifact-dir out")
+ .masquerade_as_nightly_cargo(&["artifact-dir"])
.enable_mac_dsym()
.run();
check_dir_contents(
@@ -179,14 +179,14 @@ fn include_only_the_binary_from_the_current_package() {
}
#[cargo_test]
-fn out_dir_is_a_file() {
+fn artifact_dir_is_a_file() {
let p = project()
.file("src/main.rs", r#"fn main() { println!("Hello, World!") }"#)
.file("out", "")
.build();
- p.cargo("build -Z unstable-options --out-dir out")
- .masquerade_as_nightly_cargo(&["out-dir"])
+ p.cargo("build -Z unstable-options --artifact-dir out")
+ .masquerade_as_nightly_cargo(&["artifact-dir"])
.with_status(101)
.with_stderr_contains("[ERROR] failed to create directory [..]")
.run();
@@ -198,8 +198,8 @@ fn replaces_artifacts() {
.file("src/main.rs", r#"fn main() { println!("foo") }"#)
.build();
- p.cargo("build -Z unstable-options --out-dir out")
- .masquerade_as_nightly_cargo(&["out-dir"])
+ p.cargo("build -Z unstable-options --artifact-dir out")
+ .masquerade_as_nightly_cargo(&["artifact-dir"])
.run();
p.process(
&p.root()
@@ -211,8 +211,8 @@ fn replaces_artifacts() {
sleep_ms(1000);
p.change_file("src/main.rs", r#"fn main() { println!("bar") }"#);
- p.cargo("build -Z unstable-options --out-dir out")
- .masquerade_as_nightly_cargo(&["out-dir"])
+ p.cargo("build -Z unstable-options --artifact-dir out")
+ .masquerade_as_nightly_cargo(&["artifact-dir"])
.run();
p.process(
&p.root()
@@ -240,8 +240,8 @@ fn avoid_build_scripts() {
.file("b/build.rs", r#"fn main() { println!("hello-build-b"); }"#)
.build();
- p.cargo("build -Z unstable-options --out-dir out -vv")
- .masquerade_as_nightly_cargo(&["out-dir"])
+ p.cargo("build -Z unstable-options --artifact-dir out -vv")
+ .masquerade_as_nightly_cargo(&["artifact-dir"])
.enable_mac_dsym()
.with_stdout_contains("[a 0.0.1] hello-build-a")
.with_stdout_contains("[b 0.0.1] hello-build-b")
@@ -256,20 +256,20 @@ fn avoid_build_scripts() {
}
#[cargo_test]
-fn cargo_build_out_dir() {
+fn cargo_build_artifact_dir() {
let p = project()
.file("src/main.rs", r#"fn main() { println!("Hello, World!") }"#)
.file(
".cargo/config.toml",
r#"
[build]
- out-dir = "out"
+ artifact-dir = "out"
"#,
)
.build();
p.cargo("build -Z unstable-options")
- .masquerade_as_nightly_cargo(&["out-dir"])
+ .masquerade_as_nightly_cargo(&["artifact-dir"])
.enable_mac_dsym()
.run();
check_dir_contents(
@@ -282,18 +282,18 @@ fn cargo_build_out_dir() {
}
#[cargo_test]
-fn unsupported_short_out_dir_flag() {
+fn unsupported_short_artifact_dir_flag() {
let p = project()
.file("src/main.rs", r#"fn main() { println!("Hello, World!") }"#)
.build();
p.cargo("build -Z unstable-options -O")
- .masquerade_as_nightly_cargo(&["out-dir"])
+ .masquerade_as_nightly_cargo(&["artifact-dir"])
.with_stderr(
"\
error: unexpected argument '-O' found
- tip: a similar argument exists: '--out-dir'
+ tip: a similar argument exists: '--artifact-dir'
Usage: cargo[EXE] build [OPTIONS]
@@ -305,7 +305,7 @@ For more information, try '--help'.
}
fn check_dir_contents(
- out_dir: &Path,
+ artifact_dir: &Path,
expected_linux: &[&str],
expected_mac: &[&str],
expected_win_msvc: &[&str],
@@ -323,7 +323,7 @@ fn check_dir_contents(
expected_linux
};
- let actual = list_dir(out_dir);
+ let actual = list_dir(artifact_dir);
let mut expected = expected.iter().map(|s| s.to_string()).collect::