Skip to content

Commit 77ae07f

Browse files
committed
Fix build script for non-ADO case to use specified msrustup toolchain
The ADO pipeline was working as expected, but local builds were behaving differently because of some old incorrect logic.
1 parent 04328df commit 77ae07f

File tree

2 files changed

+14
-26
lines changed

2 files changed

+14
-26
lines changed

build.ps1

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,6 @@ process {
190190
Update-Rust @VerboseParam
191191
}
192192

193-
if (!$usingADO) {
194-
Write-BuildProgress @progressParams -Status 'Setting RustUp to default channel'
195-
$rustup, $channel = Get-RustUp @VerboseParam
196-
& $rustup default stable
197-
}
198-
199193
if ($Clippy) {
200194
Write-BuildProgress @progressParams -Status 'Ensuring Clippy is available and updated'
201195
Install-Clippy -UseCFS:$UseCFS -Architecture $Architecture @VerboseParam

helpers.build.psm1

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,8 @@ function Update-Rust {
435435

436436
Write-Verbose -Verbose "Rust found, updating..."
437437
$rustup, $channel = Get-RustUp
438+
& $rustup toolchain install $channel
439+
& $rustup default $channel
438440
& $rustup update
439441
}
440442
}
@@ -581,17 +583,27 @@ function Install-Clippy {
581583
$Architecture = 'current'
582584
)
583585

586+
begin {
587+
}
588+
584589
process {
585590
Write-Verbose -Verbose "Installing clippy..."
586591
if ($UseCFS) {
587592
cargo install clippy --config .cargo/config.toml
588593
} else {
594+
$rustup, $channel = Get-RustUp
595+
596+
if ($rustup -eq 'msrustup') {
597+
Write-Verbose -Verbose "Clippy is already included with msrustup"
598+
return
599+
}
600+
589601
if ($Architecture -ne 'current') {
590602
write-verbose -verbose "Installing clippy for $Architecture"
591-
rustup component add clippy --target $Architecture
603+
& $rustup component add clippy --target $Architecture
592604
} else {
593605
write-verbose -verbose "Installing clippy for current architecture"
594-
rustup component add clippy
606+
& $rustup component add clippy
595607
}
596608
}
597609
if ($LASTEXITCODE -ne 0) {
@@ -793,24 +805,6 @@ function Install-PowerShellTestPrerequisite {
793805
#endregion Install tools functions
794806

795807
#region Environment setup utility functions
796-
function Set-RustChannel {
797-
<#
798-
.SYNOPSIS
799-
Sets the rust default toolchain to the stable channel.
800-
#>
801-
802-
[CmdletBinding()]
803-
param()
804-
805-
begin {
806-
$rustup, $channel = Get-RustUp
807-
}
808-
809-
process {
810-
& $rustup default stable
811-
}
812-
}
813-
814808
function Set-CargoEnvironment {
815809
<#
816810
.SYNOPSIS

0 commit comments

Comments
 (0)