Don't show Fresh by default

But still show it with --verbose

Closes #473
This commit is contained in:
Alex Crichton 2014-09-05 10:15:10 -07:00
parent 76f19a64d7
commit 4a70a7a111
8 changed files with 36 additions and 90 deletions

View file

@ -147,9 +147,12 @@ impl<'a, 'b> JobQueue<'a, 'b> {
let id = pkg.get_package_id().clone();
if stage == StageStart {
let fresh = fresh.combine(self.state[pkg.get_package_id()]);
let msg = match fresh { Fresh => "Fresh", Dirty => "Compiling" };
try!(config.shell().status(msg, pkg));
match fresh.combine(self.state[pkg.get_package_id()]) {
Fresh => try!(config.shell().verbose(|c| {
c.status("Fresh", pkg)
})),
Dirty => try!(config.shell().status("Compiling", pkg))
}
}
// While the jobs are all running, we maintain some metadata about how

View file

@ -739,7 +739,6 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
assert_that(p.process(cargo_dir().join("cargo")).arg("bench"),
execs().with_status(0)
.with_stdout(format!("\
{fresh} foo v0.0.1 ({dir})
{running} target[..]release[..]foo-[..]
running 1 test
@ -748,6 +747,5 @@ test foo ... bench: 0 ns/iter (+/- 0)
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
",
fresh = FRESH, running = RUNNING,
dir = p.url()).as_slice()));
running = RUNNING)));
})

View file

