5
5
6
6
param (
7
7
[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' )]
9
9
$architecture = ' current' ,
10
10
[switch ]$Clippy ,
11
11
[switch ]$SkipBuild ,
12
- [ValidateSet (' msix' , ' msix-private' , ' msixbundle' , ' tgz' , ' zip' )]
12
+ [ValidateSet (' msix' , ' msix-private' , ' msixbundle' , ' tgz' , ' zip' )]
13
13
$packageType ,
14
14
[switch ]$Test ,
15
15
[switch ]$GetPackageVersion ,
@@ -142,7 +142,8 @@ function Find-LinkExe {
142
142
$linkexe = (Get-Location ).Path
143
143
Write-Verbose - Verbose " Using $linkexe "
144
144
$linkexe
145
- } finally {
145
+ }
146
+ finally {
146
147
Pop-Location
147
148
}
148
149
}
@@ -169,7 +170,8 @@ if ($null -ne $packageType) {
169
170
if (! $IsWindows ) {
170
171
curl https:// sh.rustup.rs - sSf | sh - s -- - y
171
172
$env: PATH += " :$env: HOME /.cargo/bin"
172
- } else {
173
+ }
174
+ else {
173
175
Invoke-WebRequest ' https://static.rust-lang.org/rustup/dist/i686-pc-windows-gnu/rustup-init.exe' - OutFile ' temp:/rustup-init.exe'
174
176
Write-Verbose - Verbose " Use the default settings to ensure build works"
175
177
& ' temp:/rustup-init.exe' - y
@@ -212,9 +214,9 @@ if (!$SkipBuild -and !$SkipLinkCheck -and $IsWindows -and !(Get-Command 'link.ex
212
214
if (! (Test-Path $BuildToolsPath )) {
213
215
Write-Verbose - Verbose " link.exe not found, installing C++ build tools"
214
216
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' )
216
218
if ($env: PROCESSOR_ARCHITECTURE -eq ' ARM64' ) {
217
- $arg += ' --add' , ' Microsoft.VisualStudio.Component.VC.Tools.ARM64'
219
+ $arg += ' --add' , ' Microsoft.VisualStudio.Component.VC.Tools.ARM64'
218
220
}
219
221
Start-Process - FilePath ' temp:/vs_buildtools.exe' - ArgumentList $arg - Wait
220
222
Remove-Item temp:/ vs_installer.exe - ErrorAction Ignore
@@ -244,7 +246,8 @@ $flags = @($Release ? '-r' : $null)
244
246
if ($architecture -eq ' current' ) {
245
247
$path = " .\target\$configuration "
246
248
$target = Join-Path $PSScriptRoot ' bin' $configuration
247
- } else {
249
+ }
250
+ else {
248
251
$flags += ' --target'
249
252
$flags += $architecture
250
253
$path = " .\target\$architecture \$configuration "
@@ -287,7 +290,8 @@ if (!$SkipBuild) {
287
290
$env: CARGO_REGISTRIES_POWERSHELL_CREDENTIAL_PROVIDER = ' cargo:token'
288
291
$env: CARGO_REGISTRIES_POWERSHELL_INDEX = " sparse+https://pkgs.dev.azure.com/powershell/PowerShell/_packaging/powershell~force-auth/Cargo/index/"
289
292
}
290
- } else {
293
+ }
294
+ else {
291
295
Write-Warning " Azure CLI not found, proceeding with anonymous access."
292
296
}
293
297
}
@@ -344,7 +348,8 @@ if (!$SkipBuild) {
344
348
if (($project -eq ' tree-sitter-dscexpression' ) -or ($project -eq ' tree-sitter-ssh-server-config' )) {
345
349
if ($UpdateLockFile ) {
346
350
cargo generate- lockfile
347
- } else {
351
+ }
352
+ else {
348
353
if ($Audit ) {
349
354
if ($null -eq (Get-Command cargo- audit - ErrorAction Ignore)) {
350
355
cargo install cargo- audit -- features= fix
@@ -357,21 +362,26 @@ if (!$SkipBuild) {
357
362
}
358
363
}
359
364
360
- if (Test-Path " ./Cargo.toml" ) {
365
+ if (Test-Path " ./Cargo.toml" )
366
+ {
361
367
if ($Clippy ) {
362
368
if ($clippy_unclean_projects -contains $project ) {
363
369
Write-Verbose - Verbose " Skipping clippy for $project "
364
- } elseif ($pedantic_unclean_projects -contains $project ) {
370
+ }
371
+ elseif ($pedantic_unclean_projects -contains $project ) {
365
372
Write-Verbose - Verbose " Running clippy for $project "
366
373
cargo clippy @flags -- - Dwarnings
367
- } else {
374
+ }
375
+ else {
368
376
Write-Verbose - Verbose " Running clippy with pedantic for $project "
369
377
cargo clippy @flags --% -- -Dwarnings -Dclippy::pedantic
370
378
}
371
- } else {
379
+ }
380
+ else {
372
381
if ($UpdateLockFile ) {
373
382
cargo generate- lockfile
374
- } else {
383
+ }
384
+ else {
375
385
if ($Audit ) {
376
386
if ($null -eq (Get-Command cargo- audit - ErrorAction Ignore)) {
377
387
cargo install cargo- audit -- features= fix
@@ -399,7 +409,8 @@ if (!$SkipBuild) {
399
409
if ($IsWindows ) {
400
410
Copy-Item " $path /$binary .exe" $target - ErrorAction Ignore - Verbose
401
411
Copy-Item " $path /$binary .pdb" $target - ErrorAction Ignore - Verbose
402
- } else {
412
+ }
413
+ else {
403
414
Copy-Item " $path /$binary " $target - ErrorAction Ignore - Verbose
404
415
}
405
416
@@ -457,7 +468,8 @@ if (!$Clippy -and !$SkipBuild) {
457
468
$dirSeparator = [System.IO.Path ]::DirectorySeparatorChar
458
469
if ($Release ) {
459
470
$oldTarget = $target.Replace ($dirSeparator + ' release' , $dirSeparator + ' debug' )
460
- } else {
471
+ }
472
+ else {
461
473
$oldTarget = $target.Replace ($dirSeparator + ' debug' , $dirSeparator + ' release' )
462
474
}
463
475
$env: PATH = $env: PATH.Replace ($oldTarget , ' ' )
@@ -496,14 +508,15 @@ if ($Test) {
496
508
497
509
if ($IsWindows ) {
498
510
# 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
+ {
501
514
Install-PSResource - Name PSDesiredStateConfiguration - Version 2.0 .7 - Repository $repository - TrustRepository
502
515
}
503
516
}
504
517
505
- if (-not (Get-Module - ListAvailable - Name Pester)) {
506
- " Installing module Pester"
518
+ if (-not (Get-Module - ListAvailable - Name Pester))
519
+ { " Installing module Pester"
507
520
Install-PSResource Pester - WarningAction Ignore - Repository $repository - TrustRepository
508
521
}
509
522
@@ -516,7 +529,8 @@ if ($Test) {
516
529
Write-Host - ForegroundColor Cyan " Testing $project ..."
517
530
try {
518
531
Push-Location " $PSScriptRoot /$project "
519
- if (Test-Path " ./Cargo.toml" ) {
532
+ if (Test-Path " ./Cargo.toml" )
533
+ {
520
534
cargo test
521
535
522
536
if ($LASTEXITCODE -ne 0 ) {
@@ -545,8 +559,8 @@ if ($Test) {
545
559
" Updated PSModulePath is:"
546
560
$env: PSModulePath
547
561
548
- if (-not (Get-Module - ListAvailable - Name Pester)) {
549
- " Installing module Pester"
562
+ if (-not (Get-Module - ListAvailable - Name Pester))
563
+ { " Installing module Pester"
550
564
$InstallTargetDir = ($env: PSModulePath -split " ;" )[0 ]
551
565
Find-PSResource - Name ' Pester' - Repository $repository | Save-PSResource - Path $InstallTargetDir - TrustRepository
552
566
}
@@ -568,7 +582,8 @@ function Find-MakeAppx() {
568
582
# try to find
569
583
if (! $UseX64MakeAppx -and $architecture -eq ' aarch64-pc-windows-msvc' ) {
570
584
$arch = ' arm64'
571
- } else {
585
+ }
586
+ else {
572
587
$arch = ' x64'
573
588
}
574
589
@@ -613,7 +628,8 @@ if ($packageType -eq 'msixbundle') {
613
628
Write-Verbose - Verbose " Preview version detected"
614
629
if ($isPrivate ) {
615
630
$productName += " -Private"
616
- } else {
631
+ }
632
+ else {
617
633
$productName += " -Preview"
618
634
}
619
635
# save preview number
@@ -630,7 +646,8 @@ if ($packageType -eq 'msixbundle') {
630
646
631
647
if ($isPrivate ) {
632
648
$displayName += " -Private"
633
- } else {
649
+ }
650
+ else {
634
651
$displayName += " -Preview"
635
652
}
636
653
}
@@ -780,4 +797,4 @@ if ($packageType -eq 'msixbundle') {
780
797
Write-Host - ForegroundColor Green " `n tar.gz file is created at $tarFile "
781
798
}
782
799
783
- $env: RUST_BACKTRACE = 1
800
+ $env: RUST_BACKTRACE = 1
0 commit comments