Skip to content

Commit da72695

Browse files
committed
build libcxx-version only when it doesn't exist
Signed-off-by: onur-ozkan <[email protected]>
1 parent 655600c commit da72695

File tree

1 file changed

+15
-9
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+15
-9
lines changed

src/bootstrap/src/core/build_steps/tool.rs

+15-9
Original file line numberDiff line numberDiff line change
@@ -826,19 +826,25 @@ impl Step for LibcxxVersionTool {
826826

827827
fn run(self, builder: &Builder<'_>) -> LibcxxVersion {
828828
let out_dir = builder.out.join(self.target.to_string()).join("libcxx-version");
829-
let _ = fs::remove_dir_all(&out_dir);
830-
t!(fs::create_dir_all(&out_dir));
829+
let executable = out_dir.join(exe("libcxx-version", self.target));
831830

832-
let compiler = builder.cxx(self.target).unwrap();
833-
let mut cmd = Command::new(compiler);
831+
if !executable.exists() {
832+
if !out_dir.exists() {
833+
t!(fs::create_dir_all(&out_dir));
834+
}
834835

835-
let executable = out_dir.join(exe("libcxx-version", self.target));
836-
cmd.arg("-o").arg(&executable).arg(builder.src.join("src/tools/libcxx-version/main.cpp"));
836+
let compiler = builder.cxx(self.target).unwrap();
837+
let mut cmd = Command::new(compiler);
837838

838-
builder.run_cmd(&mut cmd);
839+
cmd.arg("-o")
840+
.arg(&executable)
841+
.arg(builder.src.join("src/tools/libcxx-version/main.cpp"));
839842

840-
if !executable.exists() {
841-
panic!("Something went wrong. {} is not present", executable.display());
843+
builder.run_cmd(&mut cmd);
844+
845+
if !executable.exists() {
846+
panic!("Something went wrong. {} is not present", executable.display());
847+
}
842848
}
843849

844850
let version_output = output(&mut Command::new(executable));

0 commit comments

Comments
 (0)