Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit ef7d5b4

Browse files
committed
chore(gulp): add --no-dart flag
As before, by default, the various gulp tasks will be for all languages. To skip Dart API doc generation and running E2E tests use the `—no-dart` flag.
1 parent 1e908ff commit ef7d5b4

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

gulpfile.js

+27-9
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,29 @@ var _exampleProtractorBoilerplateFiles = [
106106

107107
var _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.
109120
var lang, langs;
110121
function configLangs(langOption) {
111-
lang = (langOption || 'all').toLowerCase();
122+
const langDefault = argv.dart === false ? '(ts|js)' : 'all';
123+
lang = (langOption || langDefault).toLowerCase();
112124
if (lang === 'all') { lang = '(ts|js|dart)'; }
113125
langs = lang.match(/\w+/g); // the languages in `lang` as an array
114126
}
115127
configLangs(argv.lang);
116128

129+
// TODO(chalin): temporary dependence on process.env.TRAVIS until #1910 lands.
130+
var buildDartApiDocs = !process.env.TRAVIS && langs.indexOf('dart') >= 0;
131+
117132
function isDartPath(path) {
118133
// Testing via indexOf() for now. If we need to match only paths with folders
119134
// named 'dart' vs 'dart*' then try: path.match('/dart(/|$)') != null;
@@ -545,9 +560,8 @@ gulp.task('build-docs', ['build-devguide-docs', 'build-api-docs', 'build-plunker
545560
// Stop zipping examples Feb 28, 2016
546561
//gulp.task('build-docs', ['build-devguide-docs', 'build-api-docs', 'build-plunkers', '_zip-examples']);
547562

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']));
563+
gulp.task('build-api-docs', ['build-js-api-docs', 'build-ts-api-docs']
564+
.concat(buildDartApiDocs ? ['build-dart-api-docs', 'build-dart-cheatsheet'] : []));
551565

552566
gulp.task('build-devguide-docs', ['_shred-devguide-examples', '_shred-devguide-shared-jade'], function() {
553567
return buildShredMaps(true);
@@ -1190,7 +1204,7 @@ function buildApiDocsForDart() {
11901204
dabInfo.excludeLibRegExp = new RegExp(/^(?!angular2)|\.testing|_|codegen|^angular2$/);
11911205

11921206
try {
1193-
checkAngularProjectPath('dart');
1207+
checkAngularProjectPath(ngPathFor('dart'));
11941208
var destPath = dabInfo.ngIoDartApiDocPath;
11951209
var sourceDirs = fs.readdirSync(dabInfo.ngDartDocPath)
11961210
.filter((name) => !name.match(/^index/))
@@ -1391,9 +1405,13 @@ function ngPathFor(lang) {
13911405
return ANGULAR_PROJECT_PATH + (lang === 'dart' ? '-dart' : '');
13921406
}
13931407

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);
1408+
function checkAngularProjectPath(_ngPath) {
1409+
var ngPath = path.resolve(_ngPath || ngPathFor('ts'));
1410+
if (fs.existsSync(ngPath)) return;
1411+
if (ngPath.match(/dart/) && buildDartApiDocs) {
1412+
console.error('\nERROR:');
1413+
console.error(' Cannot build Dart API docs, Dart repo is missing: ' + ngPath);
1414+
console.error(' Perhaps you meant to use the --no-dart flag?\n');
13981415
}
1416+
throw new Error('API related tasks require the angular2 repo to be at ' + ngPath);
13991417
}

0 commit comments

Comments
 (0)