Created
March 1, 2019 23:40
-
-
Save undavide/84f231d7b47a7772cceef0923dd15718 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var clean = require('gulp-clean'); | |
var shell = require('gulp-shell'); | |
// 0. Clean all ZXPs found everywhere | |
gulp.task('clean-all', function () { | |
return gulp.src('./**/*.zxp', { read: false }) | |
.pipe(clean()); | |
}); | |
// 1. Build the HTML Panel ZXP in src/ | |
gulp.task('pack-html', | |
shell.task('./ZXPSignCmd -sign src/com.example.myExtension src/com.example.myExtension.zxp myCertificate.p12 myPassword -tsa https://timestamp.geotrust.com/tsa') | |
); | |
// 2. Copy the ZXP in src/ to src/MXI/HTML/ | |
gulp.task('move-html-zxp', ['pack-html'], function (){ | |
return gulp.src('./src/*.zxp', { base: './src/' }) | |
.pipe(gulp.dest('./src/MXI/HTML')); | |
}); | |
// 3. Delete the HTML Panel ZXP in src/ | |
gulp.task('clean-html-zxp', ['move-html-zxp'], function () { | |
return gulp.src('./src/*.zxp', { read: false }) | |
.pipe(clean()); | |
}); | |
// 4. Build the hybrid ZXP in src/ | |
gulp.task('pack-hybrid-zxp', ['clean-html-zxp'], | |
shell.task('java -jar ucf.jar -package -storetype PKCS12 -keystore ./myCertificate.p12 -storepass myPassword -tsa http://timestamp.entrust.net/TSS/JavaHttpTS com.example.myExtension.zxp -C "./src/MXI/" .') | |
); | |
// 5. Copy the hybrid ZXP to build/ | |
gulp.task('move-zxp-to-build', ['pack-hybrid-zxp'], function () { | |
return gulp.src('./*.zxp', { base: './' }) | |
.pipe(gulp.dest('build')); | |
}); | |
// 6. Delete the hybrid ZXP in src/ | |
gulp.task('clean-hybrid-zxp', ['move-zxp-to-build'], function () { | |
return gulp.src('./*.zxp', { read: false }) | |
.pipe(clean()); | |
}); | |
// 7. Define the default task | |
gulp.task('default', ['clean-all'], function () { | |
gulp.start('clean-hybrid-zxp'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment