@@ -118,15 +118,27 @@ task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, TestE
118
118
Write-Host " `n ### Using dotnet v$ ( & $script :dotnetExe -- version) at path $script :dotnetExe `n " - ForegroundColor Green
119
119
}
120
120
121
- task Clean {
122
- exec { & $script :dotnetExe restore }
123
- exec { & $script :dotnetExe clean }
121
+ task BinClean {
124
122
Remove-Item $PSScriptRoot \.tmp - Recurse - Force - ErrorAction Ignore
125
123
Remove-Item $PSScriptRoot \module\PowerShellEditorServices\bin - Recurse - Force - ErrorAction Ignore
126
124
Remove-Item $PSScriptRoot \module\PowerShellEditorServices.VSCode\bin - Recurse - Force - ErrorAction Ignore
125
+ }
126
+
127
+ task Clean BinClean, {
128
+ exec { & $script :dotnetExe restore }
129
+ exec { & $script :dotnetExe clean }
127
130
Get-ChildItem - Recurse $PSScriptRoot \src\* .nupkg | Remove-Item - Force - ErrorAction Ignore
128
131
Get-ChildItem $PSScriptRoot \PowerShellEditorServices* .zip | Remove-Item - Force - ErrorAction Ignore
129
132
Get-ChildItem $PSScriptRoot \module\PowerShellEditorServices\Commands\en- US\*- help.xml | Remove-Item - Force - ErrorAction Ignore
133
+
134
+ # Remove bundled component modules
135
+ $moduleJsonPath = " $PSScriptRoot \modules.json"
136
+ if (Test-Path $moduleJsonPath ) {
137
+ Get-Content - Raw $moduleJsonPath |
138
+ ConvertFrom-Json |
139
+ ForEach-Object { $_.PSObject.Properties.Name } |
140
+ ForEach-Object { Remove-Item - Path " $PSScriptRoot /module/$_ " - Recurse - Force - ErrorAction Ignore }
141
+ }
130
142
}
131
143
132
144
task GetProductVersion - Before PackageModule, UploadArtifacts {
@@ -156,30 +168,34 @@ task GetProductVersion -Before PackageModule, UploadArtifacts {
156
168
157
169
task CreateBuildInfo - Before Build {
158
170
$buildVersion = " <development-build>"
159
- $buildOrigin = " <development>"
171
+ $buildOrigin = " Development"
172
+
173
+ # Set build info fields on build platforms
174
+ if ($env: TF_BUILD ) {
175
+ if ($env: BUILD_BUILDNUMBER -like " PR-*" ) {
176
+ $buildOrigin = " PR"
177
+ } elseif ($env: BUILD_DEFINITIONNAME -like " *-CI" ) {
178
+ $buildOrigin = " CI"
179
+ } else {
180
+ $buildOrigin = " Release"
181
+ }
160
182
161
- if ($propsBody.VersionSuffix )
162
- {
163
183
$propsXml = [xml ](Get-Content - Raw - LiteralPath " $PSScriptRoot /PowerShellEditorServices.Common.props" )
164
184
$propsBody = $propsXml.Project.PropertyGroup
165
185
$buildVersion = $propsBody.VersionPrefix
166
- $buildVersion += ' -' + $propsBody.VersionSuffix
167
- }
168
186
169
- # Set build info fields on build platforms
170
- if ( $ env: TF_BUILD )
171
- {
172
- $buildOrigin = " VSTS "
187
+ if ( $propsBody .VersionSuffix )
188
+ {
189
+ $buildVersion += ' - ' + $propsBody .VersionSuffix
190
+ }
173
191
}
174
192
175
193
# Allow override of build info fields (except date)
176
- if ($env: PSES_BUILD_VERSION )
177
- {
194
+ if ($env: PSES_BUILD_VERSION ) {
178
195
$buildVersion = $env: PSES_BUILD_VERSION
179
196
}
180
197
181
- if ($env: PSES_BUILD_ORIGIN )
182
- {
198
+ if ($env: PSES_BUILD_ORIGIN ) {
183
199
$buildOrigin = $env: PSES_BUILD_ORIGIN
184
200
}
185
201
@@ -208,7 +224,7 @@ task SetupHelpForTests -Before Test {
208
224
}
209
225
}
210
226
211
- task Build {
227
+ task Build BinClean , {
212
228
exec { & $script :dotnetExe publish - c $Configuration .\src\PowerShellEditorServices\PowerShellEditorServices.csproj -f $script :NetRuntime.Standard }
213
229
exec { & $script :dotnetExe publish - c $Configuration .\src\PowerShellEditorServices.Hosting\PowerShellEditorServices.Hosting.csproj -f $script :NetRuntime.Core }
214
230
if (-not $script :IsUnix )
0 commit comments