Skip to content

Commit

Permalink
Merge branch 'master' into Fix8634
Browse files Browse the repository at this point in the history
  • Loading branch information
mhegazy committed May 23, 2016
2 parents 167c3fb + a28501e commit 6438fd5
Show file tree
Hide file tree
Showing 114 changed files with 90,281 additions and 22,922 deletions.
101 changes: 54 additions & 47 deletions Jakefile.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ var harnessSources = harnessCoreSources.concat([
"protocol.d.ts",
"session.ts",
"client.ts",
"editorServices.ts",
"editorServices.ts"
].map(function (f) {
return path.join(serverDirectory, f);
}));
Expand All @@ -174,7 +174,7 @@ var es2015LibrarySources = [
"es2015.proxy.d.ts",
"es2015.reflect.d.ts",
"es2015.symbol.d.ts",
"es2015.symbol.wellknown.d.ts",
"es2015.symbol.wellknown.d.ts"
];

var es2015LibrarySourceMap = es2015LibrarySources.map(function(source) {
Expand All @@ -183,34 +183,34 @@ var es2015LibrarySourceMap = es2015LibrarySources.map(function(source) {

var es2016LibrarySource = [ "es2016.array.include.d.ts" ];

var es2016LibrarySourceMap = es2016LibrarySource.map(function(source) {
var es2016LibrarySourceMap = es2016LibrarySource.map(function (source) {
return { target: "lib." + source, sources: ["header.d.ts", source] };
})
});

var es2017LibrarySource = ["es2017.object.d.ts"];

var es2017LibrarySourceMap = es2017LibrarySource.map(function(source) {
var es2017LibrarySourceMap = es2017LibrarySource.map(function (source) {
return { target: "lib." + source, sources: ["header.d.ts", source] };
})
});

var hostsLibrarySources = ["dom.generated.d.ts", "webworker.importscripts.d.ts", "scripthost.d.ts"]
var hostsLibrarySources = ["dom.generated.d.ts", "webworker.importscripts.d.ts", "scripthost.d.ts"];

var librarySourceMap = [
// Host library
{ target: "lib.dom.d.ts", sources: ["header.d.ts", "dom.generated.d.ts"], },
{ target: "lib.dom.iterable.d.ts", sources: ["header.d.ts", "dom.iterable.d.ts"], },
{ target: "lib.webworker.d.ts", sources: ["header.d.ts", "webworker.generated.d.ts"], },
{ target: "lib.scripthost.d.ts", sources: ["header.d.ts", "scripthost.d.ts"], },
{ target: "lib.dom.d.ts", sources: ["header.d.ts", "dom.generated.d.ts"] },
{ target: "lib.dom.iterable.d.ts", sources: ["header.d.ts", "dom.iterable.d.ts"] },
{ target: "lib.webworker.d.ts", sources: ["header.d.ts", "webworker.generated.d.ts"] },
{ target: "lib.scripthost.d.ts", sources: ["header.d.ts", "scripthost.d.ts"] },

// JavaScript library
{ target: "lib.es5.d.ts", sources: ["header.d.ts", "es5.d.ts"] },
{ target: "lib.es2015.d.ts", sources: ["header.d.ts", "es2015.d.ts"] },
{ target: "lib.es2016.d.ts", sources: ["header.d.ts", "es2016.d.ts"] },
{ target: "lib.es2017.d.ts", sources: ["header.d.ts", "es2017.d.ts"] },

// JavaScript + all host library
{ target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources), },
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts"), },
{ target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources) },
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") }
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap);

var libraryTargets = librarySourceMap.map(function (f) {
Expand Down Expand Up @@ -251,7 +251,7 @@ function concatenateFiles(destinationFile, sourceFiles) {
}

var useDebugMode = true;
var host = (process.env.TYPESCRIPT_HOST || process.env.host || "node");
var host = process.env.TYPESCRIPT_HOST || process.env.host || "node";
var compilerFilename = "tsc.js";
var LKGCompiler = path.join(LKGDirectory, compilerFilename);
var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
Expand Down Expand Up @@ -300,7 +300,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
options += " --out " + outFile;
}
else {
options += " --module commonjs"
options += " --module commonjs";
}

if(opts.noResolve) {
Expand All @@ -315,7 +315,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
}

if (opts.stripInternal) {
options += " --stripInternal"
options += " --stripInternal";
}

var cmd = host + " " + compilerPath + " " + options + " ";
Expand Down Expand Up @@ -453,9 +453,9 @@ file(scriptsTsdJson);

task("tsd-scripts", [scriptsTsdJson], function () {
var cmd = "tsd --config " + scriptsTsdJson + " install";
console.log(cmd)
console.log(cmd);
exec(cmd);
}, { async: true })
}, { async: true });

var importDefinitelyTypedTestsDirectory = path.join(scriptsDirectory, "importDefinitelyTypedTests");
var importDefinitelyTypedTestsJs = path.join(importDefinitelyTypedTestsDirectory, "importDefinitelyTypedTests.js");
Expand Down Expand Up @@ -525,9 +525,10 @@ compileFile(servicesFileInBrowserTest, servicesSources,[builtLocalDirectory, cop
var serverFile = path.join(builtLocalDirectory, "tsserver.js");
compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true);

var lsslFile = path.join(builtLocalDirectory, "tslssl.js");
var tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js");
var tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibrary.d.ts");
compileFile(
lsslFile,
tsserverLibraryFile,
languageServiceLibrarySources,
[builtLocalDirectory, copyright].concat(languageServiceLibrarySources),
/*prefixes*/ [copyright],
Expand All @@ -536,7 +537,7 @@ compileFile(

// Local target to build the language service server library
desc("Builds language service server library");
task("lssl", [lsslFile]);
task("lssl", [tsserverLibraryFile, tsserverLibraryDefinitionFile]);

// Local target to build the compiler and services
desc("Builds the full compiler and services");
Expand Down Expand Up @@ -595,8 +596,8 @@ task("generate-spec", [specMd]);

// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
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].concat(libraryTargets);
task("LKG", ["clean", "release", "local", "lssl"].concat(libraryTargets), function() {
var expectedFiles = [tscFile, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile].concat(libraryTargets);
var missingFiles = expectedFiles.filter(function (f) {
return !fs.existsSync(f);
});
Expand All @@ -622,7 +623,7 @@ directory(builtLocalDirectory);
var run = path.join(builtLocalDirectory, "run.js");
compileFile(run, harnessSources, [builtLocalDirectory, tscFile].concat(libraryTargets).concat(harnessSources), [], /*useBuiltCompiler:*/ true);

var internalTests = "internal/"
var internalTests = "internal/";

var localBaseline = "tests/baselines/local/";
var refBaseline = "tests/baselines/reference/";
Expand Down Expand Up @@ -709,7 +710,7 @@ function runConsoleTests(defaultReporter, defaultSubsets) {
testTimeout = 100000;
}

colors = process.env.colors || process.env.color
colors = process.env.colors || process.env.color;
colors = colors ? ' --no-colors ' : ' --colors ';
reporter = process.env.reporter || process.env.r || defaultReporter;
var lintFlag = process.env.lint !== 'false';
Expand All @@ -718,7 +719,7 @@ function runConsoleTests(defaultReporter, defaultSubsets) {
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
var subsetRegexes;
if(defaultSubsets.length === 0) {
subsetRegexes = [tests]
subsetRegexes = [tests];
}
else {
var subsets = tests ? tests.split("|") : defaultSubsets;
Expand All @@ -729,19 +730,20 @@ function runConsoleTests(defaultReporter, defaultSubsets) {
tests = subsetRegex ? ' -g "' + subsetRegex + '"' : '';
var cmd = "mocha" + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
console.log(cmd);
exec(cmd, function () {
function finish() {
deleteTemporaryProjectOutput();
complete();
}
exec(cmd, function () {
if (lintFlag && i === 0) {
var lint = jake.Task['lint'];
lint.addListener('complete', function () {
complete();
});
lint.invoke();
}
else {
complete();
}
});
finish();
}, finish);
});
}

Expand All @@ -764,8 +766,8 @@ task("generate-code-coverage", ["tests", builtLocalDirectory], function () {
}, { async: true });

// Browser tests
var nodeServerOutFile = 'tests/webTestServer.js'
var nodeServerInFile = 'tests/webTestServer.ts'
var nodeServerOutFile = "tests/webTestServer.js";
var nodeServerInFile = "tests/webTestServer.ts";
compileFile(nodeServerOutFile, [nodeServerInFile], [builtLocalDirectory, tscFile], [], /*useBuiltCompiler:*/ true, { noOutFile: true });

desc("Runs browserify on run.js to produce a file suitable for running tests in the browser");
Expand All @@ -777,7 +779,7 @@ task("browserify", ["tests", builtLocalDirectory, nodeServerOutFile], function()
desc("Runs the tests using the built run.js file like 'jake runtests'. Syntax is jake runtests-browser. Additional optional parameters tests=[regex], port=, browser=[chrome|IE]");
task("runtests-browser", ["tests", "browserify", builtLocalDirectory, servicesFileInBrowserTest], function() {
cleanTestDirs();
host = "node"
host = "node";
port = process.env.port || process.env.p || '8888';
browser = process.env.browser || process.env.b || "IE";
tests = process.env.test || process.env.tests || process.env.t;
Expand All @@ -791,13 +793,13 @@ task("runtests-browser", ["tests", "browserify", builtLocalDirectory, servicesFi
}

tests = tests ? tests : '';
var cmd = host + " tests/webTestServer.js " + port + " " + browser + " " + tests
var cmd = host + " tests/webTestServer.js " + port + " " + browser + " " + tests;
console.log(cmd);
exec(cmd);
}, {async: true});

function getDiffTool() {
var program = process.env['DIFF']
var program = process.env['DIFF'];
if (!program) {
fail("Add the 'DIFF' environment variable to the path of the program you want to use.");
}
Expand Down Expand Up @@ -826,11 +828,11 @@ task("tests-debug", ["setDebugMode", "tests"]);
// Makes the test results the new baseline
desc("Makes the most recent test results the new baseline, overwriting the old baseline");
task("baseline-accept", function(hardOrSoft) {
if (!hardOrSoft || hardOrSoft == "hard") {
if (!hardOrSoft || hardOrSoft === "hard") {
jake.rmRf(refBaseline);
fs.renameSync(localBaseline, refBaseline);
}
else if (hardOrSoft == "soft") {
else if (hardOrSoft === "soft") {
var files = jake.readdirR(localBaseline);
for (var i in files) {
jake.cpR(files[i], refBaseline);
Expand Down Expand Up @@ -909,14 +911,14 @@ task("update-sublime", ["local", serverFile], function() {
});

var tslintRuleDir = "scripts/tslint";
var tslintRules = ([
var tslintRules = [
"nextLineRule",
"preferConstRule",
"booleanTriviaRule",
"typeOperatorSpacingRule",
"noInOperatorRule",
"noIncrementDecrementRule"
]);
];
var tslintRulesFiles = tslintRules.map(function(p) {
return path.join(tslintRuleDir, p + ".ts");
});
Expand All @@ -941,7 +943,7 @@ function getLinterOptions() {

function lintFileContents(options, path, contents) {
var ll = new Linter(path, contents, options);
console.log("Linting '" + path + "'.")
console.log("Linting '" + path + "'.");
return ll.lint();
}

Expand All @@ -962,6 +964,7 @@ function lintFileAsync(options, path, cb) {

var servicesLintTargets = [
"navigateTo.ts",
"navigationBar.ts",
"outliningElementsCollector.ts",
"patternMatcher.ts",
"services.ts",
Expand All @@ -976,15 +979,19 @@ var lintTargets = compilerSources
.concat(tslintRulesFiles)
.concat(servicesLintTargets);

desc("Runs tslint on the compiler sources");
desc("Runs tslint on the compiler sources. Optional arguments are: f[iles]=regex");
task("lint", ["build-rules"], function() {
var lintOptions = getLinterOptions();
var failed = 0;
var fileMatcher = RegExp(process.env.f || process.env.file || process.env.files || "");
for (var i in lintTargets) {
var result = lintFile(lintOptions, lintTargets[i]);
if (result.failureCount > 0) {
console.log(result.output);
failed += result.failureCount;
var target = lintTargets[i];
if (fileMatcher.test(target)) {
var result = lintFile(lintOptions, target);
if (result.failureCount > 0) {
console.log(result.output);
failed += result.failureCount;
}
}
}
if (failed > 0) {
Expand Down
Loading

0 comments on commit 6438fd5

Please sign in to comment.