Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/azure-pipelines/win32/steps/product-build-win32-compile.yml
4774 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.ts $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.ts 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
- powershell: |
91
. build/azure-pipelines/win32/exec.ps1
92
$ErrorActionPreference = "Stop"
93
exec { npm ci }
94
env:
95
npm_config_arch: $(VSCODE_ARCH)
96
npm_config_foreground_scripts: "true"
97
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
98
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
99
GITHUB_TOKEN: "$(github-distro-mixin-password)"
100
retryCountOnTaskFailure: 5
101
displayName: Install dependencies
102
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
103
104
- powershell: node build/azure-pipelines/distro/mixin-npm.ts
105
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
106
displayName: Mixin distro node modules
107
108
- powershell: |
109
. build/azure-pipelines/win32/exec.ps1
110
$ErrorActionPreference = "Stop"
111
exec { node build/azure-pipelines/common/listNodeModules.ts .build/node_modules_list.txt }
112
exec { mkdir -Force .build/node_modules_cache }
113
exec { 7z.exe a .build/node_modules_cache/cache.7z -mx3 `@.build/node_modules_list.txt }
114
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
115
displayName: Create node_modules archive
116
117
- powershell: node build/azure-pipelines/distro/mixin-quality.ts
118
displayName: Mixin distro quality
119
120
- template: ../../common/install-builtin-extensions.yml@self
121
122
- ${{ if ne(parameters.VSCODE_CIBUILD, true) }}:
123
- powershell: |
124
npm run copy-policy-dto --prefix build
125
node build\lib\policies\policyGenerator.ts build\lib\policies\policyData.jsonc win32
126
displayName: Generate Group Policy definitions
127
retryCountOnTaskFailure: 3
128
129
- ${{ if and(ne(parameters.VSCODE_CIBUILD, true), ne(parameters.VSCODE_QUALITY, 'exploration')) }}:
130
- powershell: node build/win32/explorer-dll-fetcher.ts .build/win32/appx
131
displayName: Download Explorer dll
132
133
- powershell: |
134
. build/azure-pipelines/win32/exec.ps1
135
$ErrorActionPreference = "Stop"
136
exec { npm run gulp "vscode-win32-$(VSCODE_ARCH)-min-ci" }
137
exec { npm run gulp "vscode-win32-$(VSCODE_ARCH)-inno-updater" }
138
echo "##vso[task.setvariable variable=BUILT_CLIENT]true"
139
echo "##vso[task.setvariable variable=CodeSigningFolderPath]$(Agent.BuildDirectory)/VSCode-win32-$(VSCODE_ARCH)"
140
env:
141
GITHUB_TOKEN: "$(github-distro-mixin-password)"
142
displayName: Build client
143
144
# Note: the appx prepare step has to follow Build client step since build step replaces the template
145
# strings in the raw manifest file at resources/win32/appx/AppxManifest.xml and places it under
146
# <build-out-dir>/appx/manifest, we need a separate step to prepare the appx package with the
147
# final contents. In our case only the manifest file is bundled into the appx package.
148
- ${{ if and(ne(parameters.VSCODE_CIBUILD, true), ne(parameters.VSCODE_QUALITY, 'exploration')) }}:
149
- powershell: |
150
. build/azure-pipelines/win32/exec.ps1
151
$ErrorActionPreference = "Stop"
152
# Add Windows SDK to path
153
$sdk = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64"
154
$env:PATH = "$sdk;$env:PATH"
155
$AppxName = if ('$(VSCODE_QUALITY)' -eq 'stable') { 'code' } else { 'code_insider' }
156
makeappx pack /d "$(Agent.BuildDirectory)/VSCode-win32-$(VSCODE_ARCH)/appx/manifest" /p "$(Agent.BuildDirectory)/VSCode-win32-$(VSCODE_ARCH)/appx/${AppxName}_$(VSCODE_ARCH).appx" /nv
157
# Remove the raw manifest folder
158
Remove-Item -Path "$(Agent.BuildDirectory)/VSCode-win32-$(VSCODE_ARCH)/appx/manifest" -Recurse -Force
159
displayName: Prepare appx package
160
161
- powershell: |
162
. build/azure-pipelines/win32/exec.ps1
163
$ErrorActionPreference = "Stop"
164
exec { npm run gulp "vscode-reh-win32-$(VSCODE_ARCH)-min-ci" }
165
mv ..\vscode-reh-win32-$(VSCODE_ARCH) ..\vscode-server-win32-$(VSCODE_ARCH) # TODO@joaomoreno
166
echo "##vso[task.setvariable variable=BUILT_SERVER]true"
167
echo "##vso[task.setvariable variable=CodeSigningFolderPath]$(CodeSigningFolderPath),$(Agent.BuildDirectory)/vscode-server-win32-$(VSCODE_ARCH)"
168
env:
169
GITHUB_TOKEN: "$(github-distro-mixin-password)"
170
displayName: Build server
171
172
- powershell: |
173
. build/azure-pipelines/win32/exec.ps1
174
$ErrorActionPreference = "Stop"
175
exec { npm run gulp "vscode-reh-web-win32-$(VSCODE_ARCH)-min-ci" }
176
mv ..\vscode-reh-web-win32-$(VSCODE_ARCH) ..\vscode-server-win32-$(VSCODE_ARCH)-web # TODO@joaomoreno
177
echo "##vso[task.setvariable variable=BUILT_WEB]true"
178
echo "##vso[task.setvariable variable=CodeSigningFolderPath]$(CodeSigningFolderPath),$(Agent.BuildDirectory)/vscode-server-win32-$(VSCODE_ARCH)-web"
179
env:
180
GITHUB_TOKEN: "$(github-distro-mixin-password)"
181
displayName: Build server (web)
182
183
- ${{ if ne(parameters.VSCODE_CIBUILD, true) }}:
184
- task: DownloadPipelineArtifact@2
185
inputs:
186
artifact: unsigned_vscode_cli_win32_$(VSCODE_ARCH)_cli
187
patterns: "**"
188
path: $(Build.ArtifactStagingDirectory)/cli
189
displayName: Download VS Code CLI
190
191
- powershell: |
192
. build/azure-pipelines/win32/exec.ps1
193
$ErrorActionPreference = "Stop"
194
$ArtifactName = (gci -Path "$(Build.ArtifactStagingDirectory)/cli" | Select-Object -last 1).FullName
195
Expand-Archive -Path $ArtifactName -DestinationPath "$(Build.ArtifactStagingDirectory)/cli"
196
$ProductJsonPath = (Get-ChildItem -Path "$(Agent.BuildDirectory)\VSCode-win32-$(VSCODE_ARCH)" -Name "product.json" -Recurse | Select-Object -First 1)
197
$AppProductJson = Get-Content -Raw -Path "$(Agent.BuildDirectory)\VSCode-win32-$(VSCODE_ARCH)\$ProductJsonPath" | ConvertFrom-Json
198
$CliAppName = $AppProductJson.tunnelApplicationName
199
$AppName = $AppProductJson.applicationName
200
Move-Item -Path "$(Build.ArtifactStagingDirectory)/cli/$AppName.exe" -Destination "$(Agent.BuildDirectory)/VSCode-win32-$(VSCODE_ARCH)/bin/$CliAppName.exe"
201
displayName: Move VS Code CLI
202
203
- task: UseDotNet@2
204
inputs:
205
version: 6.x
206
207
- task: EsrpCodeSigning@5
208
inputs:
209
UseMSIAuthentication: true
210
ConnectedServiceName: vscode-esrp
211
AppRegistrationClientId: $(ESRP_CLIENT_ID)
212
AppRegistrationTenantId: $(ESRP_TENANT_ID)
213
AuthAKVName: vscode-esrp
214
AuthSignCertName: esrp-sign
215
FolderPath: .
216
Pattern: noop
217
displayName: 'Install ESRP Tooling'
218
219
- powershell: |
220
. build/azure-pipelines/win32/exec.ps1
221
$ErrorActionPreference = "Stop"
222
$EsrpCodeSigningTool = (gci -directory -filter EsrpCodeSigning_* $(Agent.RootDirectory)\_tasks | Select-Object -last 1).FullName
223
$Version = (gci -directory $EsrpCodeSigningTool | Select-Object -last 1).FullName
224
echo "##vso[task.setvariable variable=EsrpCliDllPath]$Version\net6.0\esrpcli.dll"
225
displayName: Find ESRP CLI
226
227
- powershell: |
228
. build/azure-pipelines/win32/exec.ps1
229
$ErrorActionPreference = "Stop"
230
exec { npx deemon --detach --wait -- npx zx build/azure-pipelines/win32/codesign.ts }
231
env:
232
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
233
displayName: ✍️ Codesign
234
235
- ${{ if or(eq(parameters.VSCODE_RUN_ELECTRON_TESTS, true), eq(parameters.VSCODE_RUN_BROWSER_TESTS, true), eq(parameters.VSCODE_RUN_REMOTE_TESTS, true)) }}:
236
- template: product-build-win32-test.yml@self
237
parameters:
238
VSCODE_ARCH: ${{ parameters.VSCODE_ARCH }}
239
VSCODE_RUN_ELECTRON_TESTS: ${{ parameters.VSCODE_RUN_ELECTRON_TESTS }}
240
VSCODE_RUN_BROWSER_TESTS: ${{ parameters.VSCODE_RUN_BROWSER_TESTS }}
241
VSCODE_RUN_REMOTE_TESTS: ${{ parameters.VSCODE_RUN_REMOTE_TESTS }}
242
243
- ${{ if ne(parameters.VSCODE_CIBUILD, true) }}:
244
- powershell: |
245
. build/azure-pipelines/win32/exec.ps1
246
$ErrorActionPreference = "Stop"
247
exec { npx deemon --attach -- npx zx build/azure-pipelines/win32/codesign.ts }
248
condition: succeededOrFailed()
249
displayName: "✍️ Post-job: Codesign"
250
251
- powershell: |
252
$ErrorActionPreference = "Stop"
253
254
$PackageJsonPath = (Get-ChildItem -Path "..\VSCode-win32-$(VSCODE_ARCH)" -Name "package.json" -Recurse | Select-Object -First 1)
255
$PackageJson = Get-Content -Raw -Path ..\VSCode-win32-$(VSCODE_ARCH)\$PackageJsonPath | ConvertFrom-Json
256
$Version = $PackageJson.version
257
258
mkdir $(Build.ArtifactStagingDirectory)\out\system-setup -Force
259
mv .build\win32-$(VSCODE_ARCH)\system-setup\VSCodeSetup.exe $(Build.ArtifactStagingDirectory)\out\system-setup\VSCodeSetup-$(VSCODE_ARCH)-$Version.exe
260
261
mkdir $(Build.ArtifactStagingDirectory)\out\user-setup -Force
262
mv .build\win32-$(VSCODE_ARCH)\user-setup\VSCodeSetup.exe $(Build.ArtifactStagingDirectory)\out\user-setup\VSCodeUserSetup-$(VSCODE_ARCH)-$Version.exe
263
264
mkdir $(Build.ArtifactStagingDirectory)\out\archive -Force
265
mv .build\win32-$(VSCODE_ARCH)\VSCode-win32-$(VSCODE_ARCH).zip $(Build.ArtifactStagingDirectory)\out\archive\VSCode-win32-$(VSCODE_ARCH)-$Version.zip
266
267
mkdir $(Build.ArtifactStagingDirectory)\out\server -Force
268
mv .build\win32-$(VSCODE_ARCH)\vscode-server-win32-$(VSCODE_ARCH).zip $(Build.ArtifactStagingDirectory)\out\server\vscode-server-win32-$(VSCODE_ARCH).zip
269
270
mkdir $(Build.ArtifactStagingDirectory)\out\web -Force
271
mv .build\win32-$(VSCODE_ARCH)\vscode-server-win32-$(VSCODE_ARCH)-web.zip $(Build.ArtifactStagingDirectory)\out\web\vscode-server-win32-$(VSCODE_ARCH)-web.zip
272
273
echo "##vso[task.setvariable variable=VSCODE_VERSION]$Version"
274
displayName: Move artifacts to out directory
275
276