forked from ethereum/mist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
99 lines (75 loc) · 2.48 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/* eslint-disable
import/no-extraneous-dependencies,
strict,
prefer-spread
*/
'use strict';
const _ = require('underscore');
const gulp = require('gulp');
const minimist = require('minimist');
const runSeq = require('run-sequence');
// available crossplatform builds
let platforms;
if (process.platform === 'darwin') {
platforms = ['mac', 'linux', 'win'];
} else if (process.platform === 'win32') {
platforms = ['win'];
} else {
platforms = ['linux', 'win'];
}
// parse commandline arguments
const args = process.argv.slice(2);
const options = minimist(args, {
string: ['walletSource', 'test', 'skipTasks'],
boolean: _.flatten(['wallet', platforms]),
default: {
wallet: false,
walletSource: 'master',
test: 'basic',
skipTasks: '',
},
});
// echo version info and usage hints
console.log('Mist version:', require('./package.json').version);
console.log('Electron version:', require('electron/package.json').version);
if (_.isEmpty(_.intersection(args, ['--wallet']))) {
console.log('Many gulp tasks can be run in wallet mode using: --wallet');
}
const platformFlags = platforms.map((platform) => { return `--${platform}`; });
if (_.isEmpty(_.intersection(args, platformFlags))) {
console.log(`To specify a platform (default: all) use: ${platformFlags.join(' ')}`);
_.each(platforms, (platform) => { options[platform] = true; }); // activate all platform flags
}
// prepare global variables (shared with other gulp task files)
options.type = (options.wallet) ? 'wallet' : 'mist';
options.platforms = platforms;
options.activePlatforms = _.keys(_.pick(_.pick(options, platforms), (key) => { return key; }));
exports.options = options;
// import gulp tasks
require('require-dir')('./gulpTasks');
// tasks
gulp.task('default', ['buildQueue']);
gulp.task('buildQueue', (cb) => {
const skipTasks = options.skipTasks.split(',');
let tasks = [
'clean-dist',
'copy-app-source-files',
'transpile-main',
'transpile-modules',
'copy-build-folder-files',
'switch-production',
'bundling-interface',
'copy-i18n',
'build-dist',
'release-dist',
];
if (options.win) tasks.push('build-nsis');
tasks = _.difference(tasks, skipTasks);
runSeq.apply(null, _.flatten([tasks, cb]));
});
gulp.task('uploadQueue', (cb) => {
const tasks = [];
tasks.push('checksums');
tasks.push('upload-binaries');
runSeq.apply(null, _.flatten([tasks, cb]));
});