Skip to content

Commit cb6852a

Browse files
author
jbondc
committed
Code review
1 parent 3f97fe8 commit cb6852a

1 file changed

Lines changed: 21 additions & 9 deletions

File tree

Jakefile

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ var thirdParty = "ThirdPartyNoticeText.txt";
2424
var nodeModulesPathPrefix = path.resolve("./node_modules/.bin/") + path.delimiter;
2525
if (process.env.path !== undefined) {
2626
process.env.path = nodeModulesPathPrefix + process.env.path;
27-
} else if (process.env.PATH !== undefined) {
27+
}
28+
else if (process.env.PATH !== undefined) {
2829
process.env.PATH = nodeModulesPathPrefix + process.env.PATH;
2930
}
3031

@@ -181,7 +182,8 @@ function concatenateFiles(destinationFile, sourceFiles) {
181182
var useDebugMode = true;
182183
var host = (process.env.host || process.env.TYPESCRIPT_HOST || "node");
183184
var compilerFilename = "tsc.js";
184-
/* Compiles a file from a list of sources
185+
186+
/* Compiles a file from a list of sources
185187
* @param outFile: the target file name
186188
* @param sources: an array of the names of the source files
187189
* @param prereqs: prerequisite tasks to compiling the file
@@ -192,8 +194,9 @@ var compilerFilename = "tsc.js";
192194
* @param outDir: true to compile using --outDir
193195
* @param keepComments: false to compile using --removeComments
194196
* @param callback: a function to execute after the compilation process ends
197+
* @async
195198
*/
196-
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile, generateDeclarations, outDir, preserveConstEnums, keepComments, noResolve, stripInternal, callback) {
199+
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile, generateDeclarations, outDir, preserveConstEnums, keepComments, noResolve, stripInternal, callback) {
197200
file(outFile, prereqs, function() {
198201
var dir = useBuiltCompiler ? builtLocalDirectory : LKGDirectory;
199202
var options = "--module commonjs -noImplicitAny";
@@ -243,7 +246,8 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
243246

244247
if (callback) {
245248
callback();
246-
} else {
249+
}
250+
else {
247251
complete();
248252
}
249253
}, /* errorHandler */ function() {
@@ -294,9 +298,7 @@ compileFile(processDiagnosticMessagesJs,
294298
file(diagnosticInfoMapTs, [processDiagnosticMessagesJs, diagnosticMessagesJson], function () {
295299
var cmd = "node " + processDiagnosticMessagesJs + " " + diagnosticMessagesJson;
296300

297-
exec(cmd, function() {
298-
complete();
299-
});
301+
exec(cmd);
300302
}, {async: true})
301303

302304
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")
455457
desc("Builds the test infrastructure using the built compiler");
456458
task("tests", ["local", run].concat(libraryTargets));
457459

460+
/* Executes a command
461+
* @param cmd: command to execute
462+
* @param completeHandler?: a function to execute after the command ends
463+
* @param errorHandler?: a function to execute if an error occurs
464+
* @async
465+
*/
458466
function exec(cmd, completeHandler, errorHandler) {
459467
console.log(cmd);
460468
var ex = jake.createExec([cmd], {windowsVerbatimArguments: true, interactive: true});
461469
ex.addListener("cmdEnd", function() {
462470
if (completeHandler) {
463471
completeHandler();
464-
} else {
472+
}
473+
else {
465474
complete();
466475
}
467476
});
468-
ex.addListener("error", errorHandler ? errorHandler : function(e, status) {
477+
ex.addListener("error", errorHandler || function(e, status) {
469478
fail("Process exited with code " + status);
470479
})
471480

@@ -495,6 +504,9 @@ function writeTestConfigFile(tests, testConfigFile) {
495504
fs.writeFileSync('test.config', testConfigContents);
496505
}
497506

507+
/* Removes project output
508+
* @async
509+
*/
498510
function deleteTemporaryProjectOutput() {
499511
if (fs.existsSync(path.join(localBaseline, "projectOutput/"))) {
500512
jake.rmRf(path.join(localBaseline, "projectOutput/"));

0 commit comments

Comments
 (0)