@@ -23,28 +23,22 @@ function Get-EditorServicesPath {
23
23
return Resolve-Path " $psesRepoPath /PowerShellEditorServices.build.ps1" - ErrorAction Continue
24
24
}
25
25
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" ) } {
32
27
Write-Host " `n ### Restoring vscode-powershell dependencies`n " - ForegroundColor Green
33
-
34
28
# When in a CI build use the --loglevel=error parameter so that
35
29
# package install warnings don't cause PowerShell to throw up
36
30
$logLevelParam = if ($env: TF_BUILD ) { " --loglevel=error" } else { " " }
37
31
exec { & npm install $logLevelParam }
38
32
}
39
33
40
- # endregion
34
+
41
35
# region Clean tasks
42
36
43
37
task Clean {
44
38
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
48
42
}
49
43
50
44
task CleanEditorServices - If (Get-EditorServicesPath ) {
@@ -57,26 +51,27 @@ task CleanAll CleanEditorServices, Clean
57
51
# endregion
58
52
# region Build tasks
59
53
60
- task Build Restore, {
61
- Write-Host " `n ### Building vscode-powershell" - ForegroundColor Green
62
- exec { & npm run compile }
63
- }
64
-
65
54
task BuildEditorServices - If (Get-EditorServicesPath ) {
66
55
Write-Host " `n ### Building PowerShellEditorServices`n " - ForegroundColor Green
67
56
Invoke-Build Build (Get-EditorServicesPath )
68
57
}
69
58
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
+
70
69
task BuildAll BuildEditorServices, Build
71
70
72
71
# endregion
73
72
# region Test tasks
74
73
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, {
80
75
Write-Host " `n ### Running extension tests" - ForegroundColor Green
81
76
exec { & npm run test }
82
77
}
@@ -109,28 +104,11 @@ task UpdateReadme -If { $script:IsPreviewExtension } {
109
104
}
110
105
111
106
task 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
121
109
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
- }
129
110
}
130
111
131
112
# endregion
132
113
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