Path: blob/main/build/azure-pipelines/win32/codesign.js
3520 views
"use strict";1Object.defineProperty(exports, "__esModule", { value: true });2/*---------------------------------------------------------------------------------------------3* Copyright (c) Microsoft Corporation. All rights reserved.4* Licensed under the MIT License. See License.txt in the project root for license information.5*--------------------------------------------------------------------------------------------*/6const zx_1 = require("zx");7const codesign_1 = require("../common/codesign");8const publish_1 = require("../common/publish");9async function main() {10(0, zx_1.usePwsh)();11const arch = (0, publish_1.e)('VSCODE_ARCH');12const esrpCliDLLPath = (0, publish_1.e)('EsrpCliDllPath');13const codeSigningFolderPath = (0, publish_1.e)('CodeSigningFolderPath');14// Start the code sign processes in parallel15// 1. Codesign executables and shared libraries16// 2. Codesign Powershell scripts17// 3. Codesign context menu appx package (insiders only)18const codesignTask1 = (0, codesign_1.spawnCodesignProcess)(esrpCliDLLPath, 'sign-windows', codeSigningFolderPath, '*.dll,*.exe,*.node');19const codesignTask2 = (0, codesign_1.spawnCodesignProcess)(esrpCliDLLPath, 'sign-windows-appx', codeSigningFolderPath, '*.ps1');20const codesignTask3 = process.env['VSCODE_QUALITY'] === 'insider'21? (0, codesign_1.spawnCodesignProcess)(esrpCliDLLPath, 'sign-windows-appx', codeSigningFolderPath, '*.appx')22: undefined;23// Codesign executables and shared libraries24(0, codesign_1.printBanner)('Codesign executables and shared libraries');25await (0, codesign_1.streamProcessOutputAndCheckResult)('Codesign executables and shared libraries', codesignTask1);26// Codesign Powershell scripts27(0, codesign_1.printBanner)('Codesign Powershell scripts');28await (0, codesign_1.streamProcessOutputAndCheckResult)('Codesign Powershell scripts', codesignTask2);29if (codesignTask3) {30// Codesign context menu appx package31(0, codesign_1.printBanner)('Codesign context menu appx package');32await (0, codesign_1.streamProcessOutputAndCheckResult)('Codesign context menu appx package', codesignTask3);33}34// Create build artifact directory35await (0, zx_1.$) `New-Item -ItemType Directory -Path .build/win32-${arch} -Force`;36// Package client37if (process.env['BUILT_CLIENT']) {38// Product version39const version = await (0, zx_1.$) `node -p "require('../VSCode-win32-${arch}/resources/app/package.json').version"`;40(0, codesign_1.printBanner)('Package client');41const clientArchivePath = `.build/win32-${arch}/VSCode-win32-${arch}-${version}.zip`;42await (0, zx_1.$) `7z.exe a -tzip ${clientArchivePath} ../VSCode-win32-${arch}/* "-xr!CodeSignSummary*.md"`.pipe(process.stdout);43await (0, zx_1.$) `7z.exe l ${clientArchivePath}`.pipe(process.stdout);44}45// Package server46if (process.env['BUILT_SERVER']) {47(0, codesign_1.printBanner)('Package server');48const serverArchivePath = `.build/win32-${arch}/vscode-server-win32-${arch}.zip`;49await (0, zx_1.$) `7z.exe a -tzip ${serverArchivePath} ../vscode-server-win32-${arch}`.pipe(process.stdout);50await (0, zx_1.$) `7z.exe l ${serverArchivePath}`.pipe(process.stdout);51}52// Package server (web)53if (process.env['BUILT_WEB']) {54(0, codesign_1.printBanner)('Package server (web)');55const webArchivePath = `.build/win32-${arch}/vscode-server-win32-${arch}-web.zip`;56await (0, zx_1.$) `7z.exe a -tzip ${webArchivePath} ../vscode-server-win32-${arch}-web`.pipe(process.stdout);57await (0, zx_1.$) `7z.exe l ${webArchivePath}`.pipe(process.stdout);58}59// Sign setup60if (process.env['BUILT_CLIENT']) {61(0, codesign_1.printBanner)('Sign setup packages (system, user)');62const task = (0, zx_1.$) `npm exec -- npm-run-all -lp "gulp vscode-win32-${arch}-system-setup -- --sign" "gulp vscode-win32-${arch}-user-setup -- --sign"`;63await (0, codesign_1.streamProcessOutputAndCheckResult)('Sign setup packages (system, user)', task);64}65}66main().then(() => {67process.exit(0);68}, err => {69console.error(`ERROR: ${err}`);70process.exit(1);71});72//# sourceMappingURL=codesign.js.map7374