-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Allow missing AR/CC/etc tools for precompiled rubies #394
Conversation
crates/rb-sys-build/src/cc.rs
Outdated
@@ -270,7 +273,13 @@ fn get_tool(env_var: &str, default: &str) -> Command { | |||
let mut tool_args = shellsplit(tool_args).into_iter(); | |||
let tool = tool_args.next().unwrap_or_else(|| default.to_string()); | |||
|
|||
let mut cmd = new_command(&tool); | |||
let mut cmd = if !Path::new(&tool).is_file() { |
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.
This is the fix
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.
imho I prefer to avoid negation in conditionals if possible, so instead I would go with
let mut cmd = if Path::new(&tool).is_file() {
new_command(&tool)
} else {
debug_log!("[WARN] {tool} tool not found, falling back to {default}");
new_command(default)
}
feels easier to read/undertsand, but just an opinion xD
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.
done!
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.
Looks legit
crates/rb-sys-build/src/cc.rs
Outdated
@@ -270,7 +273,13 @@ fn get_tool(env_var: &str, default: &str) -> Command { | |||
let mut tool_args = shellsplit(tool_args).into_iter(); | |||
let tool = tool_args.next().unwrap_or_else(|| default.to_string()); | |||
|
|||
let mut cmd = new_command(&tool); | |||
let mut cmd = if !Path::new(&tool).is_file() { |
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.
imho I prefer to avoid negation in conditionals if possible, so instead I would go with
let mut cmd = if Path::new(&tool).is_file() {
new_command(&tool)
} else {
debug_log!("[WARN] {tool} tool not found, falling back to {default}");
new_command(default)
}
feels easier to read/undertsand, but just an opinion xD
The CI failures seems GHA related, so I'm going to merge with them failing for now. |
Sometimes the AR setup in
rbconfig.rb
can incorrect in the case of precompiled binaries. This PR makes us resistant to that.