-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #390 - troy/dev-scripts, r=philipch07
improve developer setup docs Adds some much needed documentation on how to configure the build environment locally. Requested-by: TroyKomodo <49777269+TroyKomodo@users.noreply.github.com> Reviewed-by: philipch07 <59272129+philipch07@users.noreply.github.com>
- Loading branch information
Showing
3 changed files
with
293 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#[derive(Debug, Clone, clap::Parser)] | ||
pub struct DevTools {} | ||
|
||
fn debug_command(command: &mut std::process::Command) { | ||
println!( | ||
"Executing: {} {}", | ||
command.get_program().to_string_lossy(), | ||
command.get_args().map(|a| a.to_string_lossy()).collect::<Vec<_>>().join(" ") | ||
); | ||
command.stderr(std::process::Stdio::inherit()); | ||
command.stdout(std::process::Stdio::inherit()); | ||
command.output().unwrap(); | ||
} | ||
|
||
impl DevTools { | ||
pub fn run(self) -> anyhow::Result<()> { | ||
println!("Installing rustup"); | ||
|
||
const RUST_TOOLCHAINS: &[&str] = &["stable", "nightly"]; | ||
|
||
for toolchain in RUST_TOOLCHAINS { | ||
debug_command(std::process::Command::new("rustup").arg("install").arg(toolchain)); | ||
} | ||
|
||
println!("Installing rustup components"); | ||
|
||
const COMPONENTS: &[&str] = &["clippy", "rustfmt", "llvm-tools-preview", "rust-src", "rust-docs"]; | ||
|
||
for component in COMPONENTS { | ||
debug_command( | ||
std::process::Command::new("rustup") | ||
.arg("component") | ||
.arg("add") | ||
.arg(component), | ||
); | ||
} | ||
|
||
println!("Installing cargo-binstall"); | ||
|
||
debug_command(std::process::Command::new("cargo").arg("install").arg("cargo-binstall")); | ||
|
||
println!("Installing cargo-binstall packages"); | ||
|
||
const BINSTALL_PACKAGES: &[&str] = &[ | ||
"just", | ||
"cargo-llvm-cov", | ||
"cargo-nextest", | ||
"cargo-insta", | ||
"cargo-hakari", | ||
"miniserve", | ||
]; | ||
|
||
for package in BINSTALL_PACKAGES { | ||
debug_command(std::process::Command::new("cargo").arg("binstall").arg(package)); | ||
} | ||
|
||
println!("Installation complete"); | ||
|
||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters