sign safari appex after libs

This commit is contained in:
Kyle Spearrin 2019-09-30 15:41:16 -04:00
parent 53fe65ddbe
commit 427c9def58
1 changed files with 34 additions and 29 deletions

View File

@ -44,7 +44,7 @@ function pkgMas(cb) {
return del([paths.dist + 'mas/Bitwarden*.pkg']) return del([paths.dist + 'mas/Bitwarden*.pkg'])
.then(() => { .then(() => {
return signLibs(cb, 'mas'); return signMas(cb);
}).then(() => { }).then(() => {
const proc = child.spawn('productbuild', [ const proc = child.spawn('productbuild', [
'--component', '--component',
@ -68,6 +68,9 @@ function pkgMas(cb) {
}); });
} }
function signMas(cb) {
return signSafariExt(cb, 'mas');
}
function signMac(cb) { function signMac(cb) {
return signSafariExt(cb, 'mac'); return signSafariExt(cb, 'mac');
@ -81,9 +84,7 @@ function signSafariExt(cb, dir) {
const libs = fs.readdirSync(safariAppexFrameworkPath).filter((p) => p.endsWith('.dylib')) const libs = fs.readdirSync(safariAppexFrameworkPath).filter((p) => p.endsWith('.dylib'))
.map((p) => safariAppexFrameworkPath + p); .map((p) => safariAppexFrameworkPath + p);
const allItems = libs.concat([safariAppexPath]); const libPromises = [];
const promises = [];
allItems.forEach((i) => {
var args = dir === 'mas' ? var args = dir === 'mas' ?
[ [
'--verbose', '--verbose',
@ -91,8 +92,7 @@ function signSafariExt(cb, dir) {
'--sign', '--sign',
'3rd Party Mac Developer Application: 8bit Solutions LLC', '3rd Party Mac Developer Application: 8bit Solutions LLC',
'--entitlements', '--entitlements',
safariEntitlementsPath, safariEntitlementsPath
i
] : ] :
[ [
'--verbose', '--verbose',
@ -102,15 +102,19 @@ function signSafariExt(cb, dir) {
'--sign', '--sign',
'Developer ID Application: 8bit Solutions LLC', 'Developer ID Application: 8bit Solutions LLC',
'--entitlements', '--entitlements',
safariEntitlementsPath, safariEntitlementsPath
i
]; ];
const proc = child.spawn('codesign', args); libs.forEach((i) => {
const proc = child.spawn('codesign', args.concat([i]));
stdOutProc(proc); stdOutProc(proc);
promises.push(new Promise((resolve) => proc.on('close', resolve))); libPromises.push(new Promise((resolve) => proc.on('close', resolve)));
promises.push(new Promise((resolve) => setTimeout(() => resolve(), 10000))); libPromises.push(new Promise((resolve) => setTimeout(() => resolve(), 10000)));
}); });
return Promise.all(promises).then(() => { return Promise.all(libPromises).then(() => {
const proc = child.spawn('codesign', args.concat([safariAppexPath]));
stdOutProc(proc);
return new Promise((resolve) => proc.on('close', resolve));
}).then(() => {
return cb; return cb;
}, () => { }, () => {
return cb; return cb;
@ -128,5 +132,6 @@ exports.webfonts = gulp.series(clean, webfonts);
exports['prebuild:renderer'] = gulp.parallel(webfonts, cleanupAotIssue); exports['prebuild:renderer'] = gulp.parallel(webfonts, cleanupAotIssue);
exports.fixSweetAlert = fixSweetAlert; exports.fixSweetAlert = fixSweetAlert;
exports.pkgMas = pkgMas; exports.pkgMas = pkgMas;
exports.signMas = signMas;
exports.signMac = signMac; exports.signMac = signMac;
exports.postinstall = fixSweetAlert; exports.postinstall = fixSweetAlert;