Skip to content

Commit 5d0cb89

Browse files
Merge pull request #4220 from PowerShell/andschwa/fix-release-build
Add assertion to build that PSES bits are built in release configuration, because it's way too easy to break that! We were building in release configuration, then running the tests...and the tests were then building (and overwriting the bits) in debug configuration.
2 parents 1829acb + 4c4a112 commit 5d0cb89

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

.vsts-ci/templates/ci-general.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,18 @@ steps:
7070
workingDirectory: $(Build.SourcesDirectory)/vscode-powershell
7171
pwsh: ${{ parameters.pwsh }}
7272

73+
- task: PowerShell@2
74+
displayName: Assert PowerShellEditorServices release configuration
75+
inputs:
76+
targetType: inline
77+
script: |
78+
$assembly = [Reflection.Assembly]::LoadFile("$(Build.SourcesDirectory)/vscode-powershell/modules/PowerShellEditorServices.VSCode/bin/Microsoft.PowerShell.EditorServices.VSCode.dll")
79+
if ($assembly.GetCustomAttributes([System.Diagnostics.DebuggableAttribute], $true).IsJITOptimizerDisabled) {
80+
Write-Host "##vso[task.LogIssue type=error;] PowerShell Editor Services bits were not built in release configuration!"
81+
exit 1
82+
}
83+
pwsh: ${{ parameters.pwsh }}
84+
7385
- publish: $(vsixPath)
7486
artifact: vscode-powershell-vsix-$(System.JobId)
7587
displayName: Publish extension artifact

vscode-powershell.build.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ task RestoreEditorServices -If (Get-EditorServicesPath) {
5050
}
5151

5252
Write-Host "`n### Building PSES`n" -ForegroundColor Green
53-
Invoke-Build Build (Get-EditorServicesPath)
53+
Invoke-Build Build (Get-EditorServicesPath) -Configuration $Configuration
5454
}
5555
"Release" {
5656
# When releasing, we ensure the bits are not symlinked but copied,
@@ -64,7 +64,7 @@ task RestoreEditorServices -If (Get-EditorServicesPath) {
6464
# We only build if it hasn't been built at all.
6565
if (!(Test-Path "$(Split-Path (Get-EditorServicesPath))/module/PowerShellEditorServices/bin")) {
6666
Write-Host "`n### Building PSES`n" -ForegroundColor Green
67-
Invoke-Build Build (Get-EditorServicesPath)
67+
Invoke-Build Build (Get-EditorServicesPath) -Configuration $Configuration
6868
}
6969

7070
Write-Host "`n### Copying PSES`n" -ForegroundColor Green

0 commit comments

Comments
 (0)