mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 20:13:32 +01:00
Engineering - refactor codesign scripts (#246459)
* Engineering - consolidate codesign scripts * Try using a script task * Switch back to old syntax * Bump deemon
This commit is contained in:
@@ -3,49 +3,25 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { $, ProcessPromise } from 'zx';
|
||||
import { printBanner, spawnCodesignProcess, streamProcessOutputAndCheckResult } from '../common/codesign';
|
||||
import { e } from '../common/publish';
|
||||
|
||||
function printBanner(title: string) {
|
||||
title = `${title} (${new Date().toISOString()})`;
|
||||
|
||||
console.log('\n');
|
||||
console.log('#'.repeat(75));
|
||||
console.log(`# ${title.padEnd(71)} #`);
|
||||
console.log('#'.repeat(75));
|
||||
console.log('\n');
|
||||
}
|
||||
|
||||
async function streamTaskOutputAndCheckResult(name: string, promise: ProcessPromise): Promise<void> {
|
||||
const result = await promise.pipe(process.stdout);
|
||||
if (result.ok) {
|
||||
console.log(`\n${name} completed successfully. Duration: ${result.duration} ms`);
|
||||
return;
|
||||
}
|
||||
|
||||
throw new Error(`${name} failed: ${result.stderr}`);
|
||||
}
|
||||
|
||||
function sign(esrpCliDLLPath: string, type: 'sign-pgp', folder: string, glob: string): ProcessPromise {
|
||||
return $`node build/azure-pipelines/common/sign ${esrpCliDLLPath} ${type} ${folder} ${glob}`;
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const esrpCliDLLPath = e('EsrpCliDllPath');
|
||||
|
||||
// Start the code sign processes in parallel
|
||||
// 1. Codesign deb package
|
||||
// 2. Codesign rpm package
|
||||
const codesignTask1 = sign(esrpCliDLLPath, 'sign-pgp', '.build/linux/deb', '*.deb');
|
||||
const codesignTask2 = sign(esrpCliDLLPath, 'sign-pgp', '.build/linux/rpm', '*.rpm');
|
||||
const codesignTask1 = spawnCodesignProcess(esrpCliDLLPath, 'sign-pgp', '.build/linux/deb', '*.deb');
|
||||
const codesignTask2 = spawnCodesignProcess(esrpCliDLLPath, 'sign-pgp', '.build/linux/rpm', '*.rpm');
|
||||
|
||||
// Codesign deb package
|
||||
printBanner('Codesign deb package');
|
||||
await streamTaskOutputAndCheckResult('Codesign deb package', codesignTask1);
|
||||
await streamProcessOutputAndCheckResult('Codesign deb package', codesignTask1);
|
||||
|
||||
// Codesign rpm package
|
||||
printBanner('Codesign rpm package');
|
||||
await streamTaskOutputAndCheckResult('Codesign rpm package', codesignTask2);
|
||||
await streamProcessOutputAndCheckResult('Codesign rpm package', codesignTask2);
|
||||
}
|
||||
|
||||
main().then(() => {
|
||||
|
||||
Reference in New Issue
Block a user