Skip to content

Commit 4490a8d

Browse files
committed
Revert changes in PS script
1 parent 484d6e8 commit 4490a8d

File tree

1 file changed

+44
-27
lines changed

1 file changed

+44
-27
lines changed

build.ps1

Lines changed: 44 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
param(
77
[switch]$Release,
8-
[ValidateSet('current', 'aarch64-pc-windows-msvc', 'x86_64-pc-windows-msvc', 'aarch64-apple-darwin', 'x86_64-apple-darwin', 'aarch64-unknown-linux-gnu', 'aarch64-unknown-linux-musl', 'x86_64-unknown-linux-gnu', 'x86_64-unknown-linux-musl')]
8+
[ValidateSet('current','aarch64-pc-windows-msvc','x86_64-pc-windows-msvc','aarch64-apple-darwin','x86_64-apple-darwin','aarch64-unknown-linux-gnu','aarch64-unknown-linux-musl','x86_64-unknown-linux-gnu','x86_64-unknown-linux-musl')]
99
$architecture = 'current',
1010
[switch]$Clippy,
1111
[switch]$SkipBuild,
12-
[ValidateSet('msix', 'msix-private', 'msixbundle', 'tgz', 'zip')]
12+
[ValidateSet('msix','msix-private','msixbundle','tgz','zip')]
1313
$packageType,
1414
[switch]$Test,
1515
[switch]$GetPackageVersion,
@@ -142,7 +142,8 @@ function Find-LinkExe {
142142
$linkexe = (Get-Location).Path
143143
Write-Verbose -Verbose "Using $linkexe"
144144
$linkexe
145-
} finally {
145+
}
146+
finally {
146147
Pop-Location
147148
}
148149
}
@@ -169,7 +170,8 @@ if ($null -ne $packageType) {
169170
if (!$IsWindows) {
170171
curl https://sh.rustup.rs -sSf | sh -s -- -y
171172
$env:PATH += ":$env:HOME/.cargo/bin"
172-
} else {
173+
}
174+
else {
173175
Invoke-WebRequest 'https://static.rust-lang.org/rustup/dist/i686-pc-windows-gnu/rustup-init.exe' -OutFile 'temp:/rustup-init.exe'
174176
Write-Verbose -Verbose "Use the default settings to ensure build works"
175177
& 'temp:/rustup-init.exe' -y
@@ -212,9 +214,9 @@ if (!$SkipBuild -and !$SkipLinkCheck -and $IsWindows -and !(Get-Command 'link.ex
212214
if (!(Test-Path $BuildToolsPath)) {
213215
Write-Verbose -Verbose "link.exe not found, installing C++ build tools"
214216
Invoke-WebRequest 'https://aka.ms/vs/17/release/vs_BuildTools.exe' -OutFile 'temp:/vs_buildtools.exe'
215-
$arg = @('--passive', '--add', 'Microsoft.VisualStudio.Workload.VCTools', '--includerecommended')
217+
$arg = @('--passive','--add','Microsoft.VisualStudio.Workload.VCTools','--includerecommended')
216218
if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') {
217-
$arg += '--add', 'Microsoft.VisualStudio.Component.VC.Tools.ARM64'
219+
$arg += '--add','Microsoft.VisualStudio.Component.VC.Tools.ARM64'
218220
}
219221
Start-Process -FilePath 'temp:/vs_buildtools.exe' -ArgumentList $arg -Wait
220222
Remove-Item temp:/vs_installer.exe -ErrorAction Ignore
@@ -244,7 +246,8 @@ $flags = @($Release ? '-r' : $null)
244246
if ($architecture -eq 'current') {
245247
$path = ".\target\$configuration"
246248
$target = Join-Path $PSScriptRoot 'bin' $configuration
247-
} else {
249+
}
250+
else {
248251
$flags += '--target'
249252
$flags += $architecture
250253
$path = ".\target\$architecture\$configuration"
@@ -287,7 +290,8 @@ if (!$SkipBuild) {
287290
$env:CARGO_REGISTRIES_POWERSHELL_CREDENTIAL_PROVIDER = 'cargo:token'
288291
$env:CARGO_REGISTRIES_POWERSHELL_INDEX = "sparse+https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell~force-auth/Cargo/index/"
289292
}
290-
} else {
293+
}
294+
else {
291295
Write-Warning "Azure CLI not found, proceeding with anonymous access."
292296
}
293297
}
@@ -344,7 +348,8 @@ if (!$SkipBuild) {
344348
if (($project -eq 'tree-sitter-dscexpression') -or ($project -eq 'tree-sitter-ssh-server-config')) {
345349
if ($UpdateLockFile) {
346350
cargo generate-lockfile
347-
} else {
351+
}
352+
else {
348353
if ($Audit) {
349354
if ($null -eq (Get-Command cargo-audit -ErrorAction Ignore)) {
350355
cargo install cargo-audit --features=fix
@@ -357,21 +362,26 @@ if (!$SkipBuild) {
357362
}
358363
}
359364

360-
if (Test-Path "./Cargo.toml") {
365+
if (Test-Path "./Cargo.toml")
366+
{
361367
if ($Clippy) {
362368
if ($clippy_unclean_projects -contains $project) {
363369
Write-Verbose -Verbose "Skipping clippy for $project"
364-
} elseif ($pedantic_unclean_projects -contains $project) {
370+
}
371+
elseif ($pedantic_unclean_projects -contains $project) {
365372
Write-Verbose -Verbose "Running clippy for $project"
366373
cargo clippy @flags -- -Dwarnings
367-
} else {
374+
}
375+
else {
368376
Write-Verbose -Verbose "Running clippy with pedantic for $project"
369377
cargo clippy @flags --% -- -Dwarnings -Dclippy::pedantic
370378
}
371-
} else {
379+
}
380+
else {
372381
if ($UpdateLockFile) {
373382
cargo generate-lockfile
374-
} else {
383+
}
384+
else {
375385
if ($Audit) {
376386
if ($null -eq (Get-Command cargo-audit -ErrorAction Ignore)) {
377387
cargo install cargo-audit --features=fix
@@ -399,7 +409,8 @@ if (!$SkipBuild) {
399409
if ($IsWindows) {
400410
Copy-Item "$path/$binary.exe" $target -ErrorAction Ignore -Verbose
401411
Copy-Item "$path/$binary.pdb" $target -ErrorAction Ignore -Verbose
402-
} else {
412+
}
413+
else {
403414
Copy-Item "$path/$binary" $target -ErrorAction Ignore -Verbose
404415
}
405416

@@ -457,7 +468,8 @@ if (!$Clippy -and !$SkipBuild) {
457468
$dirSeparator = [System.IO.Path]::DirectorySeparatorChar
458469
if ($Release) {
459470
$oldTarget = $target.Replace($dirSeparator + 'release', $dirSeparator + 'debug')
460-
} else {
471+
}
472+
else {
461473
$oldTarget = $target.Replace($dirSeparator + 'debug', $dirSeparator + 'release')
462474
}
463475
$env:PATH = $env:PATH.Replace($oldTarget, '')
@@ -496,14 +508,15 @@ if ($Test) {
496508

497509
if ($IsWindows) {
498510
# PSDesiredStateConfiguration module is needed for Microsoft.Windows/WindowsPowerShell adapter
499-
$FullyQualifiedName = @{ModuleName = "PSDesiredStateConfiguration"; ModuleVersion = "2.0.7" }
500-
if (-not(Get-Module -ListAvailable -FullyQualifiedName $FullyQualifiedName)) {
511+
$FullyQualifiedName = @{ModuleName="PSDesiredStateConfiguration";ModuleVersion="2.0.7"}
512+
if (-not(Get-Module -ListAvailable -FullyQualifiedName $FullyQualifiedName))
513+
{
501514
Install-PSResource -Name PSDesiredStateConfiguration -Version 2.0.7 -Repository $repository -TrustRepository
502515
}
503516
}
504517

505-
if (-not(Get-Module -ListAvailable -Name Pester)) {
506-
"Installing module Pester"
518+
if (-not(Get-Module -ListAvailable -Name Pester))
519+
{ "Installing module Pester"
507520
Install-PSResource Pester -WarningAction Ignore -Repository $repository -TrustRepository
508521
}
509522

@@ -516,7 +529,8 @@ if ($Test) {
516529
Write-Host -ForegroundColor Cyan "Testing $project ..."
517530
try {
518531
Push-Location "$PSScriptRoot/$project"
519-
if (Test-Path "./Cargo.toml") {
532+
if (Test-Path "./Cargo.toml")
533+
{
520534
cargo test
521535

522536
if ($LASTEXITCODE -ne 0) {
@@ -545,8 +559,8 @@ if ($Test) {
545559
"Updated PSModulePath is:"
546560
$env:PSModulePath
547561

548-
if (-not(Get-Module -ListAvailable -Name Pester)) {
549-
"Installing module Pester"
562+
if (-not(Get-Module -ListAvailable -Name Pester))
563+
{ "Installing module Pester"
550564
$InstallTargetDir = ($env:PSModulePath -split ";")[0]
551565
Find-PSResource -Name 'Pester' -Repository $repository | Save-PSResource -Path $InstallTargetDir -TrustRepository
552566
}
@@ -568,7 +582,8 @@ function Find-MakeAppx() {
568582
# try to find
569583
if (!$UseX64MakeAppx -and $architecture -eq 'aarch64-pc-windows-msvc') {
570584
$arch = 'arm64'
571-
} else {
585+
}
586+
else {
572587
$arch = 'x64'
573588
}
574589

@@ -613,7 +628,8 @@ if ($packageType -eq 'msixbundle') {
613628
Write-Verbose -Verbose "Preview version detected"
614629
if ($isPrivate) {
615630
$productName += "-Private"
616-
} else {
631+
}
632+
else {
617633
$productName += "-Preview"
618634
}
619635
# save preview number
@@ -630,7 +646,8 @@ if ($packageType -eq 'msixbundle') {
630646

631647
if ($isPrivate) {
632648
$displayName += "-Private"
633-
} else {
649+
}
650+
else {
634651
$displayName += "-Preview"
635652
}
636653
}
@@ -780,4 +797,4 @@ if ($packageType -eq 'msixbundle') {
780797
Write-Host -ForegroundColor Green "`ntar.gz file is created at $tarFile"
781798
}
782799

783-
$env:RUST_BACKTRACE = 1
800+
$env:RUST_BACKTRACE=1

0 commit comments

Comments
 (0)