gulpfile.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* eslint-disable
  2. import/no-extraneous-dependencies,
  3. strict,
  4. prefer-spread
  5. */
  6. const _ = require('underscore');
  7. const gulp = require('gulp');
  8. const minimist = require('minimist');
  9. const runSeq = require('run-sequence');
  10. // available crossplatform builds
  11. let platforms;
  12. if (process.platform === 'darwin') {
  13. platforms = ['mac', 'linux', 'win'];
  14. } else if (process.platform === 'win32') {
  15. platforms = ['win'];
  16. } else {
  17. platforms = ['linux', 'win'];
  18. }
  19. // parse commandline arguments
  20. const args = process.argv.slice(2);
  21. const options = minimist(args, {
  22. string: ['walletSource', 'test', 'skipTasks'],
  23. boolean: _.flatten(['wallet', platforms]),
  24. default: {
  25. wallet: false,
  26. walletSource: 'master',
  27. test: 'basic',
  28. skipTasks: ''
  29. }
  30. });
  31. // echo version info and usage hints
  32. console.log('Mist version:', require('./package.json').version);
  33. console.log('Electron version:', require('electron/package.json').version);
  34. if (_.isEmpty(_.intersection(args, ['--wallet']))) {
  35. console.log('Many gulp tasks can be run in wallet mode using: --wallet');
  36. }
  37. const platformFlags = platforms.map(platform => {
  38. return `--${platform}`;
  39. });
  40. if (_.isEmpty(_.intersection(args, platformFlags))) {
  41. console.log(
  42. `To specify a platform (default: all) use: ${platformFlags.join(' ')}`
  43. );
  44. _.each(platforms, platform => {
  45. options[platform] = true;
  46. }); // activate all platform flags
  47. }
  48. // prepare global variables (shared with other gulp task files)
  49. options.type = options.wallet ? 'wallet' : 'mist';
  50. options.platforms = platforms;
  51. options.activePlatforms = _.keys(
  52. _.pick(_.pick(options, platforms), key => {
  53. return key;
  54. })
  55. );
  56. exports.options = options;
  57. // import gulp tasks
  58. require('require-dir')('./gulpTasks');
  59. gulp.task('upload-queue', gulp.series('checksums', 'upload-binaries'));
  60. const skipTasks = options.skipTasks.replace(/\s/g, '').split(',');
  61. const tasks = [
  62. 'clean-dist',
  63. 'pack-wallet',
  64. 'copy-app-source-files',
  65. 'transpile-main',
  66. 'transpile-modules',
  67. 'copy-build-folder-files',
  68. 'switch-production',
  69. 'build-interface',
  70. 'copy-interface',
  71. 'move-wallet',
  72. 'copy-i18n',
  73. 'build-dist',
  74. 'release-dist',
  75. 'build-nsis',
  76. 'verify-artifacts'
  77. ].filter(task => !skipTasks.includes(task));
  78. gulp.task('default', gulp.series(tasks));