Skip to content

Commit

Permalink
Merge branch 'master' into typepredicate
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Hanson committed Oct 20, 2017
2 parents d52812f + 1ea1254 commit b384c9c
Show file tree
Hide file tree
Showing 691 changed files with 134,517 additions and 113,641 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,4 @@ internal/
!tests/baselines/reference/project/nodeModules*/**/*
.idea
yarn.lock
package-lock.json
.parallelperf.*
13 changes: 12 additions & 1 deletion .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -276,4 +276,15 @@ Francois Wouts <[email protected]>
Jan Melcher <[email protected]> Jan Melcher <[email protected]>
Matt Mitchell <[email protected]>
Maxwell Paul Brickner <[email protected]>
Tycho Grouwstra <[email protected]>
Tycho Grouwstra <[email protected]>
Adrian Leonhard <[email protected]>
Alex Chugaev <[email protected]>
Henry Mercer <[email protected]>
Ivan Enderlin <[email protected]>
Joe Calzaretta <[email protected]>
Magnus Kulke <[email protected]>
Stas Vilchik <[email protected]>
Taras Mankovski <[email protected]>
Thomas den Hollander <[email protected]>
Vakhurin Sergey <[email protected]>
Zeeshan Ahmed <[email protected]>
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ branches:
only:
- master
- release-2.5
- release-2.6

install:
- npm uninstall typescript --no-save
Expand Down
11 changes: 11 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ TypeScript is authored by:
* Abubaker Bashir
* Adam Freidin
* Adi Dahiya
* Adrian Leonhard
* Ahmad Farid
* Akshar Patel
* Alex Chugaev
* Alex Eagle
* Alexander Kuvaev
* Alexander Rusakov
Expand Down Expand Up @@ -105,13 +107,15 @@ TypeScript is authored by:
* Halasi Tamás
* Harald Niesche
* Hendrik Liebau
* Henry Mercer
* Herrington Darkholme
* Homa Wong
* Iain Monro
* Igor Novozhilov
* Ika
* Ingvar Stepanyan
* Isiah Meadows
* Ivan Enderlin
* Ivo Gabe de Wolff
* Iwata Hidetaka
* Jakub Młokosiewicz
Expand All @@ -127,6 +131,7 @@ TypeScript is authored by:
* Jeffrey Morlan
* Jesse Schalken
* Jiri Tobisek
* Joe Calzaretta
* Joe Chung
* Joel Day
* Joey Wilson
Expand Down Expand Up @@ -161,6 +166,7 @@ TypeScript is authored by:
* Lucien Greathouse
* Lukas Elmer
* Magnus Hiie
* Magnus Kulke
* Manish Giri
* Marin Marinov
* Marius Schulz
Expand Down Expand Up @@ -232,13 +238,16 @@ TypeScript is authored by:
* Soo Jae Hwang
* Stan Thomas
* Stanislav Sysoev
* Stas Vilchik
* Steve Lucco
* Sudheesh Singanamalla
* Sébastien Arod
* @T18970237136
* @t_
* Taras Mankovski
* Tarik Ozket
* Tetsuharu Ohzeki
* Thomas den Hollander
* Thomas Loubiou
* Tien Hoanhtien
* Tim Lancina
Expand All @@ -253,6 +262,7 @@ TypeScript is authored by:
* TruongSinh Tran-Nguyen
* Tycho Grouwstra
* Vadi Taslim
* Vakhurin Sergey
* Vidar Tonaas Fauske
* Viktor Zozulyak
* Vilic Vane
Expand All @@ -263,5 +273,6 @@ TypeScript is authored by:
* York Yao
* @yortus
* Yuichi Nukiyama
* Zeeshan Ahmed
* Zev Spitz
* Zhengbo Li
63 changes: 39 additions & 24 deletions Gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const cmdLineOptions = minimist(process.argv.slice(2), {
browser: process.env.browser || process.env.b || "IE",
timeout: process.env.timeout || 40000,
tests: process.env.test || process.env.tests || process.env.t,
light: process.env.light || false,
light: process.env.light === undefined || process.env.light !== "false",
reporter: process.env.reporter || process.env.r,
lint: process.env.lint || true,
files: process.env.f || process.env.file || process.env.files || "",
Expand All @@ -87,7 +87,7 @@ function possiblyQuote(cmd: string) {
}

let useDebugMode = true;
let host = cmdLineOptions["host"];
let host = cmdLineOptions.host;

// Constants
const compilerDirectory = "src/compiler/";
Expand Down Expand Up @@ -180,6 +180,23 @@ const libraryTargets = librarySourceMap.map(function(f) {
return path.join(builtLocalDirectory, f.target);
});

/**
* .lcg file is what localization team uses to know what messages to localize.
* The file is always generated in 'enu\diagnosticMessages.generated.json.lcg'
*/
const generatedLCGFile = path.join(builtLocalDirectory, "enu", "diagnosticMessages.generated.json.lcg");

/**
* The localization target produces the two following transformations:
* 1. 'src\loc\lcl\<locale>\diagnosticMessages.generated.json.lcl' => 'built\local\<locale>\diagnosticMessages.generated.json'
* convert localized resources into a .json file the compiler can understand
* 2. 'src\compiler\diagnosticMessages.generated.json' => 'built\local\ENU\diagnosticMessages.generated.json.lcg'
* generate the lcg file (source of messages to localize) from the diagnosticMessages.generated.json
*/
const localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-CN", "zh-TW"].map(function (f) {
return path.join(builtLocalDirectory, f, "diagnosticMessages.generated.json");
}).concat(generatedLCGFile);

