@@ -123,6 +123,8 @@ function concatenateFiles(destinationFile, sourceFiles) {
123123}
124124
125125var useDebugMode = false ;
126+ var host = ( process . env . host || process . env . TYPESCRIPT_HOST || "node" ) ;
127+ var compilerFilename = "tsc.js" ;
126128/* Compiles a file from a list of sources
127129 * @param outFile: the target file name
128130 * @param sources: an array of the names of the source files
@@ -134,10 +136,9 @@ var useDebugMode = false;
134136function compileFile ( outFile , sources , prereqs , prefixes , useBuiltCompiler , noOutFile ) {
135137 file ( outFile , prereqs , function ( ) {
136138 var dir = useBuiltCompiler ? builtLocalDirectory : LKGDirectory ;
137- var compilerFilename = "tsc.js" ;
138139 var options = "-removeComments --module commonjs -noImplicitAny " ; //" -propagateEnumConstants "
139140
140- var cmd = ( process . env . host || process . env . TYPESCRIPT_HOST || "node" ) + " " + dir + compilerFilename + " " + options + " " ;
141+ var cmd = host + " " + dir + compilerFilename + " " + options + " " ;
141142 if ( useDebugMode ) {
142143 cmd = cmd + " " + path . join ( harnessDirectory , "external/es5compat.ts" ) + " " + path . join ( harnessDirectory , "external/json2.ts" ) + " " ;
143144 }
@@ -230,7 +231,7 @@ task("generate-diagnostics", [diagnosticInfoMapTs])
230231
231232
232233// Local target to build the compiler and services
233- var tscFile = path . join ( builtLocalDirectory , "tsc.js" ) ;
234+ var tscFile = path . join ( builtLocalDirectory , compilerFilename ) ;
234235compileFile ( tscFile , compilerSources , [ builtLocalDirectory , copyright ] . concat ( compilerSources ) , [ copyright ] , /*useBuiltCompiler:*/ false ) ;
235236
236237var servicesFile = path . join ( builtLocalDirectory , "typescriptServices.js" ) ;
@@ -473,3 +474,36 @@ var perftscJsPath = "built/local/perftsc.js";
473474compileFile ( perftscJsPath , [ perftscPath ] , [ tscFile , perftscPath , "tests/perfsys.ts" ] . concat ( libraryTargets ) , [ ] , true ) ;
474475desc ( "Builds augmented version of the compiler for perf tests" ) ;
475476task ( "perftsc" , [ perftscJsPath ] ) ;
477+
478+ // Instrumented compiler
479+ var loggedIOpath = harnessDirectory + 'loggedIO.ts' ;
480+ var loggedIOJsPath = builtLocalDirectory + 'loggedIO.js' ;
481+ file ( loggedIOJsPath , [ builtLocalDirectory ] , function ( ) {
482+ var temp = builtLocalDirectory + 'temp' ;
483+ jake . mkdirP ( temp ) ;
484+ var options = "--outdir " + temp + ' ' + loggedIOpath ;
485+ var cmd = host + " " + LKGDirectory + compilerFilename + " " + options + " " ;
486+ console . log ( cmd + "\n" ) ;
487+ var ex = jake . createExec ( [ cmd ] ) ;
488+ ex . addListener ( "cmdEnd" , function ( ) {
489+ fs . renameSync ( temp + '/harness/loggedIO.js' , loggedIOJsPath ) ;
490+ jake . rmRf ( temp ) ;
491+ } ) ;
492+ ex . run ( ) ;
493+ } , { async : true } ) ;
494+
495+ var instrumenterPath = harnessDirectory + 'instrumenter.ts' ;
496+ var instrumenterJsPath = builtLocalDirectory + 'instrumenter.js' ;
497+ compileFile ( instrumenterJsPath , [ instrumenterPath ] , [ tscFile , instrumenterPath ] , [ ] , true ) ;
498+
499+ desc ( "Builds an instrumented tsc.js" ) ;
500+ task ( 'tsc-instrumented' , [ loggedIOJsPath , instrumenterJsPath , tscFile ] , function ( ) {
501+ var cmd = host + ' ' + instrumenterJsPath + ' record iocapture ' + builtLocalDirectory + compilerFilename ;
502+ console . log ( cmd ) ;
503+ var ex = jake . createExec ( [ cmd ] ) ;
504+ ex . addListener ( "error" , function ( e ) {
505+ console . log ( 'error running instrumenter' ) ;
506+ console . log ( e ) ;
507+ } ) ;
508+ ex . run ( ) ;
509+ } , { async : true } ) ;
0 commit comments