@@ -23,28 +23,22 @@ function Get-EditorServicesPath {
2323 return Resolve-Path " $psesRepoPath /PowerShellEditorServices.build.ps1" - ErrorAction Continue
2424}
2525
26- # region Restore tasks
27-
28- task Restore RestoreNodeModules - If { -not (Test-Path " $PSScriptRoot /node_modules" ) }
29-
30- task RestoreNodeModules {
31-
26+ task Restore - If { ! (Test-Path " $PSScriptRoot /node_modules" ) } {
3227 Write-Host " `n ### Restoring vscode-powershell dependencies`n " - ForegroundColor Green
33-
3428 # When in a CI build use the --loglevel=error parameter so that
3529 # package install warnings don't cause PowerShell to throw up
3630 $logLevelParam = if ($env: TF_BUILD ) { " --loglevel=error" } else { " " }
3731 exec { & npm install $logLevelParam }
3832}
3933
40- # endregion
34+
4135# region Clean tasks
4236
4337task Clean {
4438 Write-Host " `n ### Cleaning vscode-powershell`n " - ForegroundColor Green
45- Remove-Item .\ modules\ * - Exclude " README.md" - Recurse - Force - ErrorAction Ignore
46- Remove-Item .\ out - Recurse - Force - ErrorAction Ignore
47- Remove-Item - Force - Recurse node_modules - ErrorAction Ignore
39+ Remove-Item ./ modules - Exclude " README.md" - Recurse - Force - ErrorAction Ignore
40+ Remove-Item ./ out - Recurse - Force - ErrorAction Ignore
41+ Remove-Item . / node_modules - Recurse - Force - ErrorAction Ignore
4842}
4943
5044task CleanEditorServices - If (Get-EditorServicesPath ) {
@@ -57,26 +51,27 @@ task CleanAll CleanEditorServices, Clean
5751# endregion
5852# region Build tasks
5953
60- task Build Restore, {
61- Write-Host " `n ### Building vscode-powershell" - ForegroundColor Green
62- exec { & npm run compile }
63- }
64-
6554task BuildEditorServices - If (Get-EditorServicesPath ) {
6655 Write-Host " `n ### Building PowerShellEditorServices`n " - ForegroundColor Green
6756 Invoke-Build Build (Get-EditorServicesPath )
6857}
6958
59+ task CopyEditorServices - If { ! (Test-Path ./ modules/ PowerShellEditorServices) -and (Get-EditorServicesPath ) } BuildEditorServices, {
60+ Write-Host " `n ### Copying PowerShellEditorServices module files" - ForegroundColor Green
61+ Copy-Item - Recurse - Force " $ ( Split-Path (Get-EditorServicesPath )) /module/*" ./ modules
62+ }
63+
64+ task Build CopyEditorServices, Restore, {
65+ Write-Host " `n ### Building vscode-powershell" - ForegroundColor Green
66+ exec { & npm run compile }
67+ }
68+
7069task BuildAll BuildEditorServices, Build
7170
7271# endregion
7372# region Test tasks
7473
75- task Test Build, {
76- if ($env: TF_BUILD -and $global :IsLinux ) {
77- Write-Warning " Skipping extension tests in Linux CI because vscode does not support it."
78- return
79- }
74+ task Test - If (! ($env: TF_BUILD -and $global :IsLinux )) Build, {
8075 Write-Host " `n ### Running extension tests" - ForegroundColor Green
8176 exec { & npm run test }
8277}
@@ -109,28 +104,11 @@ task UpdateReadme -If { $script:IsPreviewExtension } {
109104}
110105
111106task Package UpdateReadme, {
112- if (Get-EditorServicesPath -or $env: TF_BUILD ) {
113- Write-Host " `n ### Copying PowerShellEditorServices module files" - ForegroundColor Green
114- Copy-Item - Recurse - Force ..\PowerShellEditorServices\module\* .\modules
115- } else {
116- throw " Unable to find PowerShell EditorServices"
117- }
118-
119- $packageName = " $ ( $script :PackageJson.name ) -$ ( $script :PackageJson.version ) .vsix"
120- Write-Host " `n ### Packaging $packageName `n " - ForegroundColor Green
107+ assert { Test-Path ./ modules/ PowerShellEditorServices }
108+ Write-Host " `n ### Packaging $ ( $script :PackageJson.name ) -$ ( $script :PackageJson.version ) .vsix`n " - ForegroundColor Green
121109 exec { & node ./ node_modules/ vsce/ out/ vsce package -- no- gitHubIssueLinking }
122-
123- if ($env: TF_BUILD ) {
124- $artifactsPath = " $env: BUILD_ARTIFACTSTAGINGDIRECTORY /vscode-powershell/"
125- " ./$packageName " , " ./scripts/Install-VSCode.ps1" | ForEach-Object {
126- Copy-Item - Verbose - Recurse $_ $artifactsPath
127- }
128- }
129110}
130111
131112# endregion
132113
133- # The set of tasks for a release
134- task Release Clean , Build, Package
135- # The default task is to run the entire CI build
136- task . CleanAll, BuildAll, Test, Package
114+ task . Build, Test, Package
0 commit comments