@@ -106,14 +106,30 @@ var _exampleProtractorBoilerplateFiles = [
106
106
107
107
var _exampleConfigFilename = 'example-config.json' ;
108
108
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|dart)' unless --no-dart is given in which case it is '(ts|js)'.
116
+ //
117
+ // --no-dart
118
+ //
119
+ // is a convenient way to exclude dart from the --lang default.
109
120
var lang , langs ;
110
121
function configLangs ( langOption ) {
111
- lang = ( langOption || 'all' ) . toLowerCase ( ) ;
122
+ // TODO(chalin): temporary dependence on process.env.TRAVIS until #1910 lands.
123
+ const langDefault = ( argv . dart === false || process . env . TRAVIS )
124
+ ? '(ts|js)' : 'all' ;
125
+ lang = ( langOption || langDefault ) . toLowerCase ( ) ;
112
126
if ( lang === 'all' ) { lang = '(ts|js|dart)' ; }
113
127
langs = lang . match ( / \w + / g) ; // the languages in `lang` as an array
114
128
}
115
129
configLangs ( argv . lang ) ;
116
130
131
+ var buildDartApiDocs = langs . indexOf ( 'dart' ) >= 0 ;
132
+
117
133
function isDartPath ( path ) {
118
134
// Testing via indexOf() for now. If we need to match only paths with folders
119
135
// named 'dart' vs 'dart*' then try: path.match('/dart(/|$)') != null;
@@ -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,13 @@ 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 ) ;
1409
+ function checkAngularProjectPath ( _ngPath ) {
1410
+ var ngPath = path . resolve ( _ngPath || ngPathFor ( 'ts' ) ) ;
1411
+ if ( fs . existsSync ( ngPath ) ) return ;
1412
+ if ( ngPath . match ( / d a r t / ) && buildDartApiDocs ) {
1413
+ console . error ( '\nERROR:' ) ;
1414
+ console . error ( ' Cannot build Dart API docs, Dart repo is missing: ' + ngPath ) ;
1415
+ console . error ( ' Perhaps you meant to use the --no-dart flag?\n' ) ;
1398
1416
}
1417
+ throw new Error ( 'API related tasks require the angular2 repo to be at ' + ngPath ) ;
1399
1418
}
0 commit comments