Skip to content

Commit f291767

Browse files
committed
Revert "fix: use electron-osx-sign instead of manual code signing (microsoft#97582)"
This reverts commit a1ddfae.
1 parent 77a5f8f commit f291767

13 files changed

Lines changed: 41 additions & 247 deletions

build/azure-pipelines/darwin/app-entitlements.plist renamed to build/azure-pipelines/darwin/entitlements.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<true/>
77
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
88
<true/>
9+
<key>com.apple.security.cs.disable-library-validation</key>
10+
<true/>
911
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
1012
<true/>
1113
</dict>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.cs.disable-library-validation</key>
6+
<true/>
7+
</dict>
8+
</plist>

build/azure-pipelines/darwin/helper-gpu-entitlements.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@
44
<dict>
55
<key>com.apple.security.cs.allow-jit</key>
66
<true/>
7+
<key>com.apple.security.cs.disable-library-validation</key>
8+
<true/>
79
</dict>
810
</plist>

build/azure-pipelines/darwin/product-build-darwin.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,21 @@ steps:
162162

163163
- script: |
164164
set -e
165+
APP_ROOT=$(agent.builddirectory)/VSCode-darwin
166+
APP_NAME="`ls $APP_ROOT | head -n 1`"
167+
HELPER_APP_NAME="`echo $APP_NAME | sed -e 's/^Visual Studio //;s/\.app$//'`"
168+
APP_FRAMEWORK_PATH="$APP_ROOT/$APP_NAME/Contents/Frameworks"
165169
security create-keychain -p pwd $(agent.tempdirectory)/buildagent.keychain
166170
security default-keychain -s $(agent.tempdirectory)/buildagent.keychain
167171
security unlock-keychain -p pwd $(agent.tempdirectory)/buildagent.keychain
168172
echo "$(macos-developer-certificate)" | base64 -D > $(agent.tempdirectory)/cert.p12
169173
security import $(agent.tempdirectory)/cert.p12 -k $(agent.tempdirectory)/buildagent.keychain -P "$(macos-developer-certificate-key)" -T /usr/bin/codesign
170174
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k pwd $(agent.tempdirectory)/buildagent.keychain
171-
DEBUG=electron-osx-sign* node build/darwin/sign.js
175+
codesign -s 99FM488X57 --deep --force --options runtime --entitlements build/azure-pipelines/darwin/entitlements.plist "$APP_ROOT"/*.app
176+
codesign -s 99FM488X57 --force --options runtime --entitlements build/azure-pipelines/darwin/helper-entitlements.plist "$APP_FRAMEWORK_PATH/$HELPER_APP_NAME Helper.app"
177+
codesign -s 99FM488X57 --force --options runtime --entitlements build/azure-pipelines/darwin/helper-gpu-entitlements.plist "$APP_FRAMEWORK_PATH/$HELPER_APP_NAME Helper (GPU).app"
178+
codesign -s 99FM488X57 --force --options runtime --entitlements build/azure-pipelines/darwin/helper-plugin-entitlements.plist "$APP_FRAMEWORK_PATH/$HELPER_APP_NAME Helper (Plugin).app"
179+
codesign -s 99FM488X57 --force --options runtime --entitlements build/azure-pipelines/darwin/helper-renderer-entitlements.plist "$APP_FRAMEWORK_PATH/$HELPER_APP_NAME Helper (Renderer).app"
172180
displayName: Set Hardened Entitlements
173181

174182
- script: |

build/darwin/sign.js

Lines changed: 0 additions & 61 deletions
This file was deleted.

build/darwin/sign.ts

Lines changed: 0 additions & 90 deletions
This file was deleted.

build/gulpfile.hygiene.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const indentationFilter = [
8585
'!src/typings/**/*.d.ts',
8686
'!extensions/**/*.d.ts',
8787
'!**/*.{svg,exe,png,bmp,scpt,bat,cmd,cur,ttf,woff,eot,md,ps1,template,yaml,yml,d.ts.recipe,ico,icns,plist}',
88-
'!build/{lib,download,darwin}/**/*.js',
88+
'!build/{lib,download}/**/*.js',
8989
'!build/**/*.sh',
9090
'!build/azure-pipelines/**/*.js',
9191
'!build/azure-pipelines/**/*.config',

