Generate different header in editor build

This commit is contained in:
Alex Dima
2015-11-20 00:08:13 +01:00
parent 321ccd5a32
commit d7177d6539
3 changed files with 26 additions and 24 deletions

View File

@@ -82,7 +82,7 @@ function toBundleStream(bundles) {
}));
}
exports.optimizeTask = function(entryPoints, resources, loaderConfig, out) {
exports.optimizeTask = function(entryPoints, resources, loaderConfig, bundledFileHeader, out) {
return function() {
var bundles = es.through();
@@ -104,32 +104,12 @@ exports.optimizeTask = function(entryPoints, resources, loaderConfig, out) {
if (containsOurCopyright) {
b.sources.unshift({
path: null,
contents: [
'/*!--------------------------------------------------------',
' * Copyright (C) Microsoft Corporation. All rights reserved.',
' *--------------------------------------------------------*/'
].join('\r\n')
contents: bundledFileHeader
});
}
});
var bundleInformation = result.map(function (b) {
return {
dest: b.dest,
sources: b.sources.filter(function (s) {
return !!s.path;
}).map(function (s) {
return path.relative('out-build', s.path);
})
}
});
var info = es.readArray([new File({
path: 'bundles.json',
contents: new Buffer(JSON.stringify(bundleInformation), 'utf8')
})]);
es.merge(toBundleStream(result), info).pipe(bundles);
toBundleStream(result).pipe(bundles);
});
var result = es.merge(

View File

@@ -13,6 +13,9 @@ var buildfile = require('../src/buildfile');
var util = require('./lib/util');
var common = require('./gulpfile.common');
var root = path.dirname(__dirname);
var commit = process.env['BUILD_SOURCEVERSION'] || require('./lib/git').getVersion(root);
// Build
var editorEntryPoints = _.flatten([
@@ -36,6 +39,16 @@ var editorResources = [
'!**/test/**'
];
var BUNDLED_FILE_HEADER = [
'/*!-----------------------------------------------------------',
' * Copyright (C) Microsoft Corporation. All rights reserved.',
' * Version: ' + commit,
' * Released under the MIT license',
' * https://github.com/Microsoft/vscode/blob/master/LICENSE.txt',
' *-----------------------------------------------------------*/',
''
].join('\n');
function editorLoaderConfig(removeAllOSS) {
var result = common.loaderConfig();
@@ -54,6 +67,7 @@ gulp.task('optimize-editor', ['clean-optimized-editor', 'compile-build'], common
editorEntryPoints,
editorResources,
editorLoaderConfig(false),
BUNDLED_FILE_HEADER,
'out-editor'
));
@@ -66,6 +80,7 @@ gulp.task('optimize-editor-ossfree', ['clean-optimized-editor-ossfree', 'compile
editorEntryPoints,
editorResources,
editorLoaderConfig(true),
BUNDLED_FILE_HEADER,
'out-editor-ossfree'
));
@@ -79,7 +94,7 @@ var root = path.dirname(__dirname);
function editorTask(out, dest) {
return function () {
return gulp.src(out + '/**', { base: out })
.pipe(filter(['**', '!**/*.js.map', '!**/bundles.json']))
.pipe(filter(['**', '!**/*.js.map']))
.pipe(gulp.dest(dest));
};
}

View File

@@ -71,11 +71,18 @@ var vscodeResources = [
'!**/test/**'
];
var BUNDLED_FILE_HEADER = [
'/*!--------------------------------------------------------',
' * Copyright (C) Microsoft Corporation. All rights reserved.',
' *--------------------------------------------------------*/'
].join('\n');
gulp.task('clean-optimized-vscode', util.rimraf('out-vscode'));
gulp.task('optimize-vscode', ['clean-optimized-vscode', 'compile-build', 'compile-plugins'], common.optimizeTask(
vscodeEntryPoints,
vscodeResources,
common.loaderConfig(baseModules),
BUNDLED_FILE_HEADER,
'out-vscode'
));