-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite make-win-dist.py in Rust #41932
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome looks great to me here, thanks @wesleywiser!
src/bootstrap/dist.rs
Outdated
//Ask gcc where it keeps its stuff | ||
let gcc_out = | ||
String::from_utf8( | ||
Command::new("gcc.exe") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With access in Rust, it may actually be best to query build.cc(target)
to find the path to gcc here.
src/bootstrap/dist.rs
Outdated
|
||
for file in &files { | ||
let file_path = | ||
path .iter() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stray space?
src/bootstrap/dist.rs
Outdated
let file_path = | ||
path .iter() | ||
.map(|dir| dir.join(file)) | ||
.find(|p| fs::metadata(&p).is_ok()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nowadays I think for this you can just use p.exists()
src/bootstrap/dist.rs
Outdated
let rustc_dlls = find_files(rustc_dlls, &bin_path); | ||
let target_libs = find_files(target_libs, &lib_path); | ||
|
||
fn copy(src: &Path, dest_folder: &Path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's a util::copy
to use for this as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks to me like that function assumes dst
already refers to a full path name like "C:\rust\test.dll" instead of just the folder name which is what this function handles. I can change this function to call util::copy
instead of fs::copy
though.
src/bootstrap/dist.rs
Outdated
} | ||
|
||
let target_tools = vec!["gcc.exe", "ld.exe", "ar.exe", "dlltool.exe"]; | ||
let mut rustc_dlls = vec!["libstdc++-6.dll", "libwinpthread-1.dll", "libwinpthread-1.dll"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libwinpthread is mentioned twice here?
src/bootstrap/dist.rs
Outdated
.collect(); | ||
|
||
if key == "programs" { | ||
bin_path.append(&mut value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can probably use extend
here actually to avoid the collect
above, dropping a few lines in the process!
Updated |
src/bootstrap/dist.rs
Outdated
@@ -98,6 +98,139 @@ pub fn docs(build: &Build, stage: u32, host: &str) { | |||
} | |||
} | |||
|
|||
fn find_files(files: Vec<&str>, path: &Vec<PathBuf>) -> Vec<PathBuf> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer that this function take files: &[Path], path: &[PathBuf]
since it doesn't need a vector for either parameter. Looks like the files are really just strings, in which case &[str]
would also be fine.
src/bootstrap/dist.rs
Outdated
.stdout).expect("gcc.exe output was not utf8"); | ||
|
||
let mut bin_path: Vec<_> = | ||
env::split_paths(&env::var_os("PATH").expect("failed to get $PATH")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems better to unwrap_or_default
here, since PATH
being empty is a decent, if not good, default.
@Mark-Simulacrum Fixed |
I'll give @alexcrichton the final say, though. But looks good to me! |
@bors: r+ Looks great to me too, thanks so much again @wesleywiser! |
📌 Commit 173f693 has been approved by |
Rewrite make-win-dist.py in Rust Fixes rust-lang#41568
This seemed to fail dist in rollup:
|
@bors r- |
@wesleywiser Have you had a chance to take a look at the failure? |
@Mark-Simulacrum I was having some trouble repro'ing it but I think I've got it now. I'll continue looking at it this week. |
@Mark-Simulacrum I think that should fix it |
@bors r=alexcrichton |
📌 Commit 7eebabe has been approved by |
⌛ Testing commit 7eebabe with merge ce15fd0... |
💔 Test failed - status-appveyor |
|
⌛ Testing commit 7eebabe with merge 1ba03d3... |
💔 Test failed - status-appveyor |
@bors retry
|
⌛ Testing commit 7eebabe with merge 4b21210... |
💔 Test failed - status-travis |
@bors retry
|
Rewrite make-win-dist.py in Rust Fixes rust-lang#41568
⌛ Testing commit 7eebabe with merge 2ded772... |
💔 Test failed - status-appveyor |
Timeouts, timeouts. It takes us 40 minutes before we even run configure right now, this is probably never going to work until appveyor is fixed realistically. @bors retry |
Rewrite make-win-dist.py in Rust Fixes #41568
☀️ Test successful - status-appveyor, status-travis |
Woohooo! Thanks @Mark-Simulacrum and @alexcrichton |
Fixes #41568