forked from microsoft/vscode-node-debug
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
82 lines (66 loc) · 2.38 KB
/
Copy pathgulpfile.js
File metadata and controls
82 lines (66 loc) · 2.38 KB
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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
var gulp = require('gulp');
var path = require('path');
var tsb = require('gulp-tsb');
var log = require('gulp-util').log;
var azure = require('gulp-azure-storage');
var git = require('git-rev-sync');
var del = require('del');
var runSequence = require('run-sequence');
var vzip = require('gulp-vinyl-zip');
var compilation = tsb.create(path.join(__dirname, 'tsconfig.json'), true);
var sources = [
'common/**/*.ts',
'node/**/*.ts',
'typings/**/*.ts',
'test/**/*.ts'
];
var outDest = 'out';
var uploadDest = 'upload/' + git.short();
gulp.task('default', function(callback) {
runSequence('build', callback);
});
gulp.task('build', function(callback) {
runSequence('clean', 'internal-build', callback);
});
gulp.task('zip', function(callback) {
runSequence('build', 'internal-zip', callback);
});
gulp.task('upload', function(callback) {
runSequence('zip', 'internal-upload', callback);
});
gulp.task('clean', function() {
return del(['out/**', 'upload/**']);
})
gulp.task('ts-watch', ['internal-build'], function(cb) {
log('Watching build sources...');
gulp.watch(sources, ['internal-compile']);
});
//---- internal
// compile and copy everything to outDest
gulp.task('internal-build', function(callback) {
runSequence('internal-compile', 'internal-copy-scripts', callback);
});
gulp.task('internal-copy-scripts', function() {
return gulp.src(['node/terminateProcess.sh', 'node/TerminalHelper.scpt'])
.pipe(gulp.dest(outDest + '/node'));
});
gulp.task('internal-compile', function() {
return gulp.src(sources, { base: '.' })
.pipe(compilation())
.pipe(gulp.dest(outDest));
});
gulp.task('internal-zip', function(callback) {
return gulp.src([outDest + '/**/*', 'node_modules/source-map/**/*', 'package.json', 'ThirdPartyNotices.txt', 'LICENSE.txt'], { base: '.' }).pipe(vzip.dest(uploadDest + '/node-debug.zip'));
});
gulp.task('internal-upload', function() {
return gulp.src('upload/**/*')
.pipe(azure.upload({
account: process.env.AZURE_STORAGE_ACCOUNT,
key: process.env.AZURE_STORAGE_ACCESS_KEY,
container: 'debuggers'
}));
});