for (const i in libraryTargets) {
const entry = librarySourceMap[i];
const target = libraryTargets[i];
Expand Down Expand Up @@ -398,7 +415,6 @@ gulp.task(generateLocalizedDiagnosticMessagesJs, /*help*/ false, [], () => {
});

// Localize diagnostics
const generatedLCGFile = path.join(builtLocalDirectory, "enu", "diagnosticMessages.generated.json.lcg");
gulp.task(generatedLCGFile, [generateLocalizedDiagnosticMessagesJs, diagnosticInfoMapTs], (done) => {
if (fs.existsSync(builtLocalDirectory) && needsUpdate(generatedDiagnosticMessagesJSON, generatedLCGFile)) {
exec(host, [generateLocalizedDiagnosticMessagesJs, lclDirectory, builtLocalDirectory, generatedDiagnosticMessagesJSON], done, done);
Expand Down Expand Up @@ -576,8 +592,7 @@ gulp.task("dontUseDebugMode", /*help*/ false, [], (done) => { useDebugMode = fal
gulp.task("VerifyLKG", /*help*/ false, [], () => {
const expectedFiles = [builtLocalCompiler, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile, typingsInstallerJs, cancellationTokenJs].concat(libraryTargets);
const missingFiles = expectedFiles.
concat(fs.readdirSync(lclDirectory).map(function (d) { return path.join(builtLocalDirectory, d, "diagnosticMessages.generated.json"); })).
concat(generatedLCGFile).
concat(localizationTargets).
filter(f => !fs.existsSync(f));
if (missingFiles.length > 0) {
throw new Error("Cannot replace the LKG unless all built targets are present in directory " + builtLocalDirectory +
Expand Down Expand Up @@ -636,15 +651,15 @@ function restoreSavedNodeEnv() {
}

function runConsoleTests(defaultReporter: string, runInParallel: boolean, done: (e?: any) => void) {
const lintFlag = cmdLineOptions["lint"];
const lintFlag = cmdLineOptions.lint;
cleanTestDirs((err) => {
if (err) { console.error(err); failWithStatus(err, 1); }
let testTimeout = cmdLineOptions["timeout"];
const debug = cmdLineOptions["debug"];
const inspect = cmdLineOptions["inspect"];
const tests = cmdLineOptions["tests"];
const light = cmdLineOptions["light"];
const stackTraceLimit = cmdLineOptions["stackTraceLimit"];
let testTimeout = cmdLineOptions.timeout;
const debug = cmdLineOptions.debug;
const inspect = cmdLineOptions.inspect;
const tests = cmdLineOptions.tests;
const light = cmdLineOptions.light;
const stackTraceLimit = cmdLineOptions.stackTraceLimit;
const testConfigFile = "test.config";
if (fs.existsSync(testConfigFile)) {
fs.unlinkSync(testConfigFile);
Expand All @@ -660,7 +675,7 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
} while (fs.existsSync(taskConfigsFolder));
fs.mkdirSync(taskConfigsFolder);

workerCount = cmdLineOptions["workers"];
workerCount = cmdLineOptions.workers;
}

if (tests || light || taskConfigsFolder) {
Expand All @@ -671,8 +686,8 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
testTimeout = 400000;
}

const colors = cmdLineOptions["colors"];
const reporter = cmdLineOptions["reporter"] || defaultReporter;
const colors = cmdLineOptions.colors;
const reporter = cmdLineOptions.reporter || defaultReporter;

// timeout normally isn"t necessary but Travis-CI has been timing out on compiler baselines occasionally
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
Expand Down Expand Up @@ -860,7 +875,7 @@ function cleanTestDirs(done: (e?: any) => void) {

// used to pass data from jake command line directly to run.js
function writeTestConfigFile(tests: string, light: boolean, taskConfigsFolder?: string, workerCount?: number, stackTraceLimit?: string) {
const testConfigContents = JSON.stringify({ test: tests ? [tests] : undefined, light, workerCount, stackTraceLimit, taskConfigsFolder, noColor: !cmdLineOptions["colors"] });
const testConfigContents = JSON.stringify({ test: tests ? [tests] : undefined, light, workerCount, stackTraceLimit, taskConfigsFolder, noColor: !cmdLineOptions.colors });
console.log("Running tests with config: " + testConfigContents);
fs.writeFileSync("test.config", testConfigContents);
}
Expand All @@ -870,8 +885,8 @@ gulp.task("runtests-browser", "Runs the tests using the built run.js file like '
cleanTestDirs((err) => {
if (err) { console.error(err); done(err); process.exit(1); }
host = "node";
const tests = cmdLineOptions["tests"];
const light = cmdLineOptions["light"];
const tests = cmdLineOptions.tests;
const light = cmdLineOptions.light;
const testConfigFile = "test.config";
if (fs.existsSync(testConfigFile)) {
fs.unlinkSync(testConfigFile);
Expand All @@ -881,8 +896,8 @@ gulp.task("runtests-browser", "Runs the tests using the built run.js file like '
}

const args = [nodeServerOutFile];
if (cmdLineOptions["browser"]) {
args.push(cmdLineOptions["browser"]);
if (cmdLineOptions.browser) {
args.push(cmdLineOptions.browser);
}
if (tests) {
args.push(JSON.stringify(tests));
Expand All @@ -892,13 +907,13 @@ gulp.task("runtests-browser", "Runs the tests using the built run.js file like '
});

gulp.task("generate-code-coverage", "Generates code coverage data via istanbul", ["tests"], (done) => {
const testTimeout = cmdLineOptions["timeout"];
const testTimeout = cmdLineOptions.timeout;
exec("istanbul", ["cover", "node_modules/mocha/bin/_mocha", "--", "-R", "min", "-t", testTimeout.toString(), run], done, done);
});


function getDiffTool() {
const program = process.env["DIFF"];
const program = process.env.DIFF;
if (!program) {
console.error("Add the 'DIFF' environment variable to the path of the program you want to use.");
process.exit(1);
Expand Down Expand Up @@ -1019,7 +1034,7 @@ gulp.task(instrumenterJsPath, /*help*/ false, [servicesFile], () => {
});

gulp.task("tsc-instrumented", "Builds an instrumented tsc.js - run with --test=[testname]", ["local", loggedIOJsPath, instrumenterJsPath, servicesFile], (done) => {
const test = cmdLineOptions["tests"] || "iocapture";
const test = cmdLineOptions.tests || "iocapture";
exec(host, [instrumenterJsPath, "record", test, builtLocalCompiler], done, done);
});

Expand Down Expand Up @@ -1088,7 +1103,7 @@ function spawnLintWorker(files: {path: string}[], callback: (failures: number) =

gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are: --f[iles]=regex", ["build-rules"], () => {
if (fold.isTravis()) console.log(fold.start("lint"));
const fileMatcher = cmdLineOptions["files"];
const fileMatcher = cmdLineOptions.files;
const files = fileMatcher
? `src/**/${fileMatcher}`
: "Gulpfile.ts 'scripts/generateLocalizedDiagnosticMessages.ts' 'scripts/tslint/**/*.ts' 'src/**/*.ts' --exclude src/lib/es5.d.ts --exclude 'src/lib/*.generated.d.ts'";
Expand Down
24 changes: 20 additions & 4 deletions Jakefile.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ var harnessSources = harnessCoreSources.concat([
"symbolWalker.ts",
"languageService.ts",
"publicApi.ts",
"hostNewLineSupport.ts",
].map(function (f) {
return path.join(unittestsDirectory, f);
})).concat([
Expand Down Expand Up @@ -238,6 +239,23 @@ var libraryTargets = librarySourceMap.map(function (f) {
return path.join(builtLocalDirectory, f.target);
});

/**
* .lcg file is what localization team uses to know what messages to localize.
* The file is always generated in 'enu\diagnosticMessages.generated.json.lcg'
*/
var generatedLCGFile = path.join(builtLocalDirectory, "enu", "diagnosticMessages.generated.json.lcg");

/**
* The localization target produces the two following transformations:
* 1. 'src\loc\lcl\<locale>\diagnosticMessages.generated.json.lcl' => 'built\local\<locale>\diagnosticMessages.generated.json'
* convert localized resources into a .json file the compiler can understand
* 2. 'src\compiler\diagnosticMessages.generated.json' => 'built\local\ENU\diagnosticMessages.generated.json.lcg'
* generate the lcg file (source of messages to localize) from the diagnosticMessages.generated.json
*/
var localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-CN", "zh-TW"].map(function (f) {
return path.join(builtLocalDirectory, f);
}).concat(path.dirname(generatedLCGFile));

// Prepends the contents of prefixFile to destinationFile
function prependFile(prefixFile, destinationFile) {
if (!fs.existsSync(prefixFile)) {
Expand Down Expand Up @@ -443,7 +461,6 @@ compileFile(generateLocalizedDiagnosticMessagesJs,
/*useBuiltCompiler*/ false, { noOutFile: true, types: ["node", "xml2js"] });

// Localize diagnostics
var generatedLCGFile = path.join(builtLocalDirectory, "enu", "diagnosticMessages.generated.json.lcg");
file(generatedLCGFile, [generateLocalizedDiagnosticMessagesJs, diagnosticInfoMapTs, generatedDiagnosticMessagesJSON], function () {
var cmd = host + " " + generateLocalizedDiagnosticMessagesJs + " " + lclDirectory + " " + builtLocalDirectory + " " + generatedDiagnosticMessagesJSON;
console.log(cmd);
Expand Down Expand Up @@ -735,8 +752,7 @@ desc("Makes a new LKG out of the built js files");
task("LKG", ["clean", "release", "local"].concat(libraryTargets), function () {
var expectedFiles = [tscFile, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile, cancellationTokenFile, typingsInstallerFile, buildProtocolDts, watchGuardFile].
concat(libraryTargets).
concat(fs.readdirSync(lclDirectory).map(function (d) { return path.join(builtLocalDirectory, d) })).
concat(path.dirname(generatedLCGFile));
concat(localizationTargets);
var missingFiles = expectedFiles.filter(function (f) {
return !fs.existsSync(f);
});
Expand Down Expand Up @@ -855,7 +871,7 @@ function runConsoleTests(defaultReporter, runInParallel) {
var inspect = process.env.inspect || process.env["inspect-brk"] || process.env.i;
var testTimeout = process.env.timeout || defaultTestTimeout;
var tests = process.env.test || process.env.tests || process.env.t;
var light = process.env.light || false;
var light = process.env.light === undefined || process.env.light !== "false";
var stackTraceLimit = process.env.stackTraceLimit;
var testConfigFile = 'test.config';
if (fs.existsSync(testConfigFile)) {
Expand Down
3 changes: 2 additions & 1 deletion issue_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/typescript -->
<!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md -->

**TypeScript Version:** 2.4.0 / nightly (2.5.0-dev.201xxxxx)
<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->
**TypeScript Version:** 2.6.0-dev.201xxxxx

**Code**

Expand Down
Loading

0 comments on commit b384c9c

Please sign in to comment.