build/lib/electron.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55
'use strict';
66
Object.defineProperty(exports, "__esModule", { value: true });
7-
exports.config = void 0;
7+
exports.config = exports.getElectronVersion = void 0;
88
const fs = require("fs");
99
const path = require("path");
1010
const vfs = require("vinyl-fs");
@@ -16,6 +16,12 @@ const electron = require('gulp-atom-electron');
1616
const root = path.dirname(path.dirname(__dirname));
1717
const product = JSON.parse(fs.readFileSync(path.join(root, 'product.json'), 'utf8'));
1818
const commit = util.getVersion(root);
19+
function getElectronVersion() {
20+
const yarnrc = fs.readFileSync(path.join(root, '.yarnrc'), 'utf8');
21+
const target = /^target "(.*)"$/m.exec(yarnrc)[1];
22+
return target;
23+
}
24+
exports.getElectronVersion = getElectronVersion;
1925
const darwinCreditsTemplate = product.darwinCredits && _.template(fs.readFileSync(path.join(root, product.darwinCredits), 'utf8'));
2026
function darwinBundleDocumentType(extensions, icon) {
2127
return {
@@ -27,7 +33,7 @@ function darwinBundleDocumentType(extensions, icon) {
2733
};
2834
}
2935
exports.config = {
30-
version: util.getElectronVersion(),
36+
version: getElectronVersion(),
3137
productAppName: product.nameLong,
3238
companyName: 'Microsoft Corporation',
3339
copyright: 'Copyright (C) 2019 Microsoft. All rights reserved',
@@ -94,7 +100,7 @@ function getElectron(arch) {
94100
};
95101
}
96102
async function main(arch = process.arch) {
97-
const version = util.getElectronVersion();
103+
const version = getElectronVersion();
98104
const electronPath = path.join(root, '.build', 'electron');
99105
const versionFile = path.join(electronPath, 'version');
100106
const isUpToDate = fs.existsSync(versionFile) && fs.readFileSync(versionFile, 'utf8') === `${version}`;

build/lib/electron.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ const root = path.dirname(path.dirname(__dirname));
1919
const product = JSON.parse(fs.readFileSync(path.join(root, 'product.json'), 'utf8'));
2020
const commit = util.getVersion(root);
2121

22+
export function getElectronVersion(): string {
23+
const yarnrc = fs.readFileSync(path.join(root, '.yarnrc'), 'utf8');
24+
const target = /^target "(.*)"$/m.exec(yarnrc)![1];
25+
return target;
26+
}
27+
2228
const darwinCreditsTemplate = product.darwinCredits && _.template(fs.readFileSync(path.join(root, product.darwinCredits), 'utf8'));
2329

2430
function darwinBundleDocumentType(extensions: string[], icon: string) {
@@ -32,7 +38,7 @@ function darwinBundleDocumentType(extensions: string[], icon: string) {
3238
}
3339

3440
export const config = {
35-
version: util.getElectronVersion(),
41+
version: getElectronVersion(),
3642
productAppName: product.nameLong,
3743
companyName: 'Microsoft Corporation',
3844
copyright: 'Copyright (C) 2019 Microsoft. All rights reserved',
@@ -102,7 +108,7 @@ function getElectron(arch: string): () => NodeJS.ReadWriteStream {
102108
}
103109

104110
async function main(arch = process.arch): Promise<void> {
105-
const version = util.getElectronVersion();
111+
const version = getElectronVersion();
106112
const electronPath = path.join(root, '.build', 'electron');
107113
const versionFile = path.join(electronPath, 'version');
108114
const isUpToDate = fs.existsSync(versionFile) && fs.readFileSync(versionFile, 'utf8') === `${version}`;

build/lib/util.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55
'use strict';
66
Object.defineProperty(exports, "__esModule", { value: true });
7-
exports.getElectronVersion = exports.streamToPromise = exports.versionStringToNumber = exports.filter = exports.rebase = exports.getVersion = exports.ensureDir = exports.rreddir = exports.rimraf = exports.stripSourceMappingURL = exports.loadSourcemaps = exports.cleanNodeModules = exports.skipDirectories = exports.toFileUri = exports.setExecutableBit = exports.fixWin32DirectoryPermissions = exports.incremental = void 0;
7+
exports.streamToPromise = exports.versionStringToNumber = exports.filter = exports.rebase = exports.getVersion = exports.ensureDir = exports.rreddir = exports.rimraf = exports.stripSourceMappingURL = exports.loadSourcemaps = exports.cleanNodeModules = exports.skipDirectories = exports.toFileUri = exports.setExecutableBit = exports.fixWin32DirectoryPermissions = exports.incremental = void 0;
88
const es = require("event-stream");
99
const debounce = require("debounce");
1010
const _filter = require("gulp-filter");
@@ -14,7 +14,6 @@ const fs = require("fs");
1414
const _rimraf = require("rimraf");
1515
const git = require("./git");
1616
const VinylFile = require("vinyl");
17-
const root = path.dirname(path.dirname(__dirname));
1817
const NoCancellationToken = { isCancellationRequested: () => false };
1918
function incremental(streamProvider, initial, supportsCancellation) {
2019
const input = es.through();
@@ -256,9 +255,3 @@ function streamToPromise(stream) {
256255
});
257256
}
258257
exports.streamToPromise = streamToPromise;
259-
function getElectronVersion() {
260-
const yarnrc = fs.readFileSync(path.join(root, '.yarnrc'), 'utf8');
261-
const target = /^target "(.*)"$/m.exec(yarnrc)[1];
262-
return target;
263-
}
264-
exports.getElectronVersion = getElectronVersion;

0 commit comments

Comments
 (0)