@@ -73,24 +73,24 @@ Task FindDotNet {
73
73
}
74
74
75
75
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
79
79
}
80
80
81
81
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
86
86
87
87
# Remove bundled component modules
88
88
$moduleJsonPath = " $PSScriptRoot \modules.json"
89
89
if (Test-Path $moduleJsonPath ) {
90
90
Get-Content - Raw $moduleJsonPath |
91
91
ConvertFrom-Json |
92
92
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/$_ " }
94
94
}
95
95
}
96
96
@@ -161,15 +161,15 @@ Task SetupHelpForTests {
161
161
}
162
162
163
163
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 }
167
167
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 }
169
169
}
170
170
171
171
# 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 }
173
173
}
174
174
175
175
Task Test TestServer, TestE2E
@@ -184,25 +184,25 @@ Task TestServerWinPS -If ($PSVersionTable.PSEdition -eq "Desktop") Build, SetupH
184
184
# that is debuggable! If architecture is added, the assembly path gets an
185
185
# additional folder, necesstiating fixes to find the commands definition
186
186
# file and test files.
187
- Exec { & dotnet $script :dotnetTestArgs $script :NetRuntime.Desktop }
187
+ Invoke-BuildExec { & dotnet $script :dotnetTestArgs $script :NetRuntime.Desktop }
188
188
}
189
189
190
190
Task TestServerPS7 - If ($PSVersionTable.PSEdition -eq " Core" -and -not $script :IsAppleM1 -and -not $script :IsArm64 ) Build, SetupHelpForTests, {
191
191
Set-Location .\test\PowerShellEditorServices.Test\
192
- Exec { & dotnet $script :dotnetTestArgs $script :NetRuntime.PS7 }
192
+ Invoke-BuildExec { & dotnet $script :dotnetTestArgs $script :NetRuntime.PS7 }
193
193
}
194
194
195
195
Task TestServerPS72 - If ($PSVersionTable.PSEdition -eq " Core" ) Build, SetupHelpForTests, {
196
196
Set-Location .\test\PowerShellEditorServices.Test\
197
- Exec { & dotnet $script :dotnetTestArgs $script :NetRuntime.PS72 }
197
+ Invoke-BuildExec { & dotnet $script :dotnetTestArgs $script :NetRuntime.PS72 }
198
198
}
199
199
200
200
Task TestE2E Build, SetupHelpForTests, {
201
201
Set-Location .\test\PowerShellEditorServices.Test.E2E\
202
202
203
203
$env: PWSH_EXE_NAME = if ($IsCoreCLR ) { " pwsh" } else { " powershell" }
204
204
$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 }
206
206
207
207
if (! $script :IsNix ) {
208
208
if (-not [Security.Principal.WindowsIdentity ]::GetCurrent().Owner.IsWellKnown(" BuiltInAdministratorsSid" )) {
@@ -213,7 +213,7 @@ Task TestE2E Build, SetupHelpForTests, {
213
213
try {
214
214
Write-Host " Running end-to-end tests in Constrained Language Mode."
215
215
[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 }
217
217
} finally {
218
218
[System.Environment ]::SetEnvironmentVariable(" __PSLockdownPolicy" , $null , [System.EnvironmentVariableTarget ]::Machine);
219
219
}
0 commit comments