Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/azure-pipelines/win32/product-build-win32-compile.yml
3520 views
1
parameters:
2
- name: VSCODE_ARCH
3
type: string
4
- name: VSCODE_CIBUILD
5
type: boolean
6
- name: VSCODE_QUALITY
7
type: string
8
- name: VSCODE_RUN_ELECTRON_TESTS
9
type: boolean
10
default: false
11
- name: VSCODE_RUN_BROWSER_TESTS
12
type: boolean
13
default: false
14
- name: VSCODE_RUN_REMOTE_TESTS
15
type: boolean
16
default: false
17
18
steps:
19
- template: ../common/checkout.yml@self
20
21
- task: NodeTool@0
22
inputs:
23
versionSource: fromFile
24
versionFilePath: .nvmrc
25
26
- task: UsePythonVersion@0
27
inputs:
28
versionSpec: "3.x"
29
addToPath: true
30
31
- template: ../distro/download-distro.yml@self
32
33
- task: AzureKeyVault@2
34
displayName: "Azure Key Vault: Get Secrets"
35
inputs:
36
azureSubscription: vscode
37
KeyVaultName: vscode-build-secrets
38
SecretsFilter: "github-distro-mixin-password"
39
40
- task: DownloadPipelineArtifact@2
41
inputs:
42
artifact: Compilation
43
path: $(Build.ArtifactStagingDirectory)
44
displayName: Download compilation output
45
46
- task: ExtractFiles@1
47
displayName: Extract compilation output
48
inputs:
49
archiveFilePatterns: "$(Build.ArtifactStagingDirectory)/compilation.tar.gz"
50
cleanDestinationFolder: false
51
52
- powershell: node build/setup-npm-registry.js $env:NPM_REGISTRY
53
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
54
displayName: Setup NPM Registry
55
56
- pwsh: |
57
mkdir .build -ea 0
58
node build/azure-pipelines/common/computeNodeModulesCacheKey.js win32 $(VSCODE_ARCH) $(node -p process.arch) > .build/packagelockhash
59
displayName: Prepare node_modules cache key
60
61
- task: Cache@2
62
inputs:
63
key: '"node_modules" | .build/packagelockhash'
64
path: .build/node_modules_cache
65
cacheHitVar: NODE_MODULES_RESTORED
66
displayName: Restore node_modules cache
67
68
- powershell: 7z.exe x .build/node_modules_cache/cache.7z -aoa
69
condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true'))
70
displayName: Extract node_modules cache
71
72
- powershell: |
73
. build/azure-pipelines/win32/exec.ps1
74
$ErrorActionPreference = "Stop"
75
# Set the private NPM registry to the global npmrc file
76
# so that authentication works for subfolders like build/, remote/, extensions/ etc
77
# which does not have their own .npmrc file
78
exec { npm config set registry "$env:NPM_REGISTRY" }
79
$NpmrcPath = (npm config get userconfig)
80
echo "##vso[task.setvariable variable=NPMRC_PATH]$NpmrcPath"
81
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
82
displayName: Setup NPM
83
84
- task: npmAuthenticate@0
85
inputs:
86
workingFile: $(NPMRC_PATH)
87
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
88
displayName: Setup NPM Authentication
89
90
# Remove once https://github.com/parcel-bundler/watcher/pull/202 is merged.
91
- pwsh: |
92
$includes = @'
93
{
94
'target_defaults': {
95
'conditions': [
96
['OS=="win"', {
97
"msvs_settings": {
98
"VCCLCompilerTool": {
99
"AdditionalOptions": [
100
"/guard:cf",
101
"/w34244",
102
"/w34267",
103
]
104
},
105
"VCLinkerTool": {
106
"AdditionalOptions": [
107
"/guard:cf",
108
]
109
}
110
}
111
}]
112
]
113
}
114
}
115
'@
116
117
if (!(Test-Path "~/.gyp")) {
118
mkdir "~/.gyp"
119
}
120
echo $includes > "~/.gyp/include.gypi"
121
displayName: Create include.gypi
122
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
123
124
- powershell: |
125
. build/azure-pipelines/win32/exec.ps1
126
$ErrorActionPreference = "Stop"
127
exec { npm ci }
128
env:
129
npm_config_arch: $(VSCODE_ARCH)
130
npm_config_foreground_scripts: "true"
131
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
132
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
133
GITHUB_TOKEN: "$(github-distro-mixin-password)"
134
retryCountOnTaskFailure: 5
135
displayName: Install dependencies
136
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
137
138
- powershell: node build/azure-pipelines/distro/mixin-npm
139
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
140
displayName: Mixin distro node modules
141
142
- powershell: |
143
. build/azure-pipelines/win32/exec.ps1
144
$ErrorActionPreference = "Stop"
145
exec { node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt }
146
exec { mkdir -Force .build/node_modules_cache }
147
exec { 7z.exe a .build/node_modules_cache/cache.7z -mx3 `@.build/node_modules_list.txt }
148
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
149
displayName: Create node_modules archive
150
151
- powershell: node build/azure-pipelines/distro/mixin-quality
152
displayName: Mixin distro quality
153
154
- template: ../common/install-builtin-extensions.yml@self
155
156
- ${{ if ne(parameters.VSCODE_CIBUILD, true) }}:
157
- powershell: node build\lib\policies win32
158
displayName: Generate Group Policy definitions
159
retryCountOnTaskFailure: 3
160
161
- ${{ if and(ne(parameters.VSCODE_CIBUILD, true), ne(parameters.VSCODE_QUALITY, 'exploration')) }}:
162
- powershell: node build/win32/explorer-dll-fetcher .build/win32/appx
163
displayName: Download Explorer dll
164
165
- powershell: |
166
. build/azure-pipelines/win32/exec.ps1
167
$ErrorActionPreference = "Stop"
168
exec { npm run gulp "vscode-win32-$(VSCODE_ARCH)-min-ci" }
169
exec { npm run gulp "vscode-win32-$(VSCODE_ARCH)-inno-updater" }
170
echo "##vso[task.setvariable variable=BUILT_CLIENT]true"
171
echo "##vso[task.setvariable variable=CodeSigningFolderPath]$(Agent.BuildDirectory)/VSCode-win32-$(VSCODE_ARCH)"
172
env:
173
GITHUB_TOKEN: "$(github-distro-mixin-password)"
174
displayName: Build client
175
176
# Note: the appx prepare step has to follow Build client step since build step replaces the template
177
# strings in the raw manifest file at resources/win32/appx/AppxManifest.xml and places it under
178
# <build-out-dir>/appx/manifest, we need a separate step to prepare the appx package with the
179
# final contents. In our case only the manifest file is bundled into the appx package.
180
- ${{ if and(ne(parameters.VSCODE_CIBUILD, true), ne(parameters.VSCODE_QUALITY, 'exploration')) }}:
181
- powershell: |
182
. build/azure-pipelines/win32/exec.ps1
183
$ErrorActionPreference = "Stop"
184
# Add Windows SDK to path
185
$sdk = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64"
186
$env:PATH = "$sdk;$env:PATH"
187
$AppxName = if ('$(VSCODE_QUALITY)' -eq 'stable') { 'code' } else { 'code_insider' }
188
makeappx pack /d "$(Agent.BuildDirectory)/VSCode-win32-$(VSCODE_ARCH)/appx/manifest" /p "$(Agent.BuildDirectory)/VSCode-win32-$(VSCODE_ARCH)/appx/${AppxName}_$(VSCODE_ARCH).appx" /nv
189
# Remove the raw manifest folder
190
Remove-Item -Path "$(Agent.BuildDirectory)/VSCode-win32-$(VSCODE_ARCH)/appx/manifest" -Recurse -Force
191
displayName: Prepare appx package
192
193
- powershell: |
194
. build/azure-pipelines/win32/exec.ps1
195
$ErrorActionPreference = "Stop"
196
exec { npm run gulp "vscode-reh-win32-$(VSCODE_ARCH)-min-ci" }
197
mv ..\vscode-reh-win32-$(VSCODE_ARCH) ..\vscode-server-win32-$(VSCODE_ARCH) # TODO@joaomoreno
198
echo "##vso[task.setvariable variable=BUILT_SERVER]true"
199
echo "##vso[task.setvariable variable=CodeSigningFolderPath]$(CodeSigningFolderPath),$(Agent.BuildDirectory)/vscode-server-win32-$(VSCODE_ARCH)"
200
env:
201
GITHUB_TOKEN: "$(github-distro-mixin-password)"
202
displayName: Build server
203
204
- powershell: |
205
. build/azure-pipelines/win32/exec.ps1
206
$ErrorActionPreference = "Stop"
207
exec { npm run gulp "vscode-reh-web-win32-$(VSCODE_ARCH)-min-ci" }
208
mv ..\vscode-reh-web-win32-$(VSCODE_ARCH) ..\vscode-server-win32-$(VSCODE_ARCH)-web # TODO@joaomoreno
209
echo "##vso[task.setvariable variable=BUILT_WEB]true"
210
env:
211
GITHUB_TOKEN: "$(github-distro-mixin-password)"
212
displayName: Build server (web)
213
214
- ${{ if ne(parameters.VSCODE_CIBUILD, true) }}:
215
- task: DownloadPipelineArtifact@2
216
inputs:
217
artifact: unsigned_vscode_cli_win32_$(VSCODE_ARCH)_cli
218
patterns: "**"
219
path: $(Build.ArtifactStagingDirectory)/cli
220
displayName: Download VS Code CLI
221
222
- powershell: |
223
. build/azure-pipelines/win32/exec.ps1
224
$ErrorActionPreference = "Stop"
225
$ArtifactName = (gci -Path "$(Build.ArtifactStagingDirectory)/cli" | Select-Object -last 1).FullName
226
Expand-Archive -Path $ArtifactName -DestinationPath "$(Build.ArtifactStagingDirectory)/cli"
227
$AppProductJson = Get-Content -Raw -Path "$(Agent.BuildDirectory)\VSCode-win32-$(VSCODE_ARCH)\resources\app\product.json" | ConvertFrom-Json
228
$CliAppName = $AppProductJson.tunnelApplicationName
229
$AppName = $AppProductJson.applicationName
230
Move-Item -Path "$(Build.ArtifactStagingDirectory)/cli/$AppName.exe" -Destination "$(Agent.BuildDirectory)/VSCode-win32-$(VSCODE_ARCH)/bin/$CliAppName.exe"
231
displayName: Move VS Code CLI
232
233
- task: UseDotNet@2
234
inputs:
235
version: 6.x
236
237
- task: EsrpCodeSigning@5
238
inputs:
239
UseMSIAuthentication: true
240
ConnectedServiceName: vscode-esrp
241
AppRegistrationClientId: $(ESRP_CLIENT_ID)
242
AppRegistrationTenantId: $(ESRP_TENANT_ID)
243
AuthAKVName: vscode-esrp
244
AuthSignCertName: esrp-sign
245
FolderPath: .
246
Pattern: noop
247
displayName: 'Install ESRP Tooling'
248
249
- powershell: |
250
. build/azure-pipelines/win32/exec.ps1
251
$ErrorActionPreference = "Stop"
252
$EsrpCodeSigningTool = (gci -directory -filter EsrpCodeSigning_* $(Agent.RootDirectory)\_tasks | Select-Object -last 1).FullName
253
$Version = (gci -directory $EsrpCodeSigningTool | Select-Object -last 1).FullName
254
echo "##vso[task.setvariable variable=EsrpCliDllPath]$Version\net6.0\esrpcli.dll"
255
displayName: Find ESRP CLI
256
257
- powershell: |
258
. build/azure-pipelines/win32/exec.ps1
259
$ErrorActionPreference = "Stop"
260
mkdir -Force .build/node-cpuprofile
261
exec { npx deemon --detach --wait -- npx zx build/azure-pipelines/win32/codesign.js }
262
env:
263
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
264
NODE_DEBUG: "net,child_process"
265
NODE_OPTIONS: "--report-filename=stdout --report-uncaught-exception --report-on-fatalerror --cpu-prof --cpu-prof-dir=.build/node-cpuprofile"
266
displayName: ✍️ Codesign
267
268
- ${{ if or(eq(parameters.VSCODE_RUN_ELECTRON_TESTS, true), eq(parameters.VSCODE_RUN_BROWSER_TESTS, true), eq(parameters.VSCODE_RUN_REMOTE_TESTS, true)) }}:
269
- template: product-build-win32-test.yml@self
270
parameters:
271
VSCODE_ARCH: ${{ parameters.VSCODE_ARCH }}
272
VSCODE_RUN_ELECTRON_TESTS: ${{ parameters.VSCODE_RUN_ELECTRON_TESTS }}
273
VSCODE_RUN_BROWSER_TESTS: ${{ parameters.VSCODE_RUN_BROWSER_TESTS }}
274
VSCODE_RUN_REMOTE_TESTS: ${{ parameters.VSCODE_RUN_REMOTE_TESTS }}
275
276
- ${{ if ne(parameters.VSCODE_CIBUILD, true) }}:
277
- powershell: |
278
. build/azure-pipelines/win32/exec.ps1
279
$ErrorActionPreference = "Stop"
280
exec { npx deemon --attach -- npx zx build/azure-pipelines/win32/codesign.js }
281
condition: succeededOrFailed()
282
env:
283
NODE_DEBUG: "net,child_process"
284
NODE_OPTIONS: "--report-filename=stdout --report-uncaught-exception --report-on-fatalerror --cpu-prof --cpu-prof-dir=.build/node-cpuprofile"
285
displayName: "✍️ Post-job: Codesign"
286
287
- powershell: |
288
$ErrorActionPreference = "Stop"
289
290
$PackageJson = Get-Content -Raw -Path ..\VSCode-win32-$(VSCODE_ARCH)\resources\app\package.json | ConvertFrom-Json
291
$Version = $PackageJson.version
292
293
$ClientArchivePath = ".build\win32-$(VSCODE_ARCH)\VSCode-win32-$(VSCODE_ARCH)-$Version.zip"
294
$ServerArchivePath = ".build\win32-$(VSCODE_ARCH)\vscode-server-win32-$(VSCODE_ARCH).zip"
295
$WebArchivePath = ".build\win32-$(VSCODE_ARCH)\vscode-server-win32-$(VSCODE_ARCH)-web.zip"
296
297
$SystemSetupPath = ".build\win32-$(VSCODE_ARCH)\system-setup\VSCodeSetup-$(VSCODE_ARCH)-$Version.exe"
298
$UserSetupPath = ".build\win32-$(VSCODE_ARCH)\user-setup\VSCodeUserSetup-$(VSCODE_ARCH)-$Version.exe"
299
300
mv .build\win32-$(VSCODE_ARCH)\system-setup\VSCodeSetup.exe $SystemSetupPath
301
mv .build\win32-$(VSCODE_ARCH)\user-setup\VSCodeSetup.exe $UserSetupPath
302
303
echo "##vso[task.setvariable variable=CLIENT_PATH]$ClientArchivePath"
304
echo "##vso[task.setvariable variable=SERVER_PATH]$ServerArchivePath"
305
echo "##vso[task.setvariable variable=WEB_PATH]$WebArchivePath"
306
307
echo "##vso[task.setvariable variable=SYSTEM_SETUP_PATH]$SystemSetupPath"
308
echo "##vso[task.setvariable variable=USER_SETUP_PATH]$UserSetupPath"
309
condition: succeededOrFailed()
310
displayName: Move setup packages
311
312
- powershell: echo "##vso[task.setvariable variable=ARTIFACT_PREFIX]attempt$(System.JobAttempt)_"
313
condition: and(succeededOrFailed(), notIn(variables['Agent.JobStatus'], 'Succeeded', 'SucceededWithIssues'))
314
displayName: Generate artifact prefix
315
316