mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-12 03:20:56 -06:00
Address CR feedback; refactor out tsc invocation
This commit is contained in:
parent
7b2579964c
commit
13ba516a7a
@ -3,16 +3,23 @@
|
||||
import cp = require('child_process');
|
||||
import fs = require('fs');
|
||||
|
||||
// Slice off 'node bisect-test.js' from the commandline args
|
||||
var args = process.argv.slice(2);
|
||||
|
||||
function tsc(tscArgs: string, onExit: (exitCode: number) => void) {
|
||||
var tsc = cp.exec('node built/local/tsc.js ' + tscArgs,() => void 0);
|
||||
tsc.on('close', tscExitCode => {
|
||||
onExit(tscExitCode);
|
||||
});
|
||||
}
|
||||
|
||||
var jake = cp.exec('jake clean local', () => void 0);
|
||||
jake.on('close', code => {
|
||||
if (code === 0) {
|
||||
jake.on('close', jakeExitCode => {
|
||||
if (jakeExitCode === 0) {
|
||||
// See what we're being asked to do
|
||||
if (args[1] === 'compiles' || args[1] === '!compiles') {
|
||||
var tsc = cp.exec('node built/local/tsc.js ' + args[0], () => void 0);
|
||||
tsc.on('close', tscCode => {
|
||||
if ((tscCode === 0) === (args[1] === 'compiles')) {
|
||||
tsc(args[0], tscExitCode => {
|
||||
if ((tscExitCode === 0) === (args[1] === 'compiles')) {
|
||||
console.log('Good');
|
||||
process.exit(0); // Good
|
||||
} else {
|
||||
@ -21,8 +28,7 @@ jake.on('close', code => {
|
||||
}
|
||||
});
|
||||
} else if (args[1] === 'emits' || args[1] === '!emits') {
|
||||
var tsc = cp.exec('node built/local/tsc.js ' + args[0], () => void 0);
|
||||
tsc.on('close', tscCode => {
|
||||
tsc(args[0], tscExitCode => {
|
||||
fs.readFile(args[2], 'utf-8', (err, data) => {
|
||||
var doesContains = data.indexOf(args[3]) >= 0;
|
||||
if (doesContains === (args[1] === 'emits')) {
|
||||
@ -38,10 +44,12 @@ jake.on('close', code => {
|
||||
console.log('Unknown command line arguments.');
|
||||
console.log('Usage (compile errors): git bisect run scripts\bisect.js "foo.ts --module amd" compiles');
|
||||
console.log('Usage (emit check): git bisect run scripts\bisect.js bar.ts emits bar.js "_this = this"');
|
||||
// Aborts the 'git bisect run' process
|
||||
process.exit(-1);
|
||||
}
|
||||
} else {
|
||||
// Build failed
|
||||
// Compiler build failed; skip this commit
|
||||
console.log('Skip');
|
||||
process.exit(125); // bisect skip
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user