forked from ethereum/mist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
93 lines (79 loc) · 2.25 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
/* eslint-disable
import/no-extraneous-dependencies,
strict,
prefer-spread
*/
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');
gulp.task('uploadQueue', cb => {
const tasks = [];
tasks.push('checksums');
tasks.push('upload-binaries');
runSeq.apply(null, _.flatten([tasks, cb]));
});
const skipTasks = options.skipTasks.replace(/\s/g, '').split(',');
const 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',
'build-nsis'
].filter(task => !skipTasks.includes(task));
gulp.task('default', gulp.series(tasks));