@@ -106,14 +106,30 @@ var _exampleProtractorBoilerplateFiles = [
106106
107107var _exampleConfigFilename = 'example-config.json' ;
108108
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.
109120var lang , langs ;
110121function 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 ( ) ;
112126 if ( lang === 'all' ) { lang = '(ts|js|dart)' ; }
113127 langs = lang . match ( / \w + / g) ; // the languages in `lang` as an array
114128}
115129configLangs ( argv . lang ) ;
116130
131+ var buildDartApiDocs = langs . indexOf ( 'dart' ) >= 0 ;
132+
117133function isDartPath ( path ) {
118134 // Testing via indexOf() for now. If we need to match only paths with folders
119135 // 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
545561// Stop zipping examples Feb 28, 2016
546562//gulp.task('build-docs', ['build-devguide-docs', 'build-api-docs', 'build-plunkers', '_zip-examples']);
547563
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' ] : [ ] ) ) ;
551566
552567gulp . task ( 'build-devguide-docs' , [ '_shred-devguide-examples' , '_shred-devguide-shared-jade' ] , function ( ) {
553568 return buildShredMaps ( true ) ;
@@ -1190,7 +1205,7 @@ function buildApiDocsForDart() {
11901205 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 $ / ) ;
11911206
11921207 try {
1193- checkAngularProjectPath ( 'dart' ) ;
1208+ checkAngularProjectPath ( ngPathFor ( 'dart' ) ) ;
11941209 var destPath = dabInfo . ngIoDartApiDocPath ;
11951210 var sourceDirs = fs . readdirSync ( dabInfo . ngDartDocPath )
11961211 . filter ( ( name ) => ! name . match ( / ^ i n d e x / ) )
@@ -1391,9 +1406,13 @@ function ngPathFor(lang) {
13911406 return ANGULAR_PROJECT_PATH + ( lang === 'dart' ? '-dart' : '' ) ;
13921407}
13931408
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' ) ;
13981416 }
1417+ throw new Error ( 'API related tasks require the angular2 repo to be at ' + ngPath ) ;
13991418}
0 commit comments