Skip to content

Commit 6ef2c21

Browse files
committed
Update build script to use Invoke-BuildItem instead of Exec
Since that's now a built-in alias.
1 parent 502ddaf commit 6ef2c21

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

PowerShellEditorServices.build.ps1

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -73,24 +73,24 @@ Task FindDotNet {
7373
}
7474

7575
Task BinClean {
76-
Remove-Item $PSScriptRoot\.tmp -Recurse -Force -ErrorAction Ignore
77-
Remove-Item $PSScriptRoot\module\PowerShellEditorServices\bin -Recurse -Force -ErrorAction Ignore
78-
Remove-Item $PSScriptRoot\module\PowerShellEditorServices.VSCode\bin -Recurse -Force -ErrorAction Ignore
76+
Remove-BuildItem $PSScriptRoot\.tmp
77+
Remove-BuildItem $PSScriptRoot\module\PowerShellEditorServices\bin
78+
Remove-BuildItem $PSScriptRoot\module\PowerShellEditorServices.VSCode\bin
7979
}
8080

8181
Task Clean FindDotNet, BinClean, {
82-
Exec { & dotnet clean $VerbosityArgs }
83-
Get-ChildItem -Recurse $PSScriptRoot\src\*.nupkg | Remove-Item -Force -ErrorAction Ignore
84-
Get-ChildItem $PSScriptRoot\PowerShellEditorServices*.zip | Remove-Item -Force -ErrorAction Ignore
85-
Get-ChildItem $PSScriptRoot\module\PowerShellEditorServices\Commands\en-US\*-help.xml | Remove-Item -Force -ErrorAction Ignore
82+
Invoke-BuildExec { & dotnet clean $VerbosityArgs }
83+
Get-ChildItem -Recurse $PSScriptRoot\src\*.nupkg | Remove-BuildItem
84+
Get-ChildItem $PSScriptRoot\PowerShellEditorServices*.zip | Remove-BuildItem
85+
Get-ChildItem $PSScriptRoot\module\PowerShellEditorServices\Commands\en-US\*-help.xml | Remove-BuildItem
8686

8787
# Remove bundled component modules
8888
$moduleJsonPath = "$PSScriptRoot\modules.json"
8989
if (Test-Path $moduleJsonPath) {
9090
Get-Content -Raw $moduleJsonPath |
9191
ConvertFrom-Json |
9292
ForEach-Object { $_.PSObject.Properties.Name } |
93-
ForEach-Object { Remove-Item -Path "$PSScriptRoot/module/$_" -Recurse -Force -ErrorAction Ignore }
93+
ForEach-Object { Remove-BuildItem -Path "$PSScriptRoot/module/$_" }
9494
}
9595
}
9696

@@ -161,15 +161,15 @@ Task SetupHelpForTests {
161161
}
162162

163163
Task Build FindDotNet, CreateBuildInfo, {
164-
Exec { & dotnet restore $VerbosityArgs }
165-
Exec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices\PowerShellEditorServices.csproj -f $script:NetRuntime.Standard }
166-
Exec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetRuntime.PS7 }
164+
Invoke-BuildExec { & dotnet restore $VerbosityArgs }
165+
Invoke-BuildExec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices\PowerShellEditorServices.csproj -f $script:NetRuntime.Standard }
166+
Invoke-BuildExec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetRuntime.PS7 }
167167
if (-not $script:IsNix) {
168-
Exec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetRuntime.Desktop }
168+
Invoke-BuildExec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script:NetRuntime.Desktop }
169169
}
170170

171171
# Build PowerShellEditorServices.VSCode module
172-
Exec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices.VSCode\PowerShellEditorServices.VSCode.csproj -f $script:NetRuntime.Standard }
172+
Invoke-BuildExec { & dotnet publish $VerbosityArgs -c $Configuration .\src\PowerShellEditorServices.VSCode\PowerShellEditorServices.VSCode.csproj -f $script:NetRuntime.Standard }
173173
}
174174

175175
Task Test TestServer, TestE2E
@@ -184,25 +184,25 @@ Task TestServerWinPS -If ($PSVersionTable.PSEdition -eq "Desktop") Build, SetupH
184184
# that is debuggable! If architecture is added, the assembly path gets an
185185
# additional folder, necesstiating fixes to find the commands definition
186186
# file and test files.
187-
Exec { & dotnet $script:dotnetTestArgs $script:NetRuntime.Desktop }
187+
Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetRuntime.Desktop }
188188
}
189189

190190
Task TestServerPS7 -If ($PSVersionTable.PSEdition -eq "Core" -and -not $script:IsAppleM1 -and -not $script:IsArm64) Build, SetupHelpForTests, {
191191
Set-Location .\test\PowerShellEditorServices.Test\
192-
Exec { & dotnet $script:dotnetTestArgs $script:NetRuntime.PS7 }
192+
Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetRuntime.PS7 }
193193
}
194194

195195
Task TestServerPS72 -If ($PSVersionTable.PSEdition -eq "Core") Build, SetupHelpForTests, {
196196
Set-Location .\test\PowerShellEditorServices.Test\
197-
Exec { & dotnet $script:dotnetTestArgs $script:NetRuntime.PS72 }
197+
Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetRuntime.PS72 }
198198
}
199199

200200
Task TestE2E Build, SetupHelpForTests, {
201201
Set-Location .\test\PowerShellEditorServices.Test.E2E\
202202

203203
$env:PWSH_EXE_NAME = if ($IsCoreCLR) { "pwsh" } else { "powershell" }
204204
$NetRuntime = if ($IsAppleM1 -or $script:IsArm64) { $script:NetRuntime.PS72 } else { $script:NetRuntime.PS7 }
205-
Exec { & dotnet $script:dotnetTestArgs $NetRuntime }
205+
Invoke-BuildExec { & dotnet $script:dotnetTestArgs $NetRuntime }
206206

207207
if (!$script:IsNix) {
208208
if (-not [Security.Principal.WindowsIdentity]::GetCurrent().Owner.IsWellKnown("BuiltInAdministratorsSid")) {
@@ -213,7 +213,7 @@ Task TestE2E Build, SetupHelpForTests, {
213213
try {
214214
Write-Host "Running end-to-end tests in Constrained Language Mode."
215215
[System.Environment]::SetEnvironmentVariable("__PSLockdownPolicy", "0x80000007", [System.EnvironmentVariableTarget]::Machine);
216-
Exec { & dotnet $script:dotnetTestArgs $script:NetRuntime.PS7 }
216+
Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetRuntime.PS7 }
217217
} finally {
218218
[System.Environment]::SetEnvironmentVariable("__PSLockdownPolicy", $null, [System.EnvironmentVariableTarget]::Machine);
219219
}

0 commit comments

Comments
 (0)