diff options
| author | bors <bors@rust-lang.org> | 2017-03-10 13:22:12 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-03-10 13:22:12 +0000 |
| commit | f573db4f80c75f156df8a743f456bf087ec81dc2 (patch) | |
| tree | fa81be07dd5107bde5f51ba4d5f2b4ba1ae76293 /src/bootstrap | |
| parent | 5aaa60611cb7d89b03da8e56653ce09b0203f81d (diff) | |
| parent | 6f431491d0c9b96858c05c0ea30edaf44f9e7c12 (diff) | |
| download | rust-f573db4f80c75f156df8a743f456bf087ec81dc2.tar.gz rust-f573db4f80c75f156df8a743f456bf087ec81dc2.zip | |
Auto merge of #39518 - alexcrichton:update-cargo, r=arielb1
rustbuild: Use copies instead of hard links The original motivation for hard links was to speed up the various stages of rustbuild, but in the end this is causing problems on Windows (#39504). This commit tweaks the build system to use copies instead of hard links unconditionally to ensure that the files accessed by Windows are always disjoint. Locally this added .3s to a noop build, so it shouldn't be too much of a regression hopefully! Closes #39504
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/util.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/bootstrap/util.rs b/src/bootstrap/util.rs index 520514f5fc9..fc63655d79b 100644 --- a/src/bootstrap/util.rs +++ b/src/bootstrap/util.rs @@ -20,6 +20,8 @@ use std::path::{Path, PathBuf}; use std::process::Command; use std::time::Instant; +use filetime::{self, FileTime}; + /// Returns the `name` as the filename of a static library for `target`. pub fn staticlib(name: &str, target: &str) -> String { if target.contains("windows") { @@ -38,12 +40,18 @@ pub fn copy(src: &Path, dst: &Path) { // Attempt to "easy copy" by creating a hard link (symlinks don't work on // windows), but if that fails just fall back to a slow `copy` operation. - let res = fs::hard_link(src, dst); - let res = res.or_else(|_| fs::copy(src, dst).map(|_| ())); + // let res = fs::hard_link(src, dst); + let res = fs::copy(src, dst); if let Err(e) = res { panic!("failed to copy `{}` to `{}`: {}", src.display(), dst.display(), e) } + let metadata = t!(src.metadata()); + t!(fs::set_permissions(dst, metadata.permissions())); + let atime = FileTime::from_last_access_time(&metadata); + let mtime = FileTime::from_last_modification_time(&metadata); + t!(filetime::set_file_times(dst, atime, mtime)); + } /// Copies the `src` directory recursively to `dst`. Both are assumed to exist |
