2022-06-22 03:00:43 +08:00
|
|
|
"use strict";
|
2020-12-14 18:13:08 +08:00
|
|
|
/*---------------------------------------------------------------------------------------------
|
|
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const codesign = require("electron-osx-sign");
|
|
|
|
const path = require("path");
|
|
|
|
const util = require("../lib/util");
|
|
|
|
const product = require("../../product.json");
|
2022-03-18 22:48:48 +08:00
|
|
|
const cross_spawn_promise_1 = require("@malept/cross-spawn-promise");
|
2020-12-14 18:13:08 +08:00
|
|
|
async function main() {
|
|
|
|
const buildDir = process.env['AGENT_BUILDDIRECTORY'];
|
|
|
|
const tempDir = process.env['AGENT_TEMPDIRECTORY'];
|
|
|
|
const arch = process.env['VSCODE_ARCH'];
|
|
|
|
if (!buildDir) {
|
|
|
|
throw new Error('$AGENT_BUILDDIRECTORY not set');
|
|
|
|
}
|
|
|
|
if (!tempDir) {
|
|
|
|
throw new Error('$AGENT_TEMPDIRECTORY not set');
|
|
|
|
}
|
|
|
|
const baseDir = path.dirname(__dirname);
|
|
|
|
const appRoot = path.join(buildDir, `VSCode-darwin-${arch}`);
|
|
|
|
const appName = product.nameLong + '.app';
|
|
|
|
const appFrameworkPath = path.join(appRoot, appName, 'Contents', 'Frameworks');
|
|
|
|
const helperAppBaseName = product.nameShort;
|
|
|
|
const gpuHelperAppName = helperAppBaseName + ' Helper (GPU).app';
|
|
|
|
const rendererHelperAppName = helperAppBaseName + ' Helper (Renderer).app';
|
2022-09-21 23:18:39 +08:00
|
|
|
const pluginHelperAppName = helperAppBaseName + ' Helper (Plugin).app';
|
2021-03-31 13:56:04 +08:00
|
|
|
const infoPlistPath = path.resolve(appRoot, appName, 'Contents', 'Info.plist');
|
2020-12-14 18:13:08 +08:00
|
|
|
const defaultOpts = {
|
|
|
|
app: path.join(appRoot, appName),
|
|
|
|
platform: 'darwin',
|
|
|
|
entitlements: path.join(baseDir, 'azure-pipelines', 'darwin', 'app-entitlements.plist'),
|
|
|
|
'entitlements-inherit': path.join(baseDir, 'azure-pipelines', 'darwin', 'app-entitlements.plist'),
|
|
|
|
hardenedRuntime: true,
|
|
|
|
'pre-auto-entitlements': false,
|
|
|
|
'pre-embed-provisioning-profile': false,
|
|
|
|
keychain: path.join(tempDir, 'buildagent.keychain'),
|
|
|
|
version: util.getElectronVersion(),
|
2023-01-11 21:13:50 +08:00
|
|
|
identity: 'U8XXGZG5HC',
|
2020-12-14 18:13:08 +08:00
|
|
|
'gatekeeper-assess': false
|
|
|
|
};
|
2022-03-01 06:00:17 +08:00
|
|
|
const appOpts = {
|
|
|
|
...defaultOpts,
|
2020-12-14 18:13:08 +08:00
|
|
|
// TODO(deepak1556): Incorrectly declared type in electron-osx-sign
|
|
|
|
ignore: (filePath) => {
|
|
|
|
return filePath.includes(gpuHelperAppName) ||
|
2022-09-21 23:18:39 +08:00
|
|
|
filePath.includes(rendererHelperAppName) ||
|
|
|
|
filePath.includes(pluginHelperAppName);
|
2022-03-01 06:00:17 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
const gpuHelperOpts = {
|
|
|
|
...defaultOpts,
|
|
|
|
app: path.join(appFrameworkPath, gpuHelperAppName),
|
|
|
|
entitlements: path.join(baseDir, 'azure-pipelines', 'darwin', 'helper-gpu-entitlements.plist'),
|
|
|
|
'entitlements-inherit': path.join(baseDir, 'azure-pipelines', 'darwin', 'helper-gpu-entitlements.plist'),
|
|
|
|
};
|
|
|
|
const rendererHelperOpts = {
|
|
|
|
...defaultOpts,
|
|
|
|
app: path.join(appFrameworkPath, rendererHelperAppName),
|
|
|
|
entitlements: path.join(baseDir, 'azure-pipelines', 'darwin', 'helper-renderer-entitlements.plist'),
|
|
|
|
'entitlements-inherit': path.join(baseDir, 'azure-pipelines', 'darwin', 'helper-renderer-entitlements.plist'),
|
|
|
|
};
|
2022-09-21 23:18:39 +08:00
|
|
|
const pluginHelperOpts = {
|
|
|
|
...defaultOpts,
|
|
|
|
app: path.join(appFrameworkPath, pluginHelperAppName),
|
|
|
|
entitlements: path.join(baseDir, 'azure-pipelines', 'darwin', 'helper-plugin-entitlements.plist'),
|
|
|
|
'entitlements-inherit': path.join(baseDir, 'azure-pipelines', 'darwin', 'helper-plugin-entitlements.plist'),
|
|
|
|
};
|
2022-03-21 15:05:13 +08:00
|
|
|
// Only overwrite plist entries for x64 and arm64 builds,
|
|
|
|
// universal will get its copy from the x64 build.
|
|
|
|
if (arch !== 'universal') {
|
|
|
|
await (0, cross_spawn_promise_1.spawn)('plutil', [
|
|
|
|
'-insert',
|
|
|
|
'NSAppleEventsUsageDescription',
|
|
|
|
'-string',
|
|
|
|
'An application in Visual Studio Code wants to use AppleScript.',
|
|
|
|
`${infoPlistPath}`
|
|
|
|
]);
|
|
|
|
await (0, cross_spawn_promise_1.spawn)('plutil', [
|
|
|
|
'-replace',
|
|
|
|
'NSMicrophoneUsageDescription',
|
|
|
|
'-string',
|
|
|
|
'An application in Visual Studio Code wants to use the Microphone.',
|
|
|
|
`${infoPlistPath}`
|
|
|
|
]);
|
|
|
|
await (0, cross_spawn_promise_1.spawn)('plutil', [
|
|
|
|
'-replace',
|
|
|
|
'NSCameraUsageDescription',
|
|
|
|
'-string',
|
|
|
|
'An application in Visual Studio Code wants to use the Camera.',
|
|
|
|
`${infoPlistPath}`
|
|
|
|
]);
|
|
|
|
}
|
2020-12-14 18:13:08 +08:00
|
|
|
await codesign.signAsync(gpuHelperOpts);
|
|
|
|
await codesign.signAsync(rendererHelperOpts);
|
2022-09-21 23:18:39 +08:00
|
|
|
await codesign.signAsync(pluginHelperOpts);
|
2020-12-14 18:13:08 +08:00
|
|
|
await codesign.signAsync(appOpts);
|
|
|
|
}
|
|
|
|
if (require.main === module) {
|
|
|
|
main().catch(err => {
|
|
|
|
console.error(err);
|
|
|
|
process.exit(1);
|
|
|
|
});
|
|
|
|
}
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