Skip to content

Commit 82bd05b

Browse files
author
Arthur Ozga
committed
Merge branch 'master' into createTypeNode
2 parents bfb1bb4 + a9d8df2 commit 82bd05b

File tree

426 files changed

+4695
-5223
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

426 files changed

+4695
-5223
lines changed

Gulpfile.ts

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import * as cp from "child_process";
33
import * as path from "path";
44
import * as fs from "fs";
5+
import child_process = require("child_process");
56
import originalGulp = require("gulp");
67
import helpMaker = require("gulp-help");
78
import runSequence = require("run-sequence");
@@ -1019,40 +1020,16 @@ function spawnLintWorker(files: {path: string}[], callback: (failures: number) =
10191020
}
10201021

10211022
gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are: --f[iles]=regex", ["build-rules"], () => {
1022-
const fileMatcher = RegExp(cmdLineOptions["files"]);
10231023
if (fold.isTravis()) console.log(fold.start("lint"));
1024-
1025-
let files: {stat: fs.Stats, path: string}[] = [];
1026-
return gulp.src(lintTargets, { read: false })
1027-
.pipe(through2.obj((chunk, enc, cb) => {
1028-
files.push(chunk);
1029-
cb();
1030-
}, (cb) => {
1031-
files = files.filter(file => fileMatcher.test(file.path)).sort((filea, fileb) => filea.stat.size - fileb.stat.size);
1032-
const workerCount = cmdLineOptions["workers"];
1033-
for (let i = 0; i < workerCount; i++) {
1034-
spawnLintWorker(files, finished);
1035-
}
1036-
1037-
let completed = 0;
1038-
let failures = 0;
1039-
function finished(fails) {
1040-
completed++;
1041-
failures += fails;
1042-
if (completed === workerCount) {
1043-
if (fold.isTravis()) console.log(fold.end("lint"));
1044-
if (failures > 0) {
1045-
throw new Error(`Linter errors: ${failures}`);
1046-
}
1047-
else {
1048-
cb();
1049-
}
1050-
}
1051-
}
1052-
}));
1024+
const fileMatcher = cmdLineOptions["files"];
1025+
const files = fileMatcher
1026+
? `src/**/${fileMatcher}`
1027+
: "Gulpfile.ts 'src/**/*.ts' --exclude src/lib/es5.d.ts --exclude 'src/lib/*.generated.d.ts'";
1028+
const cmd = `node node_modules/tslint/bin/tslint ${files} --format stylish`;
1029+
console.log("Linting: " + cmd);
1030+
child_process.execSync(cmd, { stdio: [0, 1, 2] });
10531031
});
10541032

1055-
10561033
gulp.task("default", "Runs 'local'", ["local"]);
10571034