@ -3,7 +3,7 @@ use std::os;
use std::path;
use support::{ResultTest, project, execs, main_file, basic_bin_manifest};
use support::{COMPILING, RUNNING, FRESH, cargo_dir, ProjectBuilder, path2url};
use support::{COMPILING, RUNNING, cargo_dir, ProjectBuilder, path2url};
use hamcrest::{assert_that, existing_file};
use support::paths::PathExt;
use cargo;
@ -1577,18 +1577,14 @@ test!(freshness_ignores_excluded {
println!("first pass");
assert_that(foo.process(cargo_dir().join("cargo")).arg("build"),
execs().with_status(0)
.with_stdout(format!("\
{fresh} foo v0.0.0 ({url})
", fresh = FRESH, url = foo.url())));
.with_stdout(""));
// Modify an ignored file and make sure we don't rebuild
println!("second pass");
File::create(&foo.root().join("src/bar.rs")).assert();
assert_that(foo.process(cargo_dir().join("cargo")).arg("build"),
execs().with_status(0)
.with_stdout(format!("\
{fresh} foo v0.0.0 ({url})
", fresh = FRESH, url = foo.url())));
.with_stdout(""));
})
test!(rebuild_preserves_out_dir {

View file

@ -3,7 +3,7 @@ use std::time::Duration;
use support::{ProjectBuilder, ResultTest, project, execs, main_file, paths};
use support::{cargo_dir, path2url};
use support::{COMPILING, FRESH, UPDATING, RUNNING};
use support::{COMPILING, UPDATING, RUNNING};
use support::paths::PathExt;
use hamcrest::{assert_that,existing_file};
use cargo;
@ -531,10 +531,7 @@ test!(recompilation {
// Don't recompile the second time
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_stdout(format!("{} bar v0.5.0 ({}#[..])\n\
{} foo v0.5.0 ({})\n",
FRESH, git_project.url(),
FRESH, p.url())));
execs().with_stdout(""));
// Modify a file manually, shouldn't trigger a recompile
File::create(&git_project.root().join("src/bar.rs")).write_str(r#"
@ -542,10 +539,7 @@ test!(recompilation {
"#).assert();
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_stdout(format!("{} bar v0.5.0 ({}#[..])\n\
{} foo v0.5.0 ({})\n",
FRESH, git_project.url(),
FRESH, p.url())));
execs().with_stdout(""));
assert_that(p.process(cargo_dir().join("cargo")).arg("update"),
execs().with_stdout(format!("{} git repository `{}`",
@ -553,10 +547,7 @@ test!(recompilation {
git_project.url())));
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_stdout(format!("{} bar v0.5.0 ({}#[..])\n\
{} foo v0.5.0 ({})\n",
FRESH, git_project.url(),
FRESH, p.url())));
execs().with_stdout(""));
// Commit the changes and make sure we don't trigger a recompile because the
// lockfile says not to change
@ -566,10 +557,7 @@ test!(recompilation {
println!("compile after commit");
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_stdout(format!("{} bar v0.5.0 ({}#[..])\n\
{} foo v0.5.0 ({})\n",
FRESH, git_project.url(),
FRESH, p.url())));
execs().with_stdout(""));
p.root().move_into_the_past().assert();
// Update the dependency and carry on!
@ -1047,18 +1035,14 @@ test!(git_build_cmd_freshness {
println!("first pass");
assert_that(foo.process(cargo_dir().join("cargo")).arg("build"),
execs().with_status(0)
.with_stdout(format!("\
{fresh} foo v0.0.0 ({url})
", fresh = FRESH, url = foo.url())));
.with_stdout(""));
// Modify an ignored file and make sure we don't rebuild
println!("second pass");
File::create(&foo.root().join("src/bar.rs")).assert();
assert_that(foo.process(cargo_dir().join("cargo")).arg("build"),
execs().with_status(0)
.with_stdout(format!("\
{fresh} foo v0.0.0 ({url})
", fresh = FRESH, url = foo.url())));
.with_stdout(""));
})
test!(git_name_not_always_needed {

View file

@ -1,7 +1,7 @@
use std::io::{fs, File, UserRWX};
use support::{ResultTest, project, execs, main_file, cargo_dir, path2url};
use support::{COMPILING, FRESH, RUNNING};
use support::{COMPILING, RUNNING};
use support::paths::{mod, PathExt};
use hamcrest::{assert_that, existing_file};
use cargo;
@ -266,10 +266,7 @@ test!(no_rebuild_dependency {
COMPILING, p.url())));
// This time we shouldn't compile bar
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_stdout(format!("{} bar v0.5.0 ({})\n\
{} foo v0.5.0 ({})\n",
FRESH, bar,
FRESH, p.url())));
execs().with_stdout(""));
p.root().move_into_the_past().assert();
p.build(); // rebuild the files (rewriting them in the process)
@ -343,12 +340,7 @@ test!(deep_dependencies_trigger_rebuild {
COMPILING, bar,
COMPILING, p.url())));
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_stdout(format!("{} baz v0.5.0 ({})\n\
{} bar v0.5.0 ({})\n\
{} foo v0.5.0 ({})\n",
FRESH, baz,
FRESH, bar,
FRESH, p.url())));
execs().with_stdout(""));
// Make sure an update to baz triggers a rebuild of bar
//
@ -373,12 +365,11 @@ test!(deep_dependencies_trigger_rebuild {
pub fn bar() { println!("hello!"); baz::baz(); }
"#).assert();
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_stdout(format!("{} baz v0.5.0 ({})\n\
{} bar v0.5.0 ({})\n\
execs().with_stdout(format!("{} bar v0.5.0 ({})\n\
{} foo v0.5.0 ({})\n",
FRESH, baz,
COMPILING, bar,
COMPILING, p.url())));
})
test!(no_rebuild_two_deps {
@ -445,12 +436,7 @@ test!(no_rebuild_two_deps {
COMPILING, p.url())));
assert_that(&p.bin("foo"), existing_file());
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_stdout(format!("{} baz v0.5.0 ({})\n\
{} bar v0.5.0 ({})\n\
{} foo v0.5.0 ({})\n",
FRESH, baz,
FRESH, bar,
FRESH, p.url())));
execs().with_stdout(""));
assert_that(&p.bin("foo"), existing_file());
})
@ -501,9 +487,7 @@ test!(nested_deps_recompile {
// This shouldn't recompile `bar`
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_stdout(format!("{} bar v0.5.0 ({})\n\
{} foo v0.5.0 ({})\n",
FRESH, bar,
execs().with_stdout(format!("{} foo v0.5.0 ({})\n",
COMPILING, p.url())));
})

View file

@ -1,5 +1,5 @@
use support::{project, execs, cargo_dir, path2url};
use support::{COMPILING, FRESH};
use support::COMPILING;
use hamcrest::{assert_that, existing_file, existing_dir, is_not};
fn setup() {
@ -67,11 +67,7 @@ test!(doc_twice {
dir = path2url(p.root())).as_slice()));
assert_that(p.process(cargo_dir().join("cargo")).arg("doc"),
execs().with_status(0).with_stdout(format!("\
{fresh} foo v0.0.1 ({dir})
",
fresh = FRESH,
dir = path2url(p.root())).as_slice()));
execs().with_status(0).with_stdout(""))
})
test!(doc_deps {
@ -113,12 +109,7 @@ test!(doc_deps {
assert_that(p.process(cargo_dir().join("cargo")).arg("doc")
.env("RUST_LOG", Some("cargo::ops::cargo_rustc::fingerprint")),
execs().with_status(0).with_stdout(format!("\
{fresh} bar v0.0.1 ({dir})
{fresh} foo v0.0.1 ({dir})
",
fresh = FRESH,
dir = path2url(p.root())).as_slice()));
execs().with_status(0).with_stdout(""));
assert_that(&p.root().join("target/doc"), existing_dir());
assert_that(&p.root().join("target/doc/foo/index.html"), existing_file());

View file

@ -1,7 +1,7 @@
use std::io::{fs, File};
use support::{project, execs, path2url};
use support::{COMPILING, cargo_dir, ResultTest, FRESH};
use support::{COMPILING, cargo_dir, ResultTest};
use support::paths::PathExt;
use hamcrest::{assert_that, existing_file};
@ -26,9 +26,7 @@ test!(modifying_and_moving {
", compiling = COMPILING, dir = path2url(p.root()))));
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_status(0).with_stdout(format!("\
{fresh} foo v0.0.1 ({dir})
", fresh = FRESH, dir = path2url(p.root()))));
execs().with_status(0).with_stdout(""));
p.root().move_into_the_past().assert();
File::create(&p.root().join("src/a.rs")).write_str("fn main() {}").assert();

View file

@ -2,7 +2,7 @@ use std::path;
use std::str;
use support::{project, execs, basic_bin_manifest, basic_lib_manifest};
use support::{COMPILING, cargo_dir, ResultTest, FRESH, RUNNING, DOCTEST};
use support::{COMPILING, cargo_dir, ResultTest, RUNNING, DOCTEST};
use support::paths::PathExt;
use hamcrest::{assert_that, existing_file};
use cargo::util::process;
@ -722,8 +722,6 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
assert_that(p.process(cargo_dir().join("cargo")).arg("test"),
execs().with_status(0)
.with_stdout(format!("\
{fresh} bar v0.0.1 ({dir})
{fresh} foo v0.0.1 ({dir})
{running} target[..]foo-[..]
running 1 test
@ -745,9 +743,9 @@ running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
",
fresh = FRESH, running = RUNNING,
doctest = DOCTEST,
dir = p.url()).as_slice()));
running = RUNNING,
doctest = DOCTEST)));
})
test!(test_twice_with_build_cmd {
@ -789,7 +787,6 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
assert_that(p.process(cargo_dir().join("cargo")).arg("test"),
execs().with_status(0)
.with_stdout(format!("\
{fresh} foo v0.0.1 ({dir})
{running} target[..]foo-[..]
running 1 test
@ -804,9 +801,8 @@ running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
",
fresh = FRESH, running = RUNNING,
doctest = DOCTEST,
dir = p.url()).as_slice()));
running = RUNNING,
doctest = DOCTEST)));
})
test!(test_then_build {
@ -846,11 +842,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
execs().with_status(0)
.with_stdout(format!("\
{fresh} foo v0.0.1 ({dir})
",
fresh = FRESH,
dir = p.url()).as_slice()));
.with_stdout(""));
})
test!(test_no_run {