Skip to content

Commit 39b83e7

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

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
@@ -823,19 +823,25 @@ impl Step for LibcxxVersionTool {
823823

824824
fn run(self, builder: &Builder<'_>) -> LibcxxVersion {
825825
let out_dir = builder.out.join(self.target.to_string()).join("libcxx-version");
826-
let _ = fs::remove_dir_all(&out_dir);
827-
t!(fs::create_dir_all(&out_dir));
826+
let executable = out_dir.join(exe("libcxx-version", self.target));
828827

829-
let compiler = builder.cxx(self.target).unwrap();
830-
let mut cmd = Command::new(compiler);
828+
if !executable.exists() {
829+
if !out_dir.exists() {
830+
t!(fs::create_dir_all(&out_dir));
831+
}
831832

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

835-
builder.run_cmd(&mut cmd);
836+
cmd.arg("-o")
837+
.arg(&executable)
838+
.arg(builder.src.join("src/tools/libcxx-version/main.cpp"));
836839

837-
if !executable.exists() {
838-
panic!("Something went wrong. {} is not present", executable.display());
840+
builder.run_cmd(&mut cmd);
841+
842+
if !executable.exists() {
843+
panic!("Something went wrong. {} is not present", executable.display());
844+
}
839845
}
840846

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

0 commit comments

Comments
 (0)