提交 7ec0f250 编写于 作者: A Alex Dima

Improve editor-distro gulp task

上级 561cd050
......@@ -7,8 +7,7 @@ out/
out-build/
out-editor/
out-editor-min/
out-editor-ossfree/
out-editor-ossfree-min/
out-monaco-editor-core/
out-vscode/
out-vscode-min/
build/node_modules
\ No newline at end of file
......@@ -167,7 +167,9 @@ exports.optimizeTask = function(opts) {
addComment: true,
includeContent: true
}))
.pipe(i18n.processNlsFiles())
.pipe(i18n.processNlsFiles({
fileHeader: bundledFileHeader
}))
.pipe(gulp.dest(out));
};
};
......
......@@ -9,9 +9,12 @@ var _ = require('underscore');
var buildfile = require('../src/buildfile');
var util = require('./lib/util');
var common = require('./gulpfile.common');
var es = require('event-stream');
var root = path.dirname(__dirname);
var headerVersion = process.env['BUILD_SOURCEVERSION'] || util.getVersion(root);
var sha1 = util.getVersion(root);
var semver = require('./monaco/package.json').version;
var headerVersion = semver + '(' + sha1 + ')';
// Build
......@@ -63,7 +66,7 @@ function editorLoaderConfig(removeAllOSS) {
}
gulp.task('clean-optimized-editor', util.rimraf('out-editor'));
gulp.task('optimize-editor', ['clean-optimized-editor', 'compile-build'], common.optimizeTask({
gulp.task('optimize-editor', ['clean-optimized-editor'/*, 'compile-build'*/], common.optimizeTask({
entryPoints: editorEntryPoints,
otherSources: editorOtherSources,
resources: editorResources,
......@@ -74,4 +77,61 @@ gulp.task('optimize-editor', ['clean-optimized-editor', 'compile-build'], common
gulp.task('clean-minified-editor', util.rimraf('out-editor-min'));
gulp.task('minify-editor', ['clean-minified-editor', 'optimize-editor'], common.minifyTask('out-editor', true));
gulp.task('editor-distro', ['minify-editor', 'optimize-editor']);
gulp.task('clean-editor-distro', util.rimraf('out-monaco-editor-core'));
gulp.task('editor-distro', ['clean-editor-distro'/*, 'minify-editor', 'optimize-editor'*/], function() {
return es.merge(
// other assets
es.merge(
gulp.src('build/monaco/package.json'),
gulp.src('build/monaco/LICENSE'),
gulp.src('build/monaco/ThirdPartyNotices.txt'),
gulp.src('src/vs/monaco.d.ts')
).pipe(gulp.dest('out-monaco-editor-core')),
// dev folder
es.merge(
gulp.src('out-editor/**/*')
).pipe(gulp.dest('out-monaco-editor-core/dev')),
// min folder
es.merge(
gulp.src('out-editor-min/**/*')
).pipe(filterStream(function(path) {
// no map files
return !/\.js\.map$|nls\.metadata\.json/.test(path);
})).pipe(es.through(function(data) {
// tweak the sourceMappingURL
if (!/\.js$/.test(data.path)) {
this.emit('data', data);
return;
}
var relativePathToMap = path.relative(path.join(data.relative), path.join('min-maps', data.relative + '.map'));
var strContents = data.contents.toString();
var newStr = '//# sourceMappingURL=' + relativePathToMap.replace(/\\/g, '/');
strContents = strContents.replace(/\/\/\# sourceMappingURL=[^ ]+$/, newStr);
data.contents = new Buffer(strContents);
this.emit('data', data);
})).pipe(gulp.dest('out-monaco-editor-core/min')),
// min-maps folder
es.merge(
gulp.src('out-editor-min/**/*')
).pipe(filterStream(function(path) {
// no map files
return !/\.js\.map$/.test(path);
})).pipe(gulp.dest('out-monaco-editor-core/min-maps'))
);
});
function filterStream(testFunc) {
return es.through(function(data) {
if (!testFunc(data.relative)) {
return;
}
this.emit('data', data);
});
}
......@@ -26,7 +26,8 @@ var eolFilter = [
'!**/node_modules/**',
'!**/fixtures/**',
'!**/*.{svg,exe,png,scpt,bat,cmd,cur,ttf,woff,eot}',
'!build/{lib,monaco,tslintRules}/**/*.js'
'!build/{lib,tslintRules}/**/*.js',
'!build/monaco/**/*'
];
var indentationFilter = [
......
......@@ -91,12 +91,6 @@ function sortLanguages(directoryNames) {
return a.iso639_2 < b.iso639_2 ? -1 : (a.iso639_2 > b.iso639_2 ? 1 : 0);
});
}
var headerComment = [
'/*---------------------------------------------------------------------------------------------',
' * Copyright (c) Microsoft Corporation. All rights reserved.',
' * Licensed under the MIT License. See License.txt in the project root for license information.',
' *---------------------------------------------------------------------------------------------*/'
].join('\n');
function stripComments(content) {
/**
* First capturing group matches double quoted string
......@@ -164,7 +158,7 @@ function escapeCharacters(value) {
}
return result.join('');
}
function processCoreBundleFormat(json, emitter) {
function processCoreBundleFormat(fileHeader, json, emitter) {
var keysSection = json.keys;
var messageSection = json.messages;
var bundleSection = json.bundles;
......@@ -236,7 +230,7 @@ function processCoreBundleFormat(json, emitter) {
Object.keys(bundleSection).forEach(function (bundle) {
var modules = bundleSection[bundle];
var contents = [
headerComment,
fileHeader,
("define(\"" + bundle + ".nls." + language.iso639_2 + "\", {")
];
modules.forEach(function (module, index) {
......@@ -273,7 +267,7 @@ function processCoreBundleFormat(json, emitter) {
}
});
}
function processNlsFiles() {
function processNlsFiles(opts) {
return event_stream_1.through(function (file) {
var fileName = path.basename(file.path);
if (fileName === 'nls.metadata.json') {
......@@ -285,7 +279,7 @@ function processNlsFiles() {
this.emit('error', "Failed to read component file: " + file.relative);
}
if (BundledFormat.is(json)) {
processCoreBundleFormat(json, this);
processCoreBundleFormat(opts.fileHeader, json, this);
}
}
this.emit('data', file);
......
......@@ -115,15 +115,6 @@ function sortLanguages(directoryNames: string[]): IDirectoryInfo[] {
});
}
const headerComment: string =
[
'/*---------------------------------------------------------------------------------------------',
' * Copyright (c) Microsoft Corporation. All rights reserved.',
' * Licensed under the MIT License. See License.txt in the project root for license information.',
' *---------------------------------------------------------------------------------------------*/'
].join('\n');
function stripComments(content: string): string {
/**
* First capturing group matches double quoted string
......@@ -189,7 +180,7 @@ function escapeCharacters(value:string):string {
return result.join('');
}
function processCoreBundleFormat(json: BundledFormat, emitter: any) {
function processCoreBundleFormat(fileHeader:string, json: BundledFormat, emitter: any) {
let keysSection = json.keys;
let messageSection = json.messages;
let bundleSection = json.bundles;
......@@ -262,7 +253,7 @@ function processCoreBundleFormat(json: BundledFormat, emitter: any) {
Object.keys(bundleSection).forEach((bundle) => {
let modules = bundleSection[bundle];
let contents: string[] = [
headerComment,
fileHeader,
`define("${bundle}.nls.${language.iso639_2}", {`
];
modules.forEach((module, index) => {
......@@ -299,7 +290,7 @@ function processCoreBundleFormat(json: BundledFormat, emitter: any) {
});
}
export function processNlsFiles(): ThroughStream {
export function processNlsFiles(opts:{fileHeader:string;}): ThroughStream {
return through(function(file: File) {
let fileName = path.basename(file.path);
if (fileName === 'nls.metadata.json') {
......@@ -310,7 +301,7 @@ export function processNlsFiles(): ThroughStream {
this.emit('error', `Failed to read component file: ${file.relative}`)
}
if (BundledFormat.is(json)) {
processCoreBundleFormat(json, this);
processCoreBundleFormat(opts.fileHeader, json, this);
}
}
this.emit('data', file);
......
The MIT License (MIT)
Copyright (c) 2016 Microsoft Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
Do Not Translate or Localize
This project incorporates components from the projects listed below. The original copyright notices and the licenses
under which Microsoft received such components are set forth below. Microsoft reserves all rights not expressly granted
herein, whether by implication, estoppel or otherwise.
1. HTML 5.1 W3C Working Draft version 08 October 2015 (http://www.w3.org/TR/2015/WD-html51-20151008/)
2. js-beautify version 1.5.10 (https://github.com/beautify-web/js-beautify)
3. string_scorer version 0.1.20 (https://github.com/joshaven/string_score)
4. vscode-swift version 0.0.1 (https://github.com/owensd/vscode-swift)
%% HTML 5.1 W3C Working Draft NOTICES AND INFORMATION BEGIN HERE
=========================================
Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang). This software or document includes material copied
from or derived from HTML 5.1 W3C Working Draft (http://www.w3.org/TR/2015/WD-html51-20151008/.)
THIS DOCUMENT IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT
NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF
THE DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY
PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE
DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF.
The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to this document or its contents
without specific, written prior permission. Title to copyright in this document will at all times remain with copyright holders.
=========================================
END OF HTML 5.1 W3C Working Draft NOTICES AND INFORMATION
%% js-beautify NOTICES AND INFORMATION BEGIN HERE
=========================================
The MIT License (MIT)
Copyright (c) 2007-2013 Einar Lielmanis and contributors.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
=========================================
END OF js-beautify NOTICES AND INFORMATION
%% string_scorer NOTICES AND INFORMATION BEGIN HERE
=========================================
This software is released under the MIT license:
Copyright (c) Joshaven Potter
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
=========================================
END OF string_scorer NOTICES AND INFORMATION
%% vscode-swift NOTICES AND INFORMATION BEGIN HERE
=========================================
The MIT License (MIT)
Copyright (c) 2015 David Owens II
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
=========================================
END OF vscode-swift NOTICES AND INFORMATION
此差异已折叠。
......@@ -33,9 +33,9 @@ function getSourceFile(moduleId:string): ts.SourceFile {
try {
fileContents = fs.readFileSync(filePath).toString();
} catch (err) {
console.error('======================================================================');
console.error('=> Have you compiled (gulp watch) with env variable VSCODE_BUILD_DECLARATION_FILES=1 ?');
console.error('======================================================================');
console.error('=========================================================================');
console.error('=> Have you compiled with env variable VSCODE_BUILD_DECLARATION_FILES=1 ?');
console.error('=========================================================================');
throw err;
}
......@@ -347,9 +347,3 @@ let result = generateDeclarationFile(recipe);
const DECLARATION_PATH = path.join(__dirname, '../../src/vs/monaco.d.ts');
fs.writeFileSync(DECLARATION_PATH, result);
// let result = generateDeclarationFile
// var recipe = fs.readFileSync(path.join(__dirname, './monaco-editor.d.ts.recipe')).toString();
// fs.writeFileSync(path.join(__dirname, './monaco-editor.d.ts'), resultTxt);
{
"name": "monaco-editor-core",
"version": "0.2.1",
"description": "A browser based code editor",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Microsoft Corporation",
"license": "MIT"
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册