Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/azure-pipelines/darwin/codesign.ts
5297 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { printBanner, spawnCodesignProcess, streamProcessOutputAndCheckResult } from '../common/codesign.ts';
7
import { e } from '../common/publish.ts';
8
9
async function main() {
10
const arch = e('VSCODE_ARCH');
11
const esrpCliDLLPath = e('EsrpCliDllPath');
12
const pipelineWorkspace = e('PIPELINE_WORKSPACE');
13
const buildSourcesDirectory = e('BUILD_SOURCESDIRECTORY');
14
15
const clientFolder = `${pipelineWorkspace}/vscode_client_darwin_${arch}_archive`;
16
const dmgFolder = `${pipelineWorkspace}/vscode_client_darwin_${arch}_dmg`;
17
const clientGlob = `VSCode-darwin-${arch}.zip`;
18
const dmgGlob = `VSCode-darwin-${arch}.dmg`;
19
20
const serverFolder = `${buildSourcesDirectory}/.build/darwin/server`;
21
const serverGlob = `vscode-server-darwin-${arch}.zip`;
22
const webGlob = `vscode-server-darwin-${arch}-web.zip`;
23
let codeSignServerTask, codeSignWebTask, notarizeServerTask, notarizeWebTask;
24
25
// Start codesign processes in parallel
26
const codeSignClientTask = spawnCodesignProcess(esrpCliDLLPath, 'sign-darwin', clientFolder, clientGlob);
27
const codeSignDmgTask = spawnCodesignProcess(esrpCliDLLPath, 'sign-darwin', dmgFolder, dmgGlob);
28
if (arch !== 'universal') {
29
codeSignServerTask = spawnCodesignProcess(esrpCliDLLPath, 'sign-darwin', serverFolder, serverGlob);
30
codeSignWebTask = spawnCodesignProcess(esrpCliDLLPath, 'sign-darwin', serverFolder, webGlob);
31
}
32
33
// Await codesign results
34
printBanner('Codesign client');
35
await streamProcessOutputAndCheckResult('Codesign client', codeSignClientTask);
36
37
printBanner('Codesign DMG');
38
await streamProcessOutputAndCheckResult('Codesign DMG', codeSignDmgTask);
39
40
if (codeSignServerTask) {
41
printBanner('Codesign server');
42
await streamProcessOutputAndCheckResult('Codesign server', codeSignServerTask);
43
}
44
45
if (codeSignWebTask) {
46
printBanner('Codesign web');
47
await streamProcessOutputAndCheckResult('Codesign web', codeSignWebTask);
48
}
49
50
// Start notarize processes in parallel (after codesigning is complete)
51
const notarizeClientTask = spawnCodesignProcess(esrpCliDLLPath, 'notarize-darwin', clientFolder, clientGlob);
52
const notarizeDmgTask = spawnCodesignProcess(esrpCliDLLPath, 'notarize-darwin', dmgFolder, dmgGlob);
53
if (arch !== 'universal') {
54
notarizeServerTask = spawnCodesignProcess(esrpCliDLLPath, 'notarize-darwin', serverFolder, serverGlob);
55
notarizeWebTask = spawnCodesignProcess(esrpCliDLLPath, 'notarize-darwin', serverFolder, webGlob);
56
}
57
58
// Await notarize results
59
printBanner('Notarize client');
60
await streamProcessOutputAndCheckResult('Notarize client', notarizeClientTask);
61
62
printBanner('Notarize DMG');
63
await streamProcessOutputAndCheckResult('Notarize DMG', notarizeDmgTask);
64
65
if (notarizeServerTask) {
66
printBanner('Notarize server');
67
await streamProcessOutputAndCheckResult('Notarize server', notarizeServerTask);
68
}
69
70
if (notarizeWebTask) {
71
printBanner('Notarize web');
72
await streamProcessOutputAndCheckResult('Notarize web', notarizeWebTask);
73
}
74
}
75
76
main().then(() => {
77
process.exit(0);
78
}, err => {
79
console.error(`ERROR: ${err}`);
80
process.exit(1);
81
});
82
83