Skip to content

Distinguish between compiling the build script and the rest #8025

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

Closed
wants to merge 4 commits into from
Closed
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 src/cargo/core/compiler/job_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,10 @@ impl<'a, 'cfg> DrainState<'a, 'cfg> {
self.compiled.insert(unit.pkg.package_id());
if unit.mode.is_check() {
config.shell().status("Checking", unit.pkg)?;
} else if unit.target.is_custom_build() {
config
.shell()
.status("Compiling", format!("{} (build-script)", unit.pkg))?;
} else {
config.shell().status("Compiling", unit.pkg)?;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ fn bench_twice_with_build_cmd() {
p.cargo("bench")
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([CWD])
[COMPILING] foo v0.0.1 ([CWD]) (build-script)
[FINISHED] bench [optimized] target(s) in [..]
[RUNNING] target/release/deps/foo-[..][EXE]",
)
Expand Down
6 changes: 3 additions & 3 deletions tests/testsuite/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2121,7 +2121,7 @@ fn freshness_ignores_excluded() {
foo.cargo("build")
.with_stderr(
"\
[COMPILING] foo v0.0.0 ([CWD])
[COMPILING] foo v0.0.0 ([CWD]) (build-script)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)
Expand Down Expand Up @@ -2175,7 +2175,7 @@ fn rebuild_preserves_out_dir() {
.env("FIRST", "1")
.with_stderr(
"\
[COMPILING] foo v0.0.0 ([CWD])
[COMPILING] foo v0.0.0 ([CWD]) (build-script)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)
Expand All @@ -2185,7 +2185,7 @@ fn rebuild_preserves_out_dir() {
foo.cargo("build")
.with_stderr(
"\
[COMPILING] foo v0.0.0 ([CWD])
[COMPILING] foo v0.0.0 ([CWD]) (build-script)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
)
Expand Down
54 changes: 27 additions & 27 deletions tests/testsuite/build_script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn custom_build_script_failed() {
.with_status(101)
.with_stderr(
"\
[COMPILING] foo v0.5.0 ([CWD])
[COMPILING] foo v0.5.0 ([CWD]) (build-script)
[RUNNING] `rustc --crate-name build_script_build build.rs [..]--crate-type bin [..]`
[RUNNING] `[..]/build-script-build`
[ERROR] failed to run custom build command for `foo v0.5.0 ([CWD])`
Expand Down Expand Up @@ -702,7 +702,7 @@ fn only_rerun_build_script() {
p.cargo("build -v")
.with_stderr(
"\
[COMPILING] foo v0.5.0 ([CWD])
[COMPILING] foo v0.5.0 ([CWD]) (build-script)
[RUNNING] `[..]/build-script-build`
[RUNNING] `rustc --crate-name foo [..]`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
Expand Down Expand Up @@ -808,7 +808,7 @@ fn testing_and_such() {
p.cargo("test -vj1")
.with_stderr(
"\
[COMPILING] foo v0.5.0 ([CWD])
[COMPILING] foo v0.5.0 ([CWD]) (build-script)
[RUNNING] `[..]/build-script-build`
[RUNNING] `rustc --crate-name foo [..]`
[RUNNING] `rustc --crate-name foo [..]`
Expand Down Expand Up @@ -839,7 +839,7 @@ fn testing_and_such() {
p.cargo("run")
.with_stderr(
"\
[COMPILING] foo v0.5.0 ([CWD])
[COMPILING] foo v0.5.0 ([CWD]) (build-script)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `target/debug/foo[EXE]`
",
Expand Down Expand Up @@ -1026,7 +1026,7 @@ fn build_deps_simple() {
"\
[COMPILING] a v0.5.0 ([CWD]/a)
[RUNNING] `rustc --crate-name a [..]`
[COMPILING] foo v0.5.0 ([CWD])
[COMPILING] foo v0.5.0 ([CWD]) (build-script)
[RUNNING] `rustc [..] build.rs [..] --extern a=[..]`
[RUNNING] `[..]/foo-[..]/build-script-build`
[RUNNING] `rustc --crate-name foo [..]`
Expand Down Expand Up @@ -1135,15 +1135,15 @@ fn build_cmd_with_a_build_cmd() {
"\
[COMPILING] b v0.5.0 ([CWD]/b)
[RUNNING] `rustc --crate-name b [..]`
[COMPILING] a v0.5.0 ([CWD]/a)
[COMPILING] a v0.5.0 ([CWD]/a) (build-script)
[RUNNING] `rustc [..] a/build.rs [..] --extern b=[..]`
[RUNNING] `[..]/a-[..]/build-script-build`
[RUNNING] `rustc --crate-name a [..]lib.rs [..]--crate-type lib \
--emit=[..]link -C debuginfo=2 \
-C metadata=[..] \
--out-dir [..]target/debug/deps \
-L [..]target/debug/deps`
[COMPILING] foo v0.5.0 ([CWD])
[COMPILING] foo v0.5.0 ([CWD]) (build-script)
[RUNNING] `rustc --crate-name build_script_build build.rs [..]--crate-type bin \
--emit=[..]link \
-C debuginfo=2 -C metadata=[..] --out-dir [..] \
Expand Down Expand Up @@ -1246,7 +1246,7 @@ fn output_separate_lines() {
.with_status(101)
.with_stderr_contains(
"\
[COMPILING] foo v0.5.0 ([CWD])
[COMPILING] foo v0.5.0 ([CWD]) (build-script)
[RUNNING] `rustc [..] build.rs [..]`
[RUNNING] `[..]/foo-[..]/build-script-build`
[RUNNING] `rustc --crate-name foo [..] -L foo -l static=foo`
Expand Down Expand Up @@ -1284,7 +1284,7 @@ fn output_separate_lines_new() {
.with_status(101)
.with_stderr_contains(
"\
[COMPILING] foo v0.5.0 ([CWD])
[COMPILING] foo v0.5.0 ([CWD]) (build-script)
[RUNNING] `rustc [..] build.rs [..]`
[RUNNING] `[..]/foo-[..]/build-script-build`
[RUNNING] `rustc --crate-name foo [..] -L foo -l static=foo`
Expand Down Expand Up @@ -1342,7 +1342,7 @@ fn code_generation() {
p.cargo("run")
.with_stderr(
"\
[COMPILING] foo v0.5.0 ([CWD])
[COMPILING] foo v0.5.0 ([CWD]) (build-script)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `target/debug/foo`",
)
Expand Down Expand Up @@ -1903,7 +1903,7 @@ fn cfg_test() {
p.cargo("test -v")
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([CWD])
[COMPILING] foo v0.0.1 ([CWD]) (build-script)
[RUNNING] [..] build.rs [..]
[RUNNING] `[..]/build-script-build`
[RUNNING] [..] --cfg foo[..]
Expand Down Expand Up @@ -2016,7 +2016,7 @@ fn cfg_override_test() {
p.cargo("test -v")
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([CWD])
[COMPILING] foo v0.0.1 ([CWD]) (build-script)
[RUNNING] `[..]`
[RUNNING] `[..]`
[RUNNING] `[..]`
Expand Down Expand Up @@ -2150,7 +2150,7 @@ fn env_test() {
p.cargo("test -v")
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([CWD])
[COMPILING] foo v0.0.1 ([CWD]) (build-script)
[RUNNING] [..] build.rs [..]
[RUNNING] `[..]/build-script-build`
[RUNNING] [..] --crate-name foo[..]
Expand Down Expand Up @@ -2415,7 +2415,7 @@ fn adding_an_override_invalidates() {
p.cargo("build -v")
.with_stderr(
"\
[COMPILING] foo v0.5.0 ([..]
[COMPILING] foo v0.5.0 ([..] (build-script)
[RUNNING] `rustc [..] -L native=bar`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
Expand Down Expand Up @@ -2455,7 +2455,7 @@ fn changing_an_override_invalidates() {
p.cargo("build -v")
.with_stderr(
"\
[COMPILING] foo v0.5.0 ([..]
[COMPILING] foo v0.5.0 ([..]) (build-script)
[RUNNING] `rustc [..] -L native=foo`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
Expand Down Expand Up @@ -2522,7 +2522,7 @@ fn fresh_builds_possible_with_link_libs() {
p.cargo("build -v")
.with_stderr(
"\
[COMPILING] foo v0.5.0 ([..]
[COMPILING] foo v0.5.0 ([..]) (build-script)
[RUNNING] `rustc [..]`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
Expand Down Expand Up @@ -2576,7 +2576,7 @@ fn fresh_builds_possible_with_multiple_metadata_overrides() {
p.cargo("build -v")
.with_stderr(
"\
[COMPILING] foo v0.5.0 ([..]
[COMPILING] foo v0.5.0 ([..]) (build-script)
[RUNNING] `rustc [..]`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
",
Expand Down Expand Up @@ -2626,7 +2626,7 @@ fn rebuild_only_on_explicit_paths() {
p.cargo("build -v")
.with_stderr(
"\
[COMPILING] foo v0.5.0 ([..])
[COMPILING] foo v0.5.0 ([..]) (build-script)
[RUNNING] `[..]/build-script-build`
[RUNNING] `rustc [..] src/lib.rs [..]`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
Expand All @@ -2644,7 +2644,7 @@ fn rebuild_only_on_explicit_paths() {
p.cargo("build -v")
.with_stderr(
"\
[COMPILING] foo v0.5.0 ([..])
[COMPILING] foo v0.5.0 ([..]) (build-script)
[RUNNING] `[..]/build-script-build`
[RUNNING] `rustc [..] src/lib.rs [..]`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
Expand Down Expand Up @@ -2682,7 +2682,7 @@ fn rebuild_only_on_explicit_paths() {
p.cargo("build -v")
.with_stderr(
"\
[COMPILING] foo v0.5.0 ([..])
[COMPILING] foo v0.5.0 ([..]) (build-script)
[RUNNING] `[..]/build-script-build`
[RUNNING] `rustc [..] src/lib.rs [..]`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
Expand All @@ -2696,7 +2696,7 @@ fn rebuild_only_on_explicit_paths() {
p.cargo("build -v")
.with_stderr(
"\
[COMPILING] foo v0.5.0 ([..])
[COMPILING] foo v0.5.0 ([..]) (build-script)
[RUNNING] `[..]/build-script-build`
[RUNNING] `rustc [..] src/lib.rs [..]`
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
Expand Down Expand Up @@ -2968,7 +2968,7 @@ fn warnings_emitted() {
p.cargo("build -v")
.with_stderr(
"\
[COMPILING] foo v0.5.0 ([..])
[COMPILING] foo v0.5.0 ([..]) (build-script)
[RUNNING] `rustc [..]`
[RUNNING] `[..]`
warning: foo
Expand Down Expand Up @@ -3060,7 +3060,7 @@ fn warnings_hidden_for_upstream() {
[UPDATING] `[..]` index
[DOWNLOADING] crates ...
[DOWNLOADED] bar v0.1.0 ([..])
[COMPILING] bar v0.1.0
[COMPILING] bar v0.1.0 (build-script)
[RUNNING] `rustc [..]`
[RUNNING] `[..]`
[RUNNING] `rustc [..]`
Expand Down Expand Up @@ -3119,7 +3119,7 @@ fn warnings_printed_on_vv() {
[UPDATING] `[..]` index
[DOWNLOADING] crates ...
[DOWNLOADED] bar v0.1.0 ([..])
[COMPILING] bar v0.1.0
[COMPILING] bar v0.1.0 (build-script)
[RUNNING] `[..] rustc [..]`
[RUNNING] `[..]`
warning: foo
Expand Down Expand Up @@ -3164,7 +3164,7 @@ fn output_shows_on_vv() {
.with_stdout("[foo 0.5.0] stdout")
.with_stderr(
"\
[COMPILING] foo v0.5.0 ([..])
[COMPILING] foo v0.5.0 ([..]) (build-script)
[RUNNING] `[..] rustc [..]`
[RUNNING] `[..]`
[foo 0.5.0] stderr
Expand Down Expand Up @@ -3838,7 +3838,7 @@ fn optional_build_dep_and_required_normal_dep() {
.with_stderr(
"\
[COMPILING] bar v0.5.0 ([..])
[COMPILING] foo v0.1.0 ([..])
[COMPILING] foo v0.1.0 ([..]) (build-script)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `[..]foo[EXE]`",
)
Expand All @@ -3848,7 +3848,7 @@ fn optional_build_dep_and_required_normal_dep() {
.with_stdout("1")
.with_stderr(
"\
[COMPILING] foo v0.1.0 ([..])
[COMPILING] foo v0.1.0 ([..]) (build-script)
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] `[..]foo[EXE]`",
)
Expand Down
14 changes: 7 additions & 7 deletions tests/testsuite/build_script_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn rerun_if_env_changes() {
p.cargo("build")
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
[COMPILING] foo v0.0.1 ([..]) (build-script)
[FINISHED] [..]
",
)
Expand All @@ -31,7 +31,7 @@ fn rerun_if_env_changes() {
.env("FOO", "bar")
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
[COMPILING] foo v0.0.1 ([..]) (build-script)
[FINISHED] [..]
",
)
Expand All @@ -40,7 +40,7 @@ fn rerun_if_env_changes() {
.env("FOO", "baz")
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
[COMPILING] foo v0.0.1 ([..]) (build-script)
[FINISHED] [..]
",
)
Expand All @@ -52,7 +52,7 @@ fn rerun_if_env_changes() {
p.cargo("build")
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
[COMPILING] foo v0.0.1 ([..]) (build-script)
[FINISHED] [..]
",
)
Expand All @@ -78,7 +78,7 @@ fn rerun_if_env_or_file_changes() {
p.cargo("build")
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
[COMPILING] foo v0.0.1 ([..]) (build-script)
[FINISHED] [..]
",
)
Expand All @@ -87,7 +87,7 @@ fn rerun_if_env_or_file_changes() {
.env("FOO", "bar")
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
[COMPILING] foo v0.0.1 ([..]) (build-script)
[FINISHED] [..]
",
)
Expand All @@ -102,7 +102,7 @@ fn rerun_if_env_or_file_changes() {
.env("FOO", "bar")
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
[COMPILING] foo v0.0.1 ([..]) (build-script)
[FINISHED] [..]
",
)
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ fn build_script() {
p.cargo("build -v")
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
[COMPILING] foo v0.0.1 ([..]) (build-script)
[RUNNING] `rustc [..] build.rs [..]`
[RUNNING] `[..]build-script-build`
[RUNNING] `rustc [..] src/main.rs [..]`
Expand Down
Loading