-
Notifications
You must be signed in to change notification settings - Fork 110
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
CLI should not depend on rustup #1996
base: master
Are you sure you want to change the base?
Conversation
5918c82
to
0156bba
Compare
use super::*; | ||
|
||
#[test] | ||
fn test_has_target() -> anyhow::Result<()> { |
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 would be cool if we could, like, configure a system here with both configurations and check, but that's not really feasible in a Rust test. I think this test is ok as-is, assuming we have wasm32 on CI.
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.
👍
use std::path::Path; | ||
|
||
/// Find an executable in the `PATH`. | ||
pub(crate) fn find_executable(exe_name: impl AsRef<Path>) -> Option<std::path::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.
There's also https://github.com/harryfei/which-rs/, but it seems to mostly do stuff we don't need, so I think this is fine for now.
0156bba
to
f820488
Compare
println!("Warning: Failed to install rustfmt: {err}"); | ||
} | ||
} else { | ||
return Err(anyhow::anyhow!("rustfmt is not installed. Please install it.")); |
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's a bit strange to me that if we fail to install rustfmt
above, we just print a warning, but if we don't have rustup
at all then we return an error. Should we print a warning in this case too, or should we return an Err
above?
println!("Warning: Failed to install wasm32-unknown-unknown target: {}", err); | ||
} | ||
} else { | ||
anyhow::bail!("wasm32-unknown-unknown target is not installed. Please install it."); |
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.
some comment here as above - strange that we bail
if rustup is missing, but only warn if rustup fails to install the target.
Looks basically good to me, two small comments |
39bcb5f
to
d22b6f9
Compare
Description of Changes
Rustup could not be installed (for example, for people who use
nix
).Now, the
cli
defensively check for it. It also try to find the targetwasm32-unknown-unknown
in case is not installed.Closes #1971.
API and ABI breaking changes
If this is an API or ABI breaking change, please apply the
corresponding GitHub label.
Expected complexity level and risk
1
Testing
Describe any testing you've done, and any testing you'd like your reviewers to do,
so that you're confident that all the changes work as expected!