mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 06:38:23 +00:00
update gulpfile extensions
This commit is contained in:
parent
c6186a2d9d
commit
91f2bd1cce
1 changed files with 42 additions and 41 deletions
|
@ -31,11 +31,15 @@ var languages = ['chs', 'cht', 'jpn', 'kor', 'deu', 'fra', 'esn', 'rus', 'ita'];
|
|||
|
||||
var tasks = compilations.map(function(tsconfigFile) {
|
||||
var absolutePath = path.join(extensionsPath, tsconfigFile);
|
||||
var options = require(absolutePath).compilerOptions;
|
||||
options.verbose = !quiet;
|
||||
var absoluteDirname = path.dirname(absolutePath);
|
||||
var relativeDirname = path.dirname(tsconfigFile);
|
||||
|
||||
var globRelativeDirname = path.dirname(tsconfigFile);
|
||||
var name = globRelativeDirname.replace(/\//g, '-');
|
||||
var tsOptions = require(absolutePath).compilerOptions;
|
||||
tsOptions.verbose = !quiet;
|
||||
tsOptions.sourceMap = true;
|
||||
tsOptions.sourceRoot = util.toFileUri(absoluteDirname);
|
||||
|
||||
var name = relativeDirname.replace(/\//g, '-');
|
||||
|
||||
// Tasks
|
||||
var clean = 'clean-extension:' + name;
|
||||
|
@ -47,44 +51,38 @@ var tasks = compilations.map(function(tsconfigFile) {
|
|||
var compileBuild = 'compile-extension-build:' + name;
|
||||
var watchBuild = 'watch-extension-build:' + name;
|
||||
|
||||
var pipeline = (function () {
|
||||
var reporter = quiet ? null : createReporter();
|
||||
var compilation = tsb.create(options, null, null, quiet ? null : function (err) { reporter(err.toString()); });
|
||||
|
||||
return function (build) {
|
||||
var input = es.through();
|
||||
var tsFilter = filter(['**/*.ts', '!**/lib/lib*.d.ts', '!**/node_modules/**'], { restore: true });
|
||||
var output;
|
||||
if (build) {
|
||||
output = input
|
||||
.pipe(tsFilter)
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(compilation())
|
||||
.pipe(nlsDev.rewriteLocalizeCalls())
|
||||
.pipe(sourcemaps.write('.', {
|
||||
addComment: false,
|
||||
includeContent: false
|
||||
}))
|
||||
.pipe(tsFilter.restore)
|
||||
.pipe(nlsDev.createAdditionalLanguageFiles(languages, path.join(__dirname, '..', 'i18n'), path.join('extensions', globRelativeDirname, 'out')))
|
||||
.pipe(quiet ? es.through() : reporter.end());
|
||||
|
||||
} else {
|
||||
output = input
|
||||
.pipe(tsFilter)
|
||||
.pipe(compilation())
|
||||
.pipe(tsFilter.restore)
|
||||
.pipe(quiet ? es.through() : reporter.end());
|
||||
}
|
||||
|
||||
return es.duplex(input, output);
|
||||
};
|
||||
})();
|
||||
|
||||
var root = path.join('extensions', globRelativeDirname);
|
||||
var root = path.join('extensions', relativeDirname);
|
||||
var srcBase = path.join(root, 'src');
|
||||
var src = path.join(srcBase, '**');
|
||||
var out = path.join(root, 'out');
|
||||
var i18n = path.join(__dirname, '..', 'i18n');
|
||||
|
||||
function createPipeline(build) {
|
||||
var reporter = quiet ? null : createReporter();
|
||||
|
||||
tsOptions.inlineSources = !!build;
|
||||
var compilation = tsb.create(tsOptions, null, null, quiet ? null : function (err) { reporter(err.toString()); });
|
||||
|
||||
return function () {
|
||||
var input = es.through();
|
||||
var tsFilter = filter(['**/*.ts', '!**/lib/lib*.d.ts', '!**/node_modules/**'], { restore: true });
|
||||
var output = input
|
||||
.pipe(tsFilter)
|
||||
.pipe(util.loadSourcemaps())
|
||||
.pipe(compilation())
|
||||
.pipe(build ? nlsDev.rewriteLocalizeCalls() : es.through())
|
||||
.pipe(sourcemaps.write('.', {
|
||||
addComment: false,
|
||||
includeContent: !!build,
|
||||
sourceRoot: tsOptions.sourceRoot
|
||||
}))
|
||||
.pipe(tsFilter.restore)
|
||||
.pipe(build ? nlsDev.createAdditionalLanguageFiles(languages, i18n, out) : es.through())
|
||||
.pipe(quiet ? es.through() : reporter.end());
|
||||
|
||||
return es.duplex(input, output);
|
||||
};
|
||||
};
|
||||
|
||||
var srcOpts = { cwd: path.dirname(__dirname), base: srcBase };
|
||||
|
||||
|
@ -93,14 +91,16 @@ var tasks = compilations.map(function(tsconfigFile) {
|
|||
});
|
||||
|
||||
gulp.task(compile, [clean], function () {
|
||||
var pipeline = createPipeline(false);
|
||||
var input = gulp.src(src, srcOpts);
|
||||
|
||||
return input
|
||||
.pipe(pipeline(false))
|
||||
.pipe(pipeline())
|
||||
.pipe(gulp.dest(out));
|
||||
});
|
||||
|
||||
gulp.task(watch, [clean], function () {
|
||||
var pipeline = createPipeline(false);
|
||||
var input = gulp.src(src, srcOpts);
|
||||
var watchInput = watcher(src, srcOpts);
|
||||
|
||||
|
@ -114,10 +114,11 @@ var tasks = compilations.map(function(tsconfigFile) {
|
|||
});
|
||||
|
||||
gulp.task(compileBuild, [clean], function () {
|
||||
var pipeline = createPipeline(true);
|
||||
var input = gulp.src(src, srcOpts);
|
||||
|
||||
return input
|
||||
.pipe(pipeline(true))
|
||||
.pipe(pipeline())
|
||||
.pipe(gulp.dest(out));
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue