Path: blob/main/build/azure-pipelines/win32/steps/product-build-win32-compile.yml
4774 views
parameters:1- name: VSCODE_ARCH2type: string3- name: VSCODE_CIBUILD4type: boolean5- name: VSCODE_QUALITY6type: string7- name: VSCODE_RUN_ELECTRON_TESTS8type: boolean9default: false10- name: VSCODE_RUN_BROWSER_TESTS11type: boolean12default: false13- name: VSCODE_RUN_REMOTE_TESTS14type: boolean15default: false1617steps:18- template: ../../common/checkout.yml@self1920- task: NodeTool@021inputs:22versionSource: fromFile23versionFilePath: .nvmrc2425- task: UsePythonVersion@026inputs:27versionSpec: "3.x"28addToPath: true2930- template: ../../distro/download-distro.yml@self3132- task: AzureKeyVault@233displayName: "Azure Key Vault: Get Secrets"34inputs:35azureSubscription: vscode36KeyVaultName: vscode-build-secrets37SecretsFilter: "github-distro-mixin-password"3839- task: DownloadPipelineArtifact@240inputs:41artifact: Compilation42path: $(Build.ArtifactStagingDirectory)43displayName: Download compilation output4445- task: ExtractFiles@146displayName: Extract compilation output47inputs:48archiveFilePatterns: "$(Build.ArtifactStagingDirectory)/compilation.tar.gz"49cleanDestinationFolder: false5051- powershell: node build/setup-npm-registry.ts $env:NPM_REGISTRY52condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))53displayName: Setup NPM Registry5455- pwsh: |56mkdir .build -ea 057node build/azure-pipelines/common/computeNodeModulesCacheKey.ts win32 $(VSCODE_ARCH) $(node -p process.arch) > .build/packagelockhash58displayName: Prepare node_modules cache key5960- task: Cache@261inputs:62key: '"node_modules" | .build/packagelockhash'63path: .build/node_modules_cache64cacheHitVar: NODE_MODULES_RESTORED65displayName: Restore node_modules cache6667- powershell: 7z.exe x .build/node_modules_cache/cache.7z -aoa68condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true'))69displayName: Extract node_modules cache7071- powershell: |72. build/azure-pipelines/win32/exec.ps173$ErrorActionPreference = "Stop"74# Set the private NPM registry to the global npmrc file75# so that authentication works for subfolders like build/, remote/, extensions/ etc76# which does not have their own .npmrc file77exec { npm config set registry "$env:NPM_REGISTRY" }78$NpmrcPath = (npm config get userconfig)79echo "##vso[task.setvariable variable=NPMRC_PATH]$NpmrcPath"80condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))81displayName: Setup NPM8283- task: npmAuthenticate@084inputs:85workingFile: $(NPMRC_PATH)86condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))87displayName: Setup NPM Authentication8889- powershell: |90. build/azure-pipelines/win32/exec.ps191$ErrorActionPreference = "Stop"92exec { npm ci }93env:94npm_config_arch: $(VSCODE_ARCH)95npm_config_foreground_scripts: "true"96ELECTRON_SKIP_BINARY_DOWNLOAD: 197PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 198GITHUB_TOKEN: "$(github-distro-mixin-password)"99retryCountOnTaskFailure: 5100displayName: Install dependencies101condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))102103- powershell: node build/azure-pipelines/distro/mixin-npm.ts104condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))105displayName: Mixin distro node modules106107- powershell: |108. build/azure-pipelines/win32/exec.ps1109$ErrorActionPreference = "Stop"110exec { node build/azure-pipelines/common/listNodeModules.ts .build/node_modules_list.txt }111exec { mkdir -Force .build/node_modules_cache }112exec { 7z.exe a .build/node_modules_cache/cache.7z -mx3 `@.build/node_modules_list.txt }113condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))114displayName: Create node_modules archive115116- powershell: node build/azure-pipelines/distro/mixin-quality.ts117displayName: Mixin distro quality118119- template: ../../common/install-builtin-extensions.yml@self120121- ${{ if ne(parameters.VSCODE_CIBUILD, true) }}:122- powershell: |123npm run copy-policy-dto --prefix build124node build\lib\policies\policyGenerator.ts build\lib\policies\policyData.jsonc win32125displayName: Generate Group Policy definitions126retryCountOnTaskFailure: 3127128- ${{ if and(ne(parameters.VSCODE_CIBUILD, true), ne(parameters.VSCODE_QUALITY, 'exploration')) }}:129- powershell: node build/win32/explorer-dll-fetcher.ts .build/win32/appx130displayName: Download Explorer dll131132- powershell: |133. build/azure-pipelines/win32/exec.ps1134$ErrorActionPreference = "Stop"135exec { npm run gulp "vscode-win32-$(VSCODE_ARCH)-min-ci" }136exec { npm run gulp "vscode-win32-$(VSCODE_ARCH)-inno-updater" }137echo "##vso[task.setvariable variable=BUILT_CLIENT]true"138echo "##vso[task.setvariable variable=CodeSigningFolderPath]$(Agent.BuildDirectory)/VSCode-win32-$(VSCODE_ARCH)"139env:140GITHUB_TOKEN: "$(github-distro-mixin-password)"141displayName: Build client142143# Note: the appx prepare step has to follow Build client step since build step replaces the template144# strings in the raw manifest file at resources/win32/appx/AppxManifest.xml and places it under145# <build-out-dir>/appx/manifest, we need a separate step to prepare the appx package with the146# final contents. In our case only the manifest file is bundled into the appx package.147- ${{ if and(ne(parameters.VSCODE_CIBUILD, true), ne(parameters.VSCODE_QUALITY, 'exploration')) }}:148- powershell: |149. build/azure-pipelines/win32/exec.ps1150$ErrorActionPreference = "Stop"151# Add Windows SDK to path152$sdk = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64"153$env:PATH = "$sdk;$env:PATH"154$AppxName = if ('$(VSCODE_QUALITY)' -eq 'stable') { 'code' } else { 'code_insider' }155makeappx pack /d "$(Agent.BuildDirectory)/VSCode-win32-$(VSCODE_ARCH)/appx/manifest" /p "$(Agent.BuildDirectory)/VSCode-win32-$(VSCODE_ARCH)/appx/${AppxName}_$(VSCODE_ARCH).appx" /nv156# Remove the raw manifest folder157Remove-Item -Path "$(Agent.BuildDirectory)/VSCode-win32-$(VSCODE_ARCH)/appx/manifest" -Recurse -Force158displayName: Prepare appx package159160- powershell: |161. build/azure-pipelines/win32/exec.ps1162$ErrorActionPreference = "Stop"163exec { npm run gulp "vscode-reh-win32-$(VSCODE_ARCH)-min-ci" }164mv ..\vscode-reh-win32-$(VSCODE_ARCH) ..\vscode-server-win32-$(VSCODE_ARCH) # TODO@joaomoreno165echo "##vso[task.setvariable variable=BUILT_SERVER]true"166echo "##vso[task.setvariable variable=CodeSigningFolderPath]$(CodeSigningFolderPath),$(Agent.BuildDirectory)/vscode-server-win32-$(VSCODE_ARCH)"167env:168GITHUB_TOKEN: "$(github-distro-mixin-password)"169displayName: Build server170171- powershell: |172. build/azure-pipelines/win32/exec.ps1173$ErrorActionPreference = "Stop"174exec { npm run gulp "vscode-reh-web-win32-$(VSCODE_ARCH)-min-ci" }175mv ..\vscode-reh-web-win32-$(VSCODE_ARCH) ..\vscode-server-win32-$(VSCODE_ARCH)-web # TODO@joaomoreno176echo "##vso[task.setvariable variable=BUILT_WEB]true"177echo "##vso[task.setvariable variable=CodeSigningFolderPath]$(CodeSigningFolderPath),$(Agent.BuildDirectory)/vscode-server-win32-$(VSCODE_ARCH)-web"178env:179GITHUB_TOKEN: "$(github-distro-mixin-password)"180displayName: Build server (web)181182- ${{ if ne(parameters.VSCODE_CIBUILD, true) }}:183- task: DownloadPipelineArtifact@2184inputs:185artifact: unsigned_vscode_cli_win32_$(VSCODE_ARCH)_cli186patterns: "**"187path: $(Build.ArtifactStagingDirectory)/cli188displayName: Download VS Code CLI189190- powershell: |191. build/azure-pipelines/win32/exec.ps1192$ErrorActionPreference = "Stop"193$ArtifactName = (gci -Path "$(Build.ArtifactStagingDirectory)/cli" | Select-Object -last 1).FullName194Expand-Archive -Path $ArtifactName -DestinationPath "$(Build.ArtifactStagingDirectory)/cli"195$ProductJsonPath = (Get-ChildItem -Path "$(Agent.BuildDirectory)\VSCode-win32-$(VSCODE_ARCH)" -Name "product.json" -Recurse | Select-Object -First 1)196$AppProductJson = Get-Content -Raw -Path "$(Agent.BuildDirectory)\VSCode-win32-$(VSCODE_ARCH)\$ProductJsonPath" | ConvertFrom-Json197$CliAppName = $AppProductJson.tunnelApplicationName198$AppName = $AppProductJson.applicationName199Move-Item -Path "$(Build.ArtifactStagingDirectory)/cli/$AppName.exe" -Destination "$(Agent.BuildDirectory)/VSCode-win32-$(VSCODE_ARCH)/bin/$CliAppName.exe"200displayName: Move VS Code CLI201202- task: UseDotNet@2203inputs:204version: 6.x205206- task: EsrpCodeSigning@5207inputs:208UseMSIAuthentication: true209ConnectedServiceName: vscode-esrp210AppRegistrationClientId: $(ESRP_CLIENT_ID)211AppRegistrationTenantId: $(ESRP_TENANT_ID)212AuthAKVName: vscode-esrp213AuthSignCertName: esrp-sign214FolderPath: .215Pattern: noop216displayName: 'Install ESRP Tooling'217218- powershell: |219. build/azure-pipelines/win32/exec.ps1220$ErrorActionPreference = "Stop"221$EsrpCodeSigningTool = (gci -directory -filter EsrpCodeSigning_* $(Agent.RootDirectory)\_tasks | Select-Object -last 1).FullName222$Version = (gci -directory $EsrpCodeSigningTool | Select-Object -last 1).FullName223echo "##vso[task.setvariable variable=EsrpCliDllPath]$Version\net6.0\esrpcli.dll"224displayName: Find ESRP CLI225226- powershell: |227. build/azure-pipelines/win32/exec.ps1228$ErrorActionPreference = "Stop"229exec { npx deemon --detach --wait -- npx zx build/azure-pipelines/win32/codesign.ts }230env:231SYSTEM_ACCESSTOKEN: $(System.AccessToken)232displayName: ✍️ Codesign233234- ${{ if or(eq(parameters.VSCODE_RUN_ELECTRON_TESTS, true), eq(parameters.VSCODE_RUN_BROWSER_TESTS, true), eq(parameters.VSCODE_RUN_REMOTE_TESTS, true)) }}:235- template: product-build-win32-test.yml@self236parameters:237VSCODE_ARCH: ${{ parameters.VSCODE_ARCH }}238VSCODE_RUN_ELECTRON_TESTS: ${{ parameters.VSCODE_RUN_ELECTRON_TESTS }}239VSCODE_RUN_BROWSER_TESTS: ${{ parameters.VSCODE_RUN_BROWSER_TESTS }}240VSCODE_RUN_REMOTE_TESTS: ${{ parameters.VSCODE_RUN_REMOTE_TESTS }}241242- ${{ if ne(parameters.VSCODE_CIBUILD, true) }}:243- powershell: |244. build/azure-pipelines/win32/exec.ps1245$ErrorActionPreference = "Stop"246exec { npx deemon --attach -- npx zx build/azure-pipelines/win32/codesign.ts }247condition: succeededOrFailed()248displayName: "✍️ Post-job: Codesign"249250- powershell: |251$ErrorActionPreference = "Stop"252253$PackageJsonPath = (Get-ChildItem -Path "..\VSCode-win32-$(VSCODE_ARCH)" -Name "package.json" -Recurse | Select-Object -First 1)254$PackageJson = Get-Content -Raw -Path ..\VSCode-win32-$(VSCODE_ARCH)\$PackageJsonPath | ConvertFrom-Json255$Version = $PackageJson.version256257mkdir $(Build.ArtifactStagingDirectory)\out\system-setup -Force258mv .build\win32-$(VSCODE_ARCH)\system-setup\VSCodeSetup.exe $(Build.ArtifactStagingDirectory)\out\system-setup\VSCodeSetup-$(VSCODE_ARCH)-$Version.exe259260mkdir $(Build.ArtifactStagingDirectory)\out\user-setup -Force261mv .build\win32-$(VSCODE_ARCH)\user-setup\VSCodeSetup.exe $(Build.ArtifactStagingDirectory)\out\user-setup\VSCodeUserSetup-$(VSCODE_ARCH)-$Version.exe262263mkdir $(Build.ArtifactStagingDirectory)\out\archive -Force264mv .build\win32-$(VSCODE_ARCH)\VSCode-win32-$(VSCODE_ARCH).zip $(Build.ArtifactStagingDirectory)\out\archive\VSCode-win32-$(VSCODE_ARCH)-$Version.zip265266mkdir $(Build.ArtifactStagingDirectory)\out\server -Force267mv .build\win32-$(VSCODE_ARCH)\vscode-server-win32-$(VSCODE_ARCH).zip $(Build.ArtifactStagingDirectory)\out\server\vscode-server-win32-$(VSCODE_ARCH).zip268269mkdir $(Build.ArtifactStagingDirectory)\out\web -Force270mv .build\win32-$(VSCODE_ARCH)\vscode-server-win32-$(VSCODE_ARCH)-web.zip $(Build.ArtifactStagingDirectory)\out\web\vscode-server-win32-$(VSCODE_ARCH)-web.zip271272echo "##vso[task.setvariable variable=VSCODE_VERSION]$Version"273displayName: Move artifacts to out directory274275276