@@ -206,6 +206,9 @@ function concatenateFiles(destinationFile, sourceFiles) {
206206var useDebugMode = true ;
207207var host = ( process . env . host || process . env . TYPESCRIPT_HOST || "node" ) ;
208208var compilerFilename = "tsc.js" ;
209+ var LKGCompiler = path . join ( LKGDirectory , compilerFilename ) ;
210+ var builtLocalCompiler = path . join ( builtLocalDirectory , compilerFilename ) ;
211+
209212/* Compiles a file from a list of sources
210213 * @param outFile: the target file name
211214 * @param sources: an array of the names of the source files
@@ -220,7 +223,7 @@ var compilerFilename = "tsc.js";
220223 */
221224function compileFile ( outFile , sources , prereqs , prefixes , useBuiltCompiler , noOutFile , generateDeclarations , outDir , preserveConstEnums , keepComments , noResolve , stripInternal , callback ) {
222225 file ( outFile , prereqs , function ( ) {
223- var dir = useBuiltCompiler ? builtLocalDirectory : LKGDirectory ;
226+ var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler ;
224227 var options = "--module commonjs --noImplicitAny --noEmitOnError" ;
225228
226229 // Keep comments when specifically requested
@@ -257,7 +260,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
257260 options += " --stripInternal"
258261 }
259262
260- var cmd = host + " " + dir + compilerFilename + " " + options + " " ;
263+ var cmd = host + " " + compilerPath + " " + options + " " ;
261264 cmd = cmd + sources . join ( " " ) ;
262265 console . log ( cmd + "\n" ) ;
263266
@@ -328,7 +331,7 @@ compileFile(processDiagnosticMessagesJs,
328331
329332// The generated diagnostics map; built for the compiler and for the 'generate-diagnostics' task
330333file ( diagnosticInfoMapTs , [ processDiagnosticMessagesJs , diagnosticMessagesJson ] , function ( ) {
331- var cmd = "node " + processDiagnosticMessagesJs + " " + diagnosticMessagesJson ;
334+ var cmd = host + " " + processDiagnosticMessagesJs + " " + diagnosticMessagesJson ;
332335 console . log ( cmd ) ;
333336 var ex = jake . createExec ( [ cmd ] ) ;
334337 // Add listeners for output and error
@@ -374,7 +377,7 @@ task("setDebugMode", function() {
374377} ) ;
375378
376379task ( "configure-nightly" , [ configureNightlyJs ] , function ( ) {
377- var cmd = "node " + configureNightlyJs + " " + packageJson + " " + programTs ;
380+ var cmd = host + " " + configureNightlyJs + " " + packageJson + " " + programTs ;
378381 console . log ( cmd ) ;
379382 exec ( cmd ) ;
380383} , { async : true } ) ;
@@ -386,6 +389,32 @@ task("publish-nightly", ["configure-nightly", "LKG", "clean", "setDebugMode", "r
386389 exec ( cmd ) ;
387390} ) ;
388391
392+ var scriptsTsdJson = path . join ( scriptsDirectory , "tsd.json" ) ;
393+ file ( scriptsTsdJson ) ;
394+
395+ task ( "tsd-scripts" , [ scriptsTsdJson ] , function ( ) {
396+ var cmd = "tsd --config " + scriptsTsdJson + " install" ;
397+ console . log ( cmd )
398+ exec ( cmd ) ;
399+ } , { async : true } )
400+
401+ var importDefinitelyTypedTestsDirectory = path . join ( scriptsDirectory , "importDefinitelyTypedTests" ) ;
402+ var importDefinitelyTypedTestsJs = path . join ( importDefinitelyTypedTestsDirectory , "importDefinitelyTypedTests.js" ) ;
403+ var importDefinitelyTypedTestsTs = path . join ( importDefinitelyTypedTestsDirectory , "importDefinitelyTypedTests.ts" ) ;
404+
405+ file ( importDefinitelyTypedTestsTs ) ;
406+ file ( importDefinitelyTypedTestsJs , [ "tsd-scripts" , importDefinitelyTypedTestsTs ] , function ( ) {
407+ var cmd = host + " " + LKGCompiler + " -p " + importDefinitelyTypedTestsDirectory ;
408+ console . log ( cmd ) ;
409+ exec ( cmd ) ;
410+ } , { async : true } ) ;
411+
412+ task ( "importDefinitelyTypedTests" , [ importDefinitelyTypedTestsJs ] , function ( ) {
413+ var cmd = host + " " + importDefinitelyTypedTestsJs + " ./ ../DefinitelyTyped" ;
414+ console . log ( cmd ) ;
415+ exec ( cmd ) ;
416+ } , { async : true } ) ;
417+
389418// Local target to build the compiler and services
390419var tscFile = path . join ( builtLocalDirectory , compilerFilename ) ;
391420compileFile ( tscFile , compilerSources , [ builtLocalDirectory , copyright ] . concat ( compilerSources ) , [ copyright ] , /*useBuiltCompiler:*/ false ) ;
@@ -780,17 +809,36 @@ task("update-sublime", ["local", serverFile], function() {
780809 jake . cpR ( serverFile + ".map" , "../TypeScript-Sublime-Plugin/tsserver/" ) ;
781810} ) ;
782811
812+ var tslintRuleDir = "scripts/tslint" ;
813+ var tslintRules = ( [
814+ "nextLineRule" ,
815+ "noInferrableTypesRule" ,
816+ "noNullRule" ,
817+ "booleanTriviaRule"
818+ ] ) ;
819+ var tslintRulesFiles = tslintRules . map ( function ( p ) {
820+ return path . join ( tslintRuleDir , p + ".ts" ) ;
821+ } ) ;
822+ var tslintRulesOutFiles = tslintRules . map ( function ( p ) {
823+ return path . join ( builtLocalDirectory , "tslint" , p + ".js" ) ;
824+ } ) ;
825+ desc ( "Compiles tslint rules to js" ) ;
826+ task ( "build-rules" , tslintRulesOutFiles ) ;
827+ tslintRulesFiles . forEach ( function ( ruleFile , i ) {
828+ compileFile ( tslintRulesOutFiles [ i ] , [ ruleFile ] , [ ruleFile ] , [ ] , /*useBuiltCompiler*/ true , /*noOutFile*/ true , /*generateDeclarations*/ false , path . join ( builtLocalDirectory , "tslint" ) ) ;
829+ } ) ;
830+
783831// if the codebase were free of linter errors we could make jake runtests
784832// run this task automatically
785833desc ( "Runs tslint on the compiler sources" ) ;
786- task ( "lint" , [ ] , function ( ) {
834+ task ( "lint" , [ "build-rules" ] , function ( ) {
787835 function success ( f ) { return function ( ) { console . log ( 'SUCCESS: No linter errors in ' + f + '\n' ) ; } } ;
788836 function failure ( f ) { return function ( ) { console . log ( 'FAILURE: Please fix linting errors in ' + f + '\n' ) } } ;
789837
790838 var lintTargets = compilerSources . concat ( harnessCoreSources ) ;
791839 for ( var i in lintTargets ) {
792840 var f = lintTargets [ i ] ;
793- var cmd = 'tslint -c tslint.json ' + f ;
841+ var cmd = 'tslint --rules-dir built/local/tslint - c tslint.json ' + f ;
794842 exec ( cmd , success ( f ) , failure ( f ) ) ;
795843 }
796844} , { async : true } ) ;
0 commit comments