@@ -106,11 +106,28 @@ var _exampleProtractorBoilerplateFiles = [
106
106
107
107
var _exampleConfigFilename = 'example-config.json' ;
108
108
109
- var lang , langs ;
109
+ // Gulp flags:
110
+ //
111
+ // --lang=[all | ts | js | dart | (ts|js) | (ts|js|dart) | ...]
112
+ //
113
+ // This affects which language API docs and E2E tests are run. Can be 'all',
114
+ // or a regex pattern to match any one of 'ts', 'js', or 'dart'.
115
+ // Default: '(ts|js)' except for check-deploy for which it is 'all'.
116
+ //
117
+ var lang , langs , buildDartApiDocs = false ;
110
118
function configLangs ( langOption ) {
111
- lang = ( langOption || 'all' ) . toLowerCase ( ) ;
112
- if ( lang === 'all' ) { lang = '(ts|js|dart)' ; }
119
+ // TODO(chalin): temporary dependence on process.env.TRAVIS until #1910 lands.
120
+ const buildAllDocs = argv [ '_' ] && argv [ '_' ] . indexOf ( 'check-deploy' ) >= 0 ;
121
+ const langDefault = ( ! buildAllDocs || process . env . TRAVIS ) ? '(ts|js)' : 'all' ;
122
+ lang = ( langOption || langDefault ) . toLowerCase ( ) ;
123
+ if ( lang === 'all' ) lang = '(ts|js|dart)' ;
113
124
langs = lang . match ( / \w + / g) ; // the languages in `lang` as an array
125
+ gutil . log ( 'Build docs for: ' + lang ) ;
126
+ if ( langs . indexOf ( 'dart' ) >= 0 ) {
127
+ buildDartApiDocs = true ;
128
+ // For Dart, be proactive about checking for the repo
129
+ checkAngularProjectPath ( ngPathFor ( 'dart' ) ) ;
130
+ }
114
131
}
115
132
configLangs ( argv . lang ) ;
116
133
@@ -149,7 +166,6 @@ gulp.task('run-e2e-tests', runE2e);
149
166
* all means (ts|js|dart)
150
167
*/
151
168
function runE2e ( ) {
152
- if ( ! argv . lang ) configLangs ( 'ts|js' ) ; // Exclude dart by default
153
169
var promise ;
154
170
if ( argv . fast ) {
155
171
// fast; skip all setup
@@ -545,9 +561,8 @@ gulp.task('build-docs', ['build-devguide-docs', 'build-api-docs', 'build-plunker
545
561
// Stop zipping examples Feb 28, 2016
546
562
//gulp.task('build-docs', ['build-devguide-docs', 'build-api-docs', 'build-plunkers', '_zip-examples']);
547
563
548
- gulp . task ( 'build-api-docs' , [ 'build-js-api-docs' , 'build-ts-api-docs' , 'build-dart-cheatsheet' ]
549
- // On TRAVIS? Skip building the Dart API docs for now.
550
- . concat ( process . env . TRAVIS ? [ ] : [ 'build-dart-api-docs' ] ) ) ;
564
+ gulp . task ( 'build-api-docs' , [ 'build-js-api-docs' , 'build-ts-api-docs' ]
565
+ . concat ( buildDartApiDocs ? [ 'build-dart-api-docs' , 'build-dart-cheatsheet' ] : [ ] ) ) ;
551
566
552
567
gulp . task ( 'build-devguide-docs' , [ '_shred-devguide-examples' , '_shred-devguide-shared-jade' ] , function ( ) {
553
568
return buildShredMaps ( true ) ;
@@ -1190,7 +1205,7 @@ function buildApiDocsForDart() {
1190
1205
dabInfo . excludeLibRegExp = new RegExp ( / ^ (? ! a n g u l a r 2 ) | \. t e s t i n g | _ | c o d e g e n | ^ a n g u l a r 2 $ / ) ;
1191
1206
1192
1207
try {
1193
- checkAngularProjectPath ( 'dart' ) ;
1208
+ checkAngularProjectPath ( ngPathFor ( 'dart' ) ) ;
1194
1209
var destPath = dabInfo . ngIoDartApiDocPath ;
1195
1210
var sourceDirs = fs . readdirSync ( dabInfo . ngDartDocPath )
1196
1211
. filter ( ( name ) => ! name . match ( / ^ i n d e x / ) )
@@ -1391,9 +1406,8 @@ function ngPathFor(lang) {
1391
1406
return ANGULAR_PROJECT_PATH + ( lang === 'dart' ? '-dart' : '' ) ;
1392
1407
}
1393
1408
1394
- function checkAngularProjectPath ( lang ) {
1395
- var ngPath = path . resolve ( ngPathFor ( lang || 'ts' ) ) ;
1396
- if ( ! fs . existsSync ( ngPath ) ) {
1397
- throw new Error ( 'API related tasks require the angular2 repo to be at ' + ngPath ) ;
1398
- }
1409
+ function checkAngularProjectPath ( _ngPath ) {
1410
+ var ngPath = path . resolve ( _ngPath || ngPathFor ( 'ts' ) ) ;
1411
+ if ( fs . existsSync ( ngPath ) ) return ;
1412
+ throw new Error ( 'API related tasks require the angular2 repo to be at ' + ngPath ) ;
1399
1413
}
0 commit comments