2019-12-13 09:48:00 -05:00
|
|
|
################################################################################
|
|
|
|
|
## File: Install-Rust.ps1
|
|
|
|
|
## Desc: Install Rust for Windows
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
# Rust Env
|
2021-12-14 18:08:46 +03:00
|
|
|
$env:RUSTUP_HOME = "C:\Users\Default\.rustup"
|
|
|
|
|
$env:CARGO_HOME = "C:\Users\Default\.cargo"
|
2019-12-13 09:48:00 -05:00
|
|
|
|
|
|
|
|
# Download the latest rustup-init.exe for Windows x64
|
|
|
|
|
# See https://rustup.rs/#
|
2023-02-16 11:19:38 +01:00
|
|
|
$rustupPath = Start-DownloadWithRetry -Url "https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe" -Name "rustup-init.exe"
|
2019-12-13 09:48:00 -05:00
|
|
|
|
|
|
|
|
# Install Rust by running rustup-init.exe (disabling the confirmation prompt with -y)
|
2020-05-05 20:49:34 +03:00
|
|
|
& $rustupPath -y --default-toolchain=stable --profile=minimal
|
2019-12-13 09:48:00 -05:00
|
|
|
|
2021-12-14 18:08:46 +03:00
|
|
|
# Add %USERPROFILE%\.cargo\bin to USER PATH
|
|
|
|
|
Add-DefaultPathItem "%USERPROFILE%\.cargo\bin"
|
2019-12-13 09:48:00 -05:00
|
|
|
# Add Rust binaries to the path
|
2021-12-14 18:08:46 +03:00
|
|
|
$env:Path += ";$env:CARGO_HOME\bin"
|
2019-12-13 09:48:00 -05:00
|
|
|
|
2022-02-28 09:45:24 -05:00
|
|
|
# Add i686 target for building 32-bit binaries
|
|
|
|
|
rustup target add i686-pc-windows-msvc
|
|
|
|
|
|
2022-12-04 09:59:37 +01:00
|
|
|
# Add target for building mingw-w64 binaries
|
|
|
|
|
rustup target add x86_64-pc-windows-gnu
|
|
|
|
|
|
2019-12-13 09:48:00 -05:00
|
|
|
# Install common tools
|
2020-03-23 07:54:11 +07:00
|
|
|
rustup component add rustfmt clippy
|
2022-10-17 12:59:46 +02:00
|
|
|
cargo install --locked bindgen-cli cbindgen cargo-audit cargo-outdated
|
2019-12-13 09:48:00 -05:00
|
|
|
|
2020-05-25 12:25:41 +03:00
|
|
|
# Cleanup Cargo crates cache
|
|
|
|
|
Remove-Item "${env:CARGO_HOME}\registry\*" -Recurse -Force
|
|
|
|
|
|
2021-12-14 18:08:46 +03:00
|
|
|
Invoke-PesterTests -TestFile "Rust"
|