Code review
This commit is contained in:
parent
3f97fe875f
commit
cb6852af73
1 changed files with 21 additions and 9 deletions
26
Jakefile
26
Jakefile
|
@ -24,7 +24,8 @@ var thirdParty = "ThirdPartyNoticeText.txt";
|
|||
var nodeModulesPathPrefix = path.resolve("./node_modules/.bin/") + path.delimiter;
|
||||
if (process.env.path !== undefined) {
|
||||
process.env.path = nodeModulesPathPrefix + process.env.path;
|
||||
} else if (process.env.PATH !== undefined) {
|
||||
}
|
||||
else if (process.env.PATH !== undefined) {
|
||||
process.env.PATH = nodeModulesPathPrefix + process.env.PATH;
|
||||
}
|
||||
|
||||
|
@ -181,6 +182,7 @@ function concatenateFiles(destinationFile, sourceFiles) {
|
|||
var useDebugMode = true;
|
||||
var host = (process.env.host || process.env.TYPESCRIPT_HOST || "node");
|
||||
var compilerFilename = "tsc.js";
|
||||
|
||||
/* 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
|
||||
|
@ -192,6 +194,7 @@ var compilerFilename = "tsc.js";
|
|||
* @param outDir: true to compile using --outDir
|
||||
* @param keepComments: false to compile using --removeComments
|
||||
* @param callback: a function to execute after the compilation process ends
|
||||
* @async
|
||||
*/
|
||||
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile, generateDeclarations, outDir, preserveConstEnums, keepComments, noResolve, stripInternal, callback) {
|
||||
file(outFile, prereqs, function() {
|
||||
|
@ -243,7 +246,8 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
|
|||
|
||||
if (callback) {
|
||||
callback();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
complete();
|
||||
}
|
||||
}, /* errorHandler */ function() {
|
||||
|
@ -294,9 +298,7 @@ compileFile(processDiagnosticMessagesJs,
|
|||
file(diagnosticInfoMapTs, [processDiagnosticMessagesJs, diagnosticMessagesJson], function () {
|
||||
var cmd = "node " + processDiagnosticMessagesJs + " " + diagnosticMessagesJson;
|
||||
|
||||
exec(cmd, function() {
|
||||
complete();
|
||||
});
|
||||
exec(cmd);
|
||||
}, {async: true})
|
||||
|
||||
desc("Generates a diagnostic file in TypeScript based on an input JSON file");
|
||||
|
@ -455,17 +457,24 @@ var refTest262Baseline = path.join(internalTests, "baselines/test262/reference")
|
|||
desc("Builds the test infrastructure using the built compiler");
|
||||
task("tests", ["local", run].concat(libraryTargets));
|
||||
|
||||
/* Executes a command
|
||||
* @param cmd: command to execute
|
||||
* @param completeHandler?: a function to execute after the command ends
|
||||
* @param errorHandler?: a function to execute if an error occurs
|
||||
* @async
|
||||
*/
|
||||
function exec(cmd, completeHandler, errorHandler) {
|
||||
console.log(cmd);
|
||||
var ex = jake.createExec([cmd], {windowsVerbatimArguments: true, interactive: true});
|
||||
ex.addListener("cmdEnd", function() {
|
||||
if (completeHandler) {
|
||||
completeHandler();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
complete();
|
||||
}
|
||||
});
|
||||
ex.addListener("error", errorHandler ? errorHandler : function(e, status) {
|
||||
ex.addListener("error", errorHandler || function(e, status) {
|
||||
fail("Process exited with code " + status);
|
||||
})
|
||||
|
||||
|
@ -495,6 +504,9 @@ function writeTestConfigFile(tests, testConfigFile) {
|
|||
fs.writeFileSync('test.config', testConfigContents);
|
||||
}
|
||||
|
||||
/* Removes project output
|
||||
* @async
|
||||
*/
|
||||
function deleteTemporaryProjectOutput() {
|
||||
if (fs.existsSync(path.join(localBaseline, "projectOutput/"))) {
|
||||
jake.rmRf(path.join(localBaseline, "projectOutput/"));
|
||||
|
|
Loading…
Reference in a new issue