@@ -113,7 +113,7 @@ var languageServiceLibrarySources = [
113113 return path . join ( serverDirectory , f ) ;
114114} ) . concat ( servicesSources ) ;
115115
116- var harnessSources = [
116+ var harnessCoreSources = [
117117 "harness.ts" ,
118118 "sourceMapRecorder.ts" ,
119119 "harnessLanguageService.ts" ,
@@ -129,13 +129,16 @@ var harnessSources = [
129129 "runner.ts"
130130] . map ( function ( f ) {
131131 return path . join ( harnessDirectory , f ) ;
132- } ) . concat ( [
132+ } ) ;
133+
134+ var harnessSources = harnessCoreSources . concat ( [
133135 "incrementalParser.ts" ,
134136 "jsDocParsing.ts" ,
135137 "services/colorization.ts" ,
136138 "services/documentRegistry.ts" ,
137139 "services/preProcessFile.ts" ,
138140 "services/patternMatcher.ts" ,
141+ "session.ts" ,
139142 "versionCache.ts" ,
140143 "convertToBase64.ts" ,
141144 "transpile.ts" ,
@@ -312,7 +315,7 @@ var processDiagnosticMessagesTs = path.join(scriptsDirectory, "processDiagnostic
312315var diagnosticMessagesJson = path . join ( compilerDirectory , "diagnosticMessages.json" ) ;
313316var diagnosticInfoMapTs = path . join ( compilerDirectory , "diagnosticInformationMap.generated.ts" ) ;
314317
315- file ( processDiagnosticMessagesTs )
318+ file ( processDiagnosticMessagesTs ) ;
316319
317320// processDiagnosticMessages script
318321compileFile ( processDiagnosticMessagesJs ,
@@ -337,12 +340,50 @@ file(diagnosticInfoMapTs, [processDiagnosticMessagesJs, diagnosticMessagesJson],
337340 complete ( ) ;
338341 } ) ;
339342 ex . run ( ) ;
340- } , { async : true } )
343+ } , { async : true } ) ;
341344
342345desc ( "Generates a diagnostic file in TypeScript based on an input JSON file" ) ;
343- task ( "generate-diagnostics" , [ diagnosticInfoMapTs ] )
346+ task ( "generate-diagnostics" , [ diagnosticInfoMapTs ] ) ;
344347
345348
349+ // Publish nightly
350+ var configureNightlyJs = path . join ( scriptsDirectory , "configureNightly.js" ) ;
351+ var configureNightlyTs = path . join ( scriptsDirectory , "configureNightly.ts" ) ;
352+ var packageJson = "package.json" ;
353+ var programTs = path . join ( compilerDirectory , "program.ts" ) ;
354+
355+ file ( configureNightlyTs ) ;
356+
357+ compileFile ( /*outfile*/ configureNightlyJs ,
358+ /*sources*/ [ configureNightlyTs ] ,
359+ /*prereqs*/ [ configureNightlyTs ] ,
360+ /*prefixes*/ [ ] ,
361+ /*useBuiltCompiler*/ false ,
362+ /*noOutFile*/ false ,
363+ /*generateDeclarations*/ false ,
364+ /*outDir*/ undefined ,
365+ /*preserveConstEnums*/ undefined ,
366+ /*keepComments*/ false ,
367+ /*noResolve*/ false ,
368+ /*stripInternal*/ false ) ;
369+
370+ task ( "setDebugMode" , function ( ) {
371+ useDebugMode = true ;
372+ } ) ;
373+
374+ task ( "configure-nightly" , [ configureNightlyJs ] , function ( ) {
375+ var cmd = "node " + configureNightlyJs + " " + packageJson + " " + programTs ;
376+ console . log ( cmd ) ;
377+ exec ( cmd ) ;
378+ } , { async : true } ) ;
379+
380+ desc ( "Configure, build, test, and publish the nightly release." ) ;
381+ task ( "publish-nightly" , [ "configure-nightly" , "LKG" , "clean" , "setDebugMode" , "runtests" ] , function ( ) {
382+ var cmd = "npm publish --tag next" ;
383+ console . log ( cmd ) ;
384+ exec ( cmd ) ;
385+ } ) ;
386+
346387// Local target to build the compiler and services
347388var tscFile = path . join ( builtLocalDirectory , compilerFilename ) ;
348389compileFile ( tscFile , compilerSources , [ builtLocalDirectory , copyright ] . concat ( compilerSources ) , [ copyright ] , /*useBuiltCompiler:*/ false ) ;
@@ -362,7 +403,7 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
362403 /*keepComments*/ true ,
363404 /*noResolve*/ false ,
364405 /*stripInternal*/ true ,
365- /*callback*/ function ( ) {
406+ /*callback*/ function ( ) {
366407 jake . cpR ( servicesFile , nodePackageFile , { silent : true } ) ;
367408
368409 prependFile ( copyright , standaloneDefinitionsFile ) ;
@@ -380,12 +421,12 @@ compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(se
380421
381422var lsslFile = path . join ( builtLocalDirectory , "tslssl.js" ) ;
382423compileFile (
383- lsslFile ,
384- languageServiceLibrarySources ,
424+ lsslFile ,
425+ languageServiceLibrarySources ,
385426 [ builtLocalDirectory , copyright ] . concat ( languageServiceLibrarySources ) ,
386- /*prefixes*/ [ copyright ] ,
387- /*useBuiltCompiler*/ true ,
388- /*noOutFile*/ false ,
427+ /*prefixes*/ [ copyright ] ,
428+ /*useBuiltCompiler*/ true ,
429+ /*noOutFile*/ false ,
389430 /*generateDeclarations*/ true ) ;
390431
391432// Local target to build the language service server library
@@ -439,11 +480,11 @@ file(specMd, [word2mdJs, specWord], function () {
439480 child_process . exec ( cmd , function ( ) {
440481 complete ( ) ;
441482 } ) ;
442- } , { async : true } )
483+ } , { async : true } ) ;
443484
444485
445486desc ( "Generates a Markdown version of the Language Specification" ) ;
446- task ( "generate-spec" , [ specMd ] )
487+ task ( "generate-spec" , [ specMd ] ) ;
447488
448489
449490// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
@@ -489,7 +530,7 @@ var refTest262Baseline = path.join(internalTests, "baselines/test262/reference")
489530desc ( "Builds the test infrastructure using the built compiler" ) ;
490531task ( "tests" , [ "local" , run ] . concat ( libraryTargets ) ) ;
491532
492- function exec ( cmd , completeHandler ) {
533+ function exec ( cmd , completeHandler , errorHandler ) {
493534 var ex = jake . createExec ( [ cmd ] , { windowsVerbatimArguments : true } ) ;
494535 // Add listeners for output and error
495536 ex . addListener ( "stdout" , function ( output ) {
@@ -505,8 +546,12 @@ function exec(cmd, completeHandler) {
505546 complete ( ) ;
506547 } ) ;
507548 ex . addListener ( "error" , function ( e , status ) {
508- fail ( "Process exited with code " + status ) ;
509- } )
549+ if ( errorHandler ) {
550+ errorHandler ( e , status ) ;
551+ } else {
552+ fail ( "Process exited with code " + status ) ;
553+ }
554+ } ) ;
510555
511556 ex . run ( ) ;
512557}
@@ -563,15 +608,15 @@ task("runtests", ["tests", builtLocalDirectory], function() {
563608 colors = process . env . colors || process . env . color
564609 colors = colors ? ' --no-colors ' : ' --colors ' ;
565610 tests = tests ? ' -g ' + tests : '' ;
566- reporter = process . env . reporter || process . env . r || 'dot ' ;
611+ reporter = process . env . reporter || process . env . r || 'mocha-fivemat-progress-reporter ' ;
567612 // timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
568613 // default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
569614 var cmd = host + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run ;
570615 console . log ( cmd ) ;
571616 exec ( cmd , deleteTemporaryProjectOutput ) ;
572617} , { async : true } ) ;
573618
574- desc ( "Generates code coverage data via instanbul" )
619+ desc ( "Generates code coverage data via instanbul" ) ;
575620task ( "generate-code-coverage" , [ "tests" , builtLocalDirectory ] , function ( ) {
576621 var cmd = 'istanbul cover node_modules/mocha/bin/_mocha -- -R min -t ' + testTimeout + ' ' + run ;
577622 console . log ( cmd ) ;
@@ -614,7 +659,7 @@ task("runtests-browser", ["tests", "browserify", builtLocalDirectory], function(
614659function getDiffTool ( ) {
615660 var program = process . env [ 'DIFF' ]
616661 if ( ! program ) {
617- fail ( "Add the 'DIFF' environment variable to the path of the program you want to use." )
662+ fail ( "Add the 'DIFF' environment variable to the path of the program you want to use." ) ;
618663 }
619664 return program ;
620665}
@@ -623,14 +668,14 @@ function getDiffTool() {
623668desc ( "Diffs the compiler baselines using the diff tool specified by the 'DIFF' environment variable" ) ;
624669task ( 'diff' , function ( ) {
625670 var cmd = '"' + getDiffTool ( ) + '" ' + refBaseline + ' ' + localBaseline ;
626- console . log ( cmd )
671+ console . log ( cmd ) ;
627672 exec ( cmd ) ;
628673} , { async : true } ) ;
629674
630675desc ( "Diffs the RWC baselines using the diff tool specified by the 'DIFF' environment variable" ) ;
631676task ( 'diff-rwc' , function ( ) {
632677 var cmd = '"' + getDiffTool ( ) + '" ' + refRwcBaseline + ' ' + localRwcBaseline ;
633- console . log ( cmd )
678+ console . log ( cmd ) ;
634679 exec ( cmd ) ;
635680} , { async : true } ) ;
636681
@@ -718,7 +763,22 @@ task('tsc-instrumented', [loggedIOJsPath, instrumenterJsPath, tscFile], function
718763} , { async : true } ) ;
719764
720765desc ( "Updates the sublime plugin's tsserver" ) ;
721- task ( "update-sublime" , [ serverFile ] , function ( ) {
766+ task ( "update-sublime" , [ "local" , serverFile ] , function ( ) {
722767 jake . cpR ( serverFile , "../TypeScript-Sublime-Plugin/tsserver/" ) ;
723768 jake . cpR ( serverFile + ".map" , "../TypeScript-Sublime-Plugin/tsserver/" ) ;
724769} ) ;
770+
771+ // if the codebase were free of linter errors we could make jake runtests
772+ // run this task automatically
773+ desc ( "Runs tslint on the compiler sources" ) ;
774+ task ( "lint" , [ ] , function ( ) {
775+ function success ( f ) { return function ( ) { console . log ( 'SUCCESS: No linter errors in ' + f + '\n' ) ; } } ;
776+ function failure ( f ) { return function ( ) { console . log ( 'FAILURE: Please fix linting errors in ' + f + '\n' ) } } ;
777+
778+ var lintTargets = compilerSources . concat ( harnessCoreSources ) ;
779+ for ( var i in lintTargets ) {
780+ var f = lintTargets [ i ] ;
781+ var cmd = 'tslint -c tslint.json ' + f ;
782+ exec ( cmd , success ( f ) , failure ( f ) ) ;
783+ }
784+ } , { async : true } ) ;
0 commit comments