Skip to content
Merged
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
13 changes: 12 additions & 1 deletion src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use std::ffi::OsStr;
use std::io::BufReader;
use std::io::prelude::*;
use std::path::{Path, PathBuf};
use std::time::SystemTime;
use std::{env, fs, str};

use serde_derive::Deserialize;
Expand Down Expand Up @@ -2578,7 +2579,17 @@ pub fn strip_debug(builder: &Builder<'_>, target: TargetSelection, path: &Path)
}

let previous_mtime = t!(t!(path.metadata()).modified());
command("strip").arg("--strip-debug").arg(path).run_capture(builder);
let stamp = BuildStamp::new(path.parent().unwrap())
.with_prefix(path.file_name().unwrap().to_str().unwrap())
.with_prefix("strip")
.add_stamp(previous_mtime.duration_since(SystemTime::UNIX_EPOCH).unwrap().as_nanos());

// Running strip can be relatively expensive (~1s on librustc_driver.so), so we don't rerun it
// if the file is unchanged.
if !stamp.is_up_to_date() {
command("strip").arg("--strip-debug").arg(path).run_capture(builder);
}
t!(stamp.write());

let file = t!(fs::File::open(path));

Expand Down
Loading