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