Path: blob/main/build/azure-pipelines/darwin/codesign.ts
5297 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { printBanner, spawnCodesignProcess, streamProcessOutputAndCheckResult } from '../common/codesign.ts';6import { e } from '../common/publish.ts';78async function main() {9const arch = e('VSCODE_ARCH');10const esrpCliDLLPath = e('EsrpCliDllPath');11const pipelineWorkspace = e('PIPELINE_WORKSPACE');12const buildSourcesDirectory = e('BUILD_SOURCESDIRECTORY');1314const clientFolder = `${pipelineWorkspace}/vscode_client_darwin_${arch}_archive`;15const dmgFolder = `${pipelineWorkspace}/vscode_client_darwin_${arch}_dmg`;16const clientGlob = `VSCode-darwin-${arch}.zip`;17const dmgGlob = `VSCode-darwin-${arch}.dmg`;1819const serverFolder = `${buildSourcesDirectory}/.build/darwin/server`;20const serverGlob = `vscode-server-darwin-${arch}.zip`;21const webGlob = `vscode-server-darwin-${arch}-web.zip`;22let codeSignServerTask, codeSignWebTask, notarizeServerTask, notarizeWebTask;2324// Start codesign processes in parallel25const codeSignClientTask = spawnCodesignProcess(esrpCliDLLPath, 'sign-darwin', clientFolder, clientGlob);26const codeSignDmgTask = spawnCodesignProcess(esrpCliDLLPath, 'sign-darwin', dmgFolder, dmgGlob);27if (arch !== 'universal') {28codeSignServerTask = spawnCodesignProcess(esrpCliDLLPath, 'sign-darwin', serverFolder, serverGlob);29codeSignWebTask = spawnCodesignProcess(esrpCliDLLPath, 'sign-darwin', serverFolder, webGlob);30}3132// Await codesign results33printBanner('Codesign client');34await streamProcessOutputAndCheckResult('Codesign client', codeSignClientTask);3536printBanner('Codesign DMG');37await streamProcessOutputAndCheckResult('Codesign DMG', codeSignDmgTask);3839if (codeSignServerTask) {40printBanner('Codesign server');41await streamProcessOutputAndCheckResult('Codesign server', codeSignServerTask);42}4344if (codeSignWebTask) {45printBanner('Codesign web');46await streamProcessOutputAndCheckResult('Codesign web', codeSignWebTask);47}4849// Start notarize processes in parallel (after codesigning is complete)50const notarizeClientTask = spawnCodesignProcess(esrpCliDLLPath, 'notarize-darwin', clientFolder, clientGlob);51const notarizeDmgTask = spawnCodesignProcess(esrpCliDLLPath, 'notarize-darwin', dmgFolder, dmgGlob);52if (arch !== 'universal') {53notarizeServerTask = spawnCodesignProcess(esrpCliDLLPath, 'notarize-darwin', serverFolder, serverGlob);54notarizeWebTask = spawnCodesignProcess(esrpCliDLLPath, 'notarize-darwin', serverFolder, webGlob);55}5657// Await notarize results58printBanner('Notarize client');59await streamProcessOutputAndCheckResult('Notarize client', notarizeClientTask);6061printBanner('Notarize DMG');62await streamProcessOutputAndCheckResult('Notarize DMG', notarizeDmgTask);6364if (notarizeServerTask) {65printBanner('Notarize server');66await streamProcessOutputAndCheckResult('Notarize server', notarizeServerTask);67}6869if (notarizeWebTask) {70printBanner('Notarize web');71await streamProcessOutputAndCheckResult('Notarize web', notarizeWebTask);72}73}7475main().then(() => {76process.exit(0);77}, err => {78console.error(`ERROR: ${err}`);79process.exit(1);80});818283