1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-25 16:59:17 +01:00

artifactBuildStarted

This commit is contained in:
Kyle Spearrin 2019-09-27 17:27:57 -04:00
parent a4f9c15524
commit fc2761cfca
3 changed files with 55 additions and 41 deletions

View File

@ -60,6 +60,7 @@
"app": "build" "app": "build"
}, },
"afterSign": "scripts/after-sign.js", "afterSign": "scripts/after-sign.js",
"artifactBuildStarted": "scripts/start-artifact.js",
"mac": { "mac": {
"electronUpdaterCompatibility": ">=0.0.1", "electronUpdaterCompatibility": ">=0.0.1",
"category": "public.app-category.productivity", "category": "public.app-category.productivity",

View File

@ -1,26 +1,17 @@
require('dotenv').config(); require('dotenv').config();
const { notarize } = require('electron-notarize'); const { notarize } = require('electron-notarize');
const fs = require('fs');
const child = require('child_process');
exports.default = run; exports.default = run;
async function run(context) { async function run(context) {
console.log(context); console.log('### After sign');
// console.log(context);
const appleId = process.env.APPLEID; const appleId = process.env.APPLEID;
const appName = context.packager.appInfo.productFilename; const appName = context.packager.appInfo.productFilename;
const appPath = `${context.appOutDir}/${appName}.app`; const appPath = `${context.appOutDir}/${appName}.app`;
const masBuild = context.electronPlatformName === 'mas';
const macBuild = context.electronPlatformName === 'darwin'; const macBuild = context.electronPlatformName === 'darwin';
if (masBuild || macBuild) {
console.log('### Signing Safari App Extension Libs');
const resourcesPath = context.packager.info._buildResourcesDir;
const devId = masBuild ? '3rd Party Mac Developer Application: 8bit Solutions LLC' :
'Developer ID Application: 8bit Solutions LLC';
await signSafariAppLibs(appPath, resourcesPath, devId);
}
if (macBuild) { if (macBuild) {
console.log('### Notarizing ' + appPath); console.log('### Notarizing ' + appPath);
return await notarize({ return await notarize({
@ -31,33 +22,3 @@ async function run(context) {
}); });
} }
} }
async function signSafariAppLibs(appPath, resourcesPath, devId) {
const appexPath = appPath + '/Contents/PlugIns/safari.appex';
const appexFrameworkPath = appexPath + '/Contents/Frameworks/';
const entitlementsPath = resourcesPath + '/safari.entitlements';
const libs = fs.readdirSync(appexFrameworkPath).filter((p) => p.endsWith('.dylib'))
.map((p) => appexFrameworkPath + p);
const promises = [];
libs.forEach((i) => {
const proc = child.spawn('codesign', [
'--verbose',
'--force',
'-o',
'runtime',
'--sign',
devId,
'--entitlements',
entitlementsPath,
i]);
stdOutProc(proc);
promises.push(new Promise((resolve) => proc.on('close', resolve)));
});
await Promise.all(promises);
}
function stdOutProc(proc) {
proc.stdout.on('data', (data) => console.log(data.toString()));
proc.stderr.on('data', (data) => console.error(data.toString()));
}

52
scripts/start-artifact.js Normal file
View File

@ -0,0 +1,52 @@
const fs = require('fs');
const child = require('child_process');
exports.default = run;
async function run(context) {
console.log('### Start artifact');
// console.log(context);
const appName = context.packager.appInfo.productFilename;
const appPath = `${context.appOutDir}/${appName}.app`;
const masBuild = context.electronPlatformName === 'mas';
const macBuild = context.electronPlatformName === 'darwin';
if (masBuild || macBuild) {
console.log('### Signing Safari App Extension Libs');
const resourcesPath = context.packager.info._buildResourcesDir;
const devId = masBuild ? '3rd Party Mac Developer Application: 8bit Solutions LLC' :
'Developer ID Application: 8bit Solutions LLC';
await signSafariAppLibs(appPath, resourcesPath, devId);
}
}
async function signSafariAppLibs(appPath, resourcesPath, devId) {
const appexPath = appPath + '/Contents/PlugIns/safari.appex';
const appexFrameworkPath = appexPath + '/Contents/Frameworks/';
const entitlementsPath = resourcesPath + '/safari.entitlements';
const libs = fs.readdirSync(appexFrameworkPath).filter((p) => p.endsWith('.dylib'))
.map((p) => appexFrameworkPath + p);
const promises = [];
libs.forEach((i) => {
const proc = child.spawn('codesign', [
'--verbose',
'--force',
'-o',
'runtime',
'--sign',
devId,
'--entitlements',
entitlementsPath,
i]);
stdOutProc(proc);
promises.push(new Promise((resolve) => proc.on('close', resolve)));
});
await Promise.all(promises);
}
function stdOutProc(proc) {
proc.stdout.on('data', (data) => console.log(data.toString()));
proc.stderr.on('data', (data) => console.error(data.toString()));
}