1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-12-28 17:18:24 +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"
},
"afterSign": "scripts/after-sign.js",
"artifactBuildStarted": "scripts/start-artifact.js",
"mac": {
"electronUpdaterCompatibility": ">=0.0.1",
"category": "public.app-category.productivity",

View File

@ -1,26 +1,17 @@
require('dotenv').config();
const { notarize } = require('electron-notarize');
const fs = require('fs');
const child = require('child_process');
exports.default = run;
async function run(context) {
console.log(context);
console.log('### After sign');
// console.log(context);
const appleId = process.env.APPLEID;
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);
}
if (macBuild) {
console.log('### Notarizing ' + appPath);
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()));
}