@@ -29,7 +29,8 @@ var thirdParty = "ThirdPartyNoticeText.txt";
29
29
var nodeModulesPathPrefix = path . resolve ( "./node_modules/.bin/" ) + path . delimiter ;
30
30
if ( process . env . path !== undefined ) {
31
31
process . env . path = nodeModulesPathPrefix + process . env . path ;
32
- } else if ( process . env . PATH !== undefined ) {
32
+ }
33
+ else if ( process . env . PATH !== undefined ) {
33
34
process . env . PATH = nodeModulesPathPrefix + process . env . PATH ;
34
35
}
35
36
@@ -312,13 +313,15 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
312
313
if ( useDebugMode ) {
313
314
if ( opts . inlineSourceMap ) {
314
315
options += " --inlineSourceMap --inlineSources" ;
315
- } else {
316
+ }
317
+ else {
316
318
options += " -sourcemap" ;
317
319
if ( ! opts . noMapRoot ) {
318
320
options += " -mapRoot file:///" + path . resolve ( path . dirname ( outFile ) ) ;
319
321
}
320
322
}
321
- } else {
323
+ }
324
+ else {
322
325
options += " --newLine LF" ;
323
326
}
324
327
@@ -330,7 +333,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
330
333
options += " --lib " + opts . lib
331
334
}
332
335
else {
333
- options += " --lib es5,scripthost "
336
+ options += " --lib es5"
334
337
}
335
338
options += " --noUnusedLocals --noUnusedParameters" ;
336
339
@@ -584,13 +587,13 @@ var cancellationTokenFile = path.join(builtLocalDirectory, "cancellationToken.js
584
587
compileFile ( cancellationTokenFile , cancellationTokenSources , [ builtLocalDirectory ] . concat ( cancellationTokenSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true , { types : [ "node" ] , outDir : builtLocalDirectory , noOutFile : true , lib : "es6" } ) ;
585
588
586
589
var typingsInstallerFile = path . join ( builtLocalDirectory , "typingsInstaller.js" ) ;
587
- compileFile ( typingsInstallerFile , typingsInstallerSources , [ builtLocalDirectory ] . concat ( typingsInstallerSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true , { types : [ "node" ] , outDir : builtLocalDirectory , noOutFile : false , lib : "es6,scripthost " } ) ;
590
+ compileFile ( typingsInstallerFile , typingsInstallerSources , [ builtLocalDirectory ] . concat ( typingsInstallerSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true , { types : [ "node" ] , outDir : builtLocalDirectory , noOutFile : false , lib : "es6" } ) ;
588
591
589
592
var watchGuardFile = path . join ( builtLocalDirectory , "watchGuard.js" ) ;
590
593
compileFile ( watchGuardFile , watchGuardSources , [ builtLocalDirectory ] . concat ( watchGuardSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true , { types : [ "node" ] , outDir : builtLocalDirectory , noOutFile : false , lib : "es6" } ) ;
591
594
592
595
var serverFile = path . join ( builtLocalDirectory , "tsserver.js" ) ;
593
- compileFile ( serverFile , serverSources , [ builtLocalDirectory , copyright , cancellationTokenFile , typingsInstallerFile , watchGuardFile ] . concat ( serverSources ) . concat ( servicesSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true , { types : [ "node" ] , preserveConstEnums : true , lib : "es6,scripthost " } ) ;
596
+ compileFile ( serverFile , serverSources , [ builtLocalDirectory , copyright , cancellationTokenFile , typingsInstallerFile , watchGuardFile ] . concat ( serverSources ) . concat ( servicesSources ) , /*prefixes*/ [ copyright ] , /*useBuiltCompiler*/ true , { types : [ "node" ] , preserveConstEnums : true , lib : "es6" } ) ;
594
597
var tsserverLibraryFile = path . join ( builtLocalDirectory , "tsserverlibrary.js" ) ;
595
598
var tsserverLibraryDefinitionFile = path . join ( builtLocalDirectory , "tsserverlibrary.d.ts" ) ;
596
599
compileFile (
@@ -714,7 +717,7 @@ compileFile(
714
717
/*prereqs*/ [ builtLocalDirectory , tscFile ] . concat ( libraryTargets ) . concat ( servicesSources ) . concat ( harnessSources ) ,
715
718
/*prefixes*/ [ ] ,
716
719
/*useBuiltCompiler:*/ true ,
717
- /*opts*/ { inlineSourceMap : true , types : [ "node" , "mocha" , "chai" ] , lib : "es6,scripthost " } ) ;
720
+ /*opts*/ { inlineSourceMap : true , types : [ "node" , "mocha" , "chai" ] , lib : "es6" } ) ;
718
721
719
722
var internalTests = "internal/" ;
720
723
@@ -748,7 +751,8 @@ function exec(cmd, completeHandler, errorHandler) {
748
751
ex . addListener ( "error" , function ( e , status ) {
749
752
if ( errorHandler ) {
750
753
errorHandler ( e , status ) ;
751
- } else {
754
+ }
755
+ else {
752
756
fail ( "Process exited with code " + status ) ;
753
757
}
754
758
} ) ;
@@ -1006,21 +1010,32 @@ task("baseline-accept", function () {
1006
1010
1007
1011
function acceptBaseline ( sourceFolder , targetFolder ) {
1008
1012
console . log ( 'Accept baselines from ' + sourceFolder + ' to ' + targetFolder ) ;
1009
- var files = fs . readdirSync ( sourceFolder ) ;
1010
1013
var deleteEnding = '.delete' ;
1011
- for ( var i in files ) {
1012
- var filename = files [ i ] ;
1013
- var fullLocalPath = path . join ( sourceFolder , filename ) ;
1014
- if ( fs . statSync ( fullLocalPath ) . isFile ( ) ) {
1015
- if ( filename . substr ( filename . length - deleteEnding . length ) === deleteEnding ) {
1016
- filename = filename . substr ( 0 , filename . length - deleteEnding . length ) ;
1017
- fs . unlinkSync ( path . join ( targetFolder , filename ) ) ;
1018
- } else {
1019
- var target = path . join ( targetFolder , filename ) ;
1020
- if ( fs . existsSync ( target ) ) {
1021
- fs . unlinkSync ( target ) ;
1014
+
1015
+ acceptBaselineFolder ( sourceFolder , targetFolder ) ;
1016
+
1017
+ function acceptBaselineFolder ( sourceFolder , targetFolder ) {
1018
+ var files = fs . readdirSync ( sourceFolder ) ;
1019
+
1020
+ for ( var i in files ) {
1021
+ var filename = files [ i ] ;
1022
+ var fullLocalPath = path . join ( sourceFolder , filename ) ;
1023
+ var stat = fs . statSync ( fullLocalPath ) ;
1024
+ if ( stat . isFile ( ) ) {
1025
+ if ( filename . substr ( filename . length - deleteEnding . length ) === deleteEnding ) {
1026
+ filename = filename . substr ( 0 , filename . length - deleteEnding . length ) ;
1027
+ fs . unlinkSync ( path . join ( targetFolder , filename ) ) ;
1022
1028
}
1023
- fs . renameSync ( path . join ( sourceFolder , filename ) , target ) ;
1029
+ else {
1030
+ var target = path . join ( targetFolder , filename ) ;
1031
+ if ( fs . existsSync ( target ) ) {
1032
+ fs . unlinkSync ( target ) ;
1033
+ }
1034
+ fs . renameSync ( path . join ( sourceFolder , filename ) , target ) ;
1035
+ }
1036
+ }
1037
+ else if ( stat . isDirectory ( ) ) {
1038
+ acceptBaselineFolder ( fullLocalPath , path . join ( targetFolder , filename ) ) ;
1024
1039
}
1025
1040
}
1026
1041
}
@@ -1177,43 +1192,16 @@ function spawnLintWorker(files, callback) {
1177
1192
}
1178
1193
1179
1194
desc ( "Runs tslint on the compiler sources. Optional arguments are: f[iles]=regex" ) ;
1180
- task ( "lint" , [ "build-rules" ] , function ( ) {
1195
+ task ( "lint" , [ "build-rules" ] , ( ) => {
1181
1196
if ( fold . isTravis ( ) ) console . log ( fold . start ( "lint" ) ) ;
1182
- var startTime = mark ( ) ;
1183
- var failed = 0 ;
1184
- var fileMatcher = RegExp ( process . env . f || process . env . file || process . env . files || "" ) ;
1185
- var done = { } ;
1186
- for ( var i in lintTargets ) {
1187
- var target = lintTargets [ i ] ;
1188
- if ( ! done [ target ] && fileMatcher . test ( target ) ) {
1189
- done [ target ] = fs . statSync ( target ) . size ;
1190
- }
1191
- }
1192
-
1193
- var workerCount = ( process . env . workerCount && + process . env . workerCount ) || os . cpus ( ) . length ;
1194
-
1195
- var names = Object . keys ( done ) . sort ( function ( namea , nameb ) {
1196
- return done [ namea ] - done [ nameb ] ;
1197
+ const fileMatcher = process . env . f || process . env . file || process . env . files ;
1198
+ const files = fileMatcher
1199
+ ? `src/**/${ fileMatcher } `
1200
+ : "Gulpfile.ts 'src/**/*.ts' --exclude src/lib/es5.d.ts --exclude 'src/lib/*.generated.d.ts'" ;
1201
+ const cmd = `node node_modules/tslint/bin/tslint ${ files } --format stylish` ;
1202
+ console . log ( "Linting: " + cmd ) ;
1203
+ jake . exec ( [ cmd ] , { interactive : true } , ( ) => {
1204
+ if ( fold . isTravis ( ) ) console . log ( fold . end ( "lint" ) ) ;
1205
+ complete ( ) ;
1197
1206
} ) ;
1198
-
1199
- for ( var i = 0 ; i < workerCount ; i ++ ) {
1200
- spawnLintWorker ( names , finished ) ;
1201
- }
1202
-
1203
- var completed = 0 ;
1204
- var failures = 0 ;
1205
- function finished ( fails ) {
1206
- completed ++ ;
1207
- failures += fails ;
1208
- if ( completed === workerCount ) {
1209
- measure ( startTime ) ;
1210
- if ( fold . isTravis ( ) ) console . log ( fold . end ( "lint" ) ) ;
1211
- if ( failures > 0 ) {
1212
- fail ( 'Linter errors.' , failed ) ;
1213
- }
1214
- else {
1215
- complete ( ) ;
1216
- }
1217
- }
1218
- }
1219
- } , { async : true } ) ;
1207
+ } ) ;
0 commit comments