10581035
gulp.task("watch", "Watches the src/ directory for changes and executes runtests-parallel.", [], () => {

Jakefile.js

Lines changed: 43 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ var thirdParty = "ThirdPartyNoticeText.txt";
2929
var nodeModulesPathPrefix = path.resolve("./node_modules/.bin/") + path.delimiter;
3030
if (process.env.path !== undefined) {
3131
process.env.path = nodeModulesPathPrefix + process.env.path;
32-
} else if (process.env.PATH !== undefined) {
32+
}
33+
else if (process.env.PATH !== undefined) {
3334
process.env.PATH = nodeModulesPathPrefix + process.env.PATH;
3435
}
3536

@@ -312,13 +313,15 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
312313
if (useDebugMode) {
313314
if (opts.inlineSourceMap) {
314315
options += " --inlineSourceMap --inlineSources";
315-
} else {
316+
}
317+
else {
316318
options += " -sourcemap";
317319
if (!opts.noMapRoot) {
318320
options += " -mapRoot file:///" + path.resolve(path.dirname(outFile));
319321
}
320322
}
321-
} else {
323+
}
324+
else {
322325
options += " --newLine LF";
323326
}
324327

@@ -748,7 +751,8 @@ function exec(cmd, completeHandler, errorHandler) {
748751
ex.addListener("error", function (e, status) {
749752
if (errorHandler) {
750753
errorHandler(e, status);
751-
} else {
754+
}
755+
else {
752756
fail("Process exited with code " + status);
753757
}
754758
});
@@ -1006,21 +1010,32 @@ task("baseline-accept", function () {
10061010

10071011
function acceptBaseline(sourceFolder, targetFolder) {
10081012
console.log('Accept baselines from ' + sourceFolder + ' to ' + targetFolder);
1009-
var files = fs.readdirSync(sourceFolder);
10101013
var deleteEnding = '.delete';
1011-
for (var i in files) {
1012-
var filename = files[i];
1013-
var fullLocalPath = path.join(sourceFolder, filename);
1014-
if (fs.statSync(fullLocalPath).isFile()) {
1015-
if (filename.substr(filename.length - deleteEnding.length) === deleteEnding) {
1016-
filename = filename.substr(0, filename.length - deleteEnding.length);
1017-
fs.unlinkSync(path.join(targetFolder, filename));
1018-
} else {
1019-
var target = path.join(targetFolder, filename);
1020-
if (fs.existsSync(target)) {
1021-
fs.unlinkSync(target);
1014+
1015+
acceptBaselineFolder(sourceFolder, targetFolder);
1016+
1017+
function acceptBaselineFolder(sourceFolder, targetFolder) {
1018+
var files = fs.readdirSync(sourceFolder);
1019+
1020+
for (var i in files) {
1021+
var filename = files[i];
1022+
var fullLocalPath = path.join(sourceFolder, filename);
1023+
var stat = fs.statSync(fullLocalPath);
1024+
if (stat.isFile()) {
1025+
if (filename.substr(filename.length - deleteEnding.length) === deleteEnding) {
1026+
filename = filename.substr(0, filename.length - deleteEnding.length);
1027+
fs.unlinkSync(path.join(targetFolder, filename));
10221028
}
1023-
fs.renameSync(path.join(sourceFolder, filename), target);
1029+
else {
1030+
var target = path.join(targetFolder, filename);
1031+
if (fs.existsSync(target)) {
1032+
fs.unlinkSync(target);
1033+
}
1034+
fs.renameSync(path.join(sourceFolder, filename), target);
1035+
}
1036+
}
1037+
else if (stat.isDirectory()) {
1038+
acceptBaselineFolder(fullLocalPath, path.join(targetFolder, filename));
10241039
}
10251040
}
10261041
}
@@ -1177,43 +1192,16 @@ function spawnLintWorker(files, callback) {
11771192
}
11781193

11791194
desc("Runs tslint on the compiler sources. Optional arguments are: f[iles]=regex");
1180-
task("lint", ["build-rules"], function () {
1195+
task("lint", ["build-rules"], () => {
11811196
if (fold.isTravis()) console.log(fold.start("lint"));
1182-
var startTime = mark();
1183-
var failed = 0;
1184-
var fileMatcher = RegExp(process.env.f || process.env.file || process.env.files || "");
1185-
var done = {};
1186-
for (var i in lintTargets) {
1187-
var target = lintTargets[i];
1188-
if (!done[target] && fileMatcher.test(target)) {
1189-
done[target] = fs.statSync(target).size;
1190-
}
1191-
}
1192-
1193-
var workerCount = (process.env.workerCount && +process.env.workerCount) || os.cpus().length;
1194-
1195-
var names = Object.keys(done).sort(function (namea, nameb) {
1196-
return done[namea] - done[nameb];
1197+
const fileMatcher = process.env.f || process.env.file || process.env.files;
1198+
const files = fileMatcher
1199+
? `src/**/${fileMatcher}`
1200+
: "Gulpfile.ts 'src/**/*.ts' --exclude src/lib/es5.d.ts --exclude 'src/lib/*.generated.d.ts'";
1201+
const cmd = `node node_modules/tslint/bin/tslint ${files} --format stylish`;
1202+
console.log("Linting: " + cmd);
1203+
jake.exec([cmd], { interactive: true }, () => {
1204+
if (fold.isTravis()) console.log(fold.end("lint"));
1205+
complete();
11971206
});
1198-
1199-
for (var i = 0; i < workerCount; i++) {
1200-
spawnLintWorker(names, finished);
1201-
}
1202-
1203-
var completed = 0;
1204-
var failures = 0;
1205-
function finished(fails) {
1206-
completed++;
1207-
failures += fails;
1208-
if (completed === workerCount) {
1209-
measure(startTime);
1210-
if (fold.isTravis()) console.log(fold.end("lint"));
1211-
if (failures > 0) {
1212-
fail('Linter errors.', failed);
1213-
}
1214-
else {
1215-
complete();
1216-
}
1217-
}
1218-
}
1219-
}, { async: true });
1207+
});

lib/tsc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53977,7 +53977,7 @@ var ts;
5397753977
var padding = makePadding(marginLength);
5397853978
output.push(getDiagnosticText(ts.Diagnostics.Examples_Colon_0, makePadding(marginLength - examplesLength) + "tsc hello.ts") + ts.sys.newLine);
5397953979
output.push(padding + "tsc --outFile file.js file.ts" + ts.sys.newLine);
53980-
output.push(padding + "tsc @args.txt" + ts.sys.newLine);
53980+
output.push(padding + "tsc --project tsconfig.json" + ts.sys.newLine);
5398153981
output.push(ts.sys.newLine);
5398253982
output.push(getDiagnosticText(ts.Diagnostics.Options_Colon) + ts.sys.newLine);
5398353983
var optsList = ts.filter(ts.optionDeclarations.slice(), function (v) { return !v.experimental; });

0 commit comments

Comments
 (0)