fix #196: sign mac app

This commit is contained in:
antelle 2017-04-27 21:28:28 +02:00
parent fd96ecfd43
commit 4a994f26e4
2 changed files with 49 additions and 1 deletions

View File

@ -365,6 +365,21 @@ module.exports = function(grunt) {
}
}
},
codesign: {
app: {
options: {
identity: 'app',
deep: true
},
src: ['tmp/desktop/KeeWeb-darwin-x64/KeeWeb.app']
},
dmg: {
options: {
identity: 'app'
},
src: [`dist/desktop/KeeWeb-${pkg.version}.mac.dmg`]
}
},
compress: {
options: {
level: 6
@ -634,6 +649,7 @@ module.exports = function(grunt) {
grunt.registerTask('build-desktop-executables', [
'electron',
'codesign:app',
'sign-exe:win32-build-x64',
'sign-exe:win32-build-ia32',
'copy:desktop-darwin-helper-x64',
@ -649,7 +665,8 @@ module.exports = function(grunt) {
]);
grunt.registerTask('build-desktop-dist-darwin', [
'appdmg'
'appdmg',
'codesign:dmg'
]);
grunt.registerTask('build-desktop-dist-win32', [

View File

@ -0,0 +1,31 @@
module.exports = function (grunt) {
grunt.registerMultiTask('codesign', 'Launches Apple codesign', function () {
const done = this.async();
const opt = this.options();
const config = require('../../keys/codesign.json');
for (const file of this.files) {
const args = [
'-s',
config.identities[opt.identity]
];
if (opt.deep) {
args.push('--deep');
}
args.push(file.src);
grunt.log.writeln('codesign:', args.join(' '));
grunt.util.spawn({
cmd: 'codesign',
args: args,
opts: {stdio: 'inherit'}
}, (error, result, code) => {
if (error) {
return grunt.warn('codesign: ' + error);
}
if (code) {
return grunt.warn('codesign exit code ' + code);
}
done();
});
}
});
};