mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-11 17:41:26 -06:00
Fix jake task, style/const in script.
This commit is contained in:
parent
37ee17d40d
commit
5a2a7021fa
26
Jakefile.js
26
Jakefile.js
@ -206,6 +206,9 @@ function concatenateFiles(destinationFile, sourceFiles) {
|
||||
var useDebugMode = true;
|
||||
var host = (process.env.host || process.env.TYPESCRIPT_HOST || "node");
|
||||
var compilerFilename = "tsc.js";
|
||||
var LKGCompiler = path.join(LKGDirectory, compilerFilename);
|
||||
var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
|
||||
|
||||
/* Compiles a file from a list of sources
|
||||
* @param outFile: the target file name
|
||||
* @param sources: an array of the names of the source files
|
||||
@ -220,7 +223,7 @@ var compilerFilename = "tsc.js";
|
||||
*/
|
||||
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile, generateDeclarations, outDir, preserveConstEnums, keepComments, noResolve, stripInternal, callback) {
|
||||
file(outFile, prereqs, function() {
|
||||
var dir = useBuiltCompiler ? builtLocalDirectory : LKGDirectory;
|
||||
var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler;
|
||||
var options = "--module commonjs --noImplicitAny --noEmitOnError";
|
||||
|
||||
// Keep comments when specifically requested
|
||||
@ -257,7 +260,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
|
||||
options += " --stripInternal"
|
||||
}
|
||||
|
||||
var cmd = host + " " + dir + compilerFilename + " " + options + " ";
|
||||
var cmd = host + " " + compilerPath + " " + options + " ";
|
||||
cmd = cmd + sources.join(" ");
|
||||
console.log(cmd + "\n");
|
||||
|
||||
@ -328,7 +331,7 @@ compileFile(processDiagnosticMessagesJs,
|
||||
|
||||
// The generated diagnostics map; built for the compiler and for the 'generate-diagnostics' task
|
||||
file(diagnosticInfoMapTs, [processDiagnosticMessagesJs, diagnosticMessagesJson], function () {
|
||||
var cmd = "node " + processDiagnosticMessagesJs + " " + diagnosticMessagesJson;
|
||||
var cmd = host + " " + processDiagnosticMessagesJs + " " + diagnosticMessagesJson;
|
||||
console.log(cmd);
|
||||
var ex = jake.createExec([cmd]);
|
||||
// Add listeners for output and error
|
||||
@ -374,7 +377,7 @@ task("setDebugMode", function() {
|
||||
});
|
||||
|
||||
task("configure-nightly", [configureNightlyJs], function() {
|
||||
var cmd = "node " + configureNightlyJs + " " + packageJson + " " + programTs;
|
||||
var cmd = host + " " + configureNightlyJs + " " + packageJson + " " + programTs;
|
||||
console.log(cmd);
|
||||
exec(cmd);
|
||||
}, { async: true });
|
||||
@ -399,13 +402,18 @@ var importDefinitelyTypedTestsDirectory = path.join(scriptsDirectory, "importDef
|
||||
var importDefinitelyTypedTestsJs = path.join(importDefinitelyTypedTestsDirectory, "importDefinitelyTypedTests.js");
|
||||
var importDefinitelyTypedTestsTs = path.join(importDefinitelyTypedTestsDirectory, "importDefinitelyTypedTests.ts");
|
||||
|
||||
file(importDefinitelyTypedTestsJs);
|
||||
file(importDefinitelyTypedTestsTs, ["tsd-scripts", importDefinitelyTypedTestsJs])
|
||||
task("importDefinitelyTyped", importDefinitelyTypedTestsTs, function () {
|
||||
var cmd = "node " + importDefinitelyTypedTestsJs + " ./ ../DefinitelyTyped";
|
||||
file(importDefinitelyTypedTestsTs);
|
||||
file(importDefinitelyTypedTestsJs, ["tsd-scripts", importDefinitelyTypedTestsTs], function () {
|
||||
var cmd = host + " " + LKGCompiler + " -p " + importDefinitelyTypedTestsDirectory;
|
||||
console.log(cmd);
|
||||
exec(cmd);
|
||||
}, { async: true })
|
||||
}, { async: true });
|
||||
|
||||
task("importDefinitelyTypedTests", [importDefinitelyTypedTestsJs], function () {
|
||||
var cmd = host + " " + importDefinitelyTypedTestsJs + " ./ ../DefinitelyTyped";
|
||||
console.log(cmd);
|
||||
exec(cmd);
|
||||
}, { async: true });
|
||||
|
||||
// Local target to build the compiler and services
|
||||
var tscFile = path.join(builtLocalDirectory, compilerFilename);
|
||||
|
||||
@ -107,9 +107,12 @@ function importDefinitelyTypedTests(tscPath: string, rwcTestPath: string, defini
|
||||
throw err;
|
||||
}
|
||||
|
||||
// When you just want to test the script out on one or two files,
|
||||
// just add a line like the following:
|
||||
//
|
||||
// .filter(d => d.indexOf("sipml") >= 0 )
|
||||
subDirectories
|
||||
.filter(d => ["_infrastructure", "node_modules", ".git"].indexOf(d) < 0)
|
||||
// .filter(i => i.indexOf("sipml") >= 0 ) // Uncomment when you want to test :)
|
||||
.filter(i => fs.statSync(path.join(definitelyTypedRoot, i)).isDirectory())
|
||||
.forEach(d => {
|
||||
const directoryPath = path.join(definitelyTypedRoot, d);
|
||||
@ -137,7 +140,7 @@ function importDefinitelyTypedTests(tscPath: string, rwcTestPath: string, defini
|
||||
|
||||
if (testFiles.length === 0) {
|
||||
// no test files but multiple d.ts's, e.g. winjs
|
||||
let regexp = new RegExp(d + "(([-][0-9])|([\.]d[\.]ts))");
|
||||
const regexp = new RegExp(d + "(([-][0-9])|([\.]d[\.]ts))");
|
||||
if (tsFiles.length > 1 && tsFiles.every(t => filePathEndsWith(t, ".d.ts") && regexp.test(t))) {
|
||||
for (const fileName of tsFiles) {
|
||||
importDefinitelyTypedTest(tscPath, rwcTestPath, path.basename(fileName, ".d.ts"), [fileName], paramFile);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user