2019-08-16 23:05:39 +02:00
|
|
|
module.exports = function(grunt) {
|
|
|
|
grunt.registerMultiTask('codesign', 'Launches Apple codesign', function() {
|
2019-01-07 18:33:21 +01:00
|
|
|
const done = this.async();
|
|
|
|
const opt = this.options();
|
|
|
|
const config = require('../../keys/codesign.json');
|
|
|
|
for (const file of this.files) {
|
2019-08-16 23:05:39 +02:00
|
|
|
const args = ['-s', config.identities[opt.identity]];
|
2019-01-07 18:33:21 +01:00
|
|
|
if (opt.deep) {
|
|
|
|
args.push('--deep');
|
|
|
|
}
|
|
|
|
args.push(file.src);
|
|
|
|
grunt.log.writeln('codesign:', args.join(' '));
|
2019-08-16 23:05:39 +02:00
|
|
|
grunt.util.spawn(
|
|
|
|
{
|
|
|
|
cmd: 'codesign',
|
2019-08-18 10:17:09 +02:00
|
|
|
args,
|
2019-08-16 23:05:39 +02:00
|
|
|
opts: { stdio: 'inherit' }
|
|
|
|
},
|
|
|
|
(error, result, code) => {
|
|
|
|
if (error) {
|
|
|
|
return grunt.warn('codesign: ' + error);
|
|
|
|
}
|
|
|
|
if (code) {
|
|
|
|
return grunt.warn('codesign exit code ' + code);
|
|
|
|
}
|
|
|
|
done();
|
2019-01-07 18:33:21 +01:00
|
|
|
}
|
2019-08-16 23:05:39 +02:00
|
|
|
);
|
2019-01-07 18:33:21 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|