Skip to content

Commit 68dccf9

Browse files
committed
Build: improve verbose output in manifest
Signed-off-by: xizheyin <[email protected]>
1 parent f08371e commit 68dccf9

File tree

1 file changed

+40
-6
lines changed

1 file changed

+40
-6
lines changed

bootstrap/src/manifest.rs

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,36 +13,70 @@ pub struct Manifest {
1313
impl Manifest {
1414
/// Builds the rustc codegen c library
1515
pub fn prepare(&self) {
16-
cprintln!("<b>[BUILD]</b> codegen backend");
16+
// Build codegen backend
17+
if self.verbose {
18+
cprintln!("<b>[BUILD]</b> preparing codegen backend");
19+
cprintln!(" target: {}", self.codegen_backend().display());
20+
} else {
21+
cprintln!("<b>[BUILD]</b> codegen backend");
22+
}
23+
1724
let mut command = Command::new("cargo");
1825
command.arg("build").args(["--manifest-path", "crates/Cargo.toml"]);
1926
if self.verbose {
20-
command.args(["-F", "debug"]);
27+
command.args(["-v"]);
28+
cprintln!(" command: {}", format!("{:?}", command).replace('"', ""));
2129
}
2230
if self.release {
2331
command.arg("--release");
2432
}
2533
log::debug!("running {:?}", command);
26-
command.status().unwrap();
34+
let status = command.status().unwrap();
35+
if self.verbose && status.success() {
36+
cprintln!(" <g>success</g>");
37+
}
38+
39+
// Build runtime library
40+
if self.verbose {
41+
cprintln!("<b>[BUILD]</b> preparing librust_runtime");
42+
cprintln!(" output: {}", self.out_dir.display());
43+
} else {
44+
cprintln!("<b>[BUILD]</b> librust_runtime");
45+
}
2746

28-
cprintln!("<b>[BUILD]</b> librust_runtime");
2947
std::fs::create_dir_all(&self.out_dir).unwrap();
3048
let cc = std::env::var("CC").unwrap_or("clang".to_string());
49+
50+
// Compile runtime.c
3151
let mut command = Command::new(&cc);
3252
command
3353
.arg("rust_runtime/rust_runtime.c")
3454
.arg("-o")
3555
.arg(self.out_dir.join("rust_runtime.o"))
3656
.arg("-c");
57+
if self.verbose {
58+
cprintln!(" compile: {}", format!("{:?}", command).replace('"', ""));
59+
}
3760
log::debug!("running {:?}", command);
38-
command.status().unwrap();
61+
let status = command.status().unwrap();
62+
if self.verbose && status.success() {
63+
cprintln!(" <g>success</g>");
64+
}
65+
66+
// Create static library
3967
let mut command = Command::new("ar");
4068
command
4169
.arg("rcs")
4270
.arg(self.out_dir.join("librust_runtime.a"))
4371
.arg(self.out_dir.join("rust_runtime.o"));
72+
if self.verbose {
73+
cprintln!(" archive: {}", format!("{:?}", command).replace('"', ""));
74+
}
4475
log::debug!("running {:?}", command);
45-
command.status().unwrap();
76+
let status = command.status().unwrap();
77+
if self.verbose && status.success() {
78+
cprintln!(" <g>success</g>");
79+
}
4680
}
4781

4882
/// The path to the rustc codegen c library

0 commit comments

Comments
 (0)