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

Commit 83ba850

Browse files
chalinwardbell
authored andcommitted
chore(gulp): except for check-deploy, gulp targets are for (ts|js) only
closes #1915
1 parent 5bac678 commit 83ba850

File tree

1 file changed

+27
-13
lines changed

1 file changed

+27
-13
lines changed

Diff for: gulpfile.js

+27-13
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,28 @@ var _exampleProtractorBoilerplateFiles = [
106106

107107
var _exampleConfigFilename = 'example-config.json';
108108

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;
110118
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)';
113124
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+
}
114131
}
115132
configLangs(argv.lang);
116133

@@ -149,7 +166,6 @@ gulp.task('run-e2e-tests', runE2e);
149166
* all means (ts|js|dart)
150167
*/
151168
function runE2e() {
152-
if (!argv.lang) configLangs('ts|js'); // Exclude dart by default
153169
var promise;
154170
if (argv.fast) {
155171
// fast; skip all setup
@@ -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

552567
gulp.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(/^(?!angular2)|\.testing|_|codegen|^angular2$/);
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(/^index/))
@@ -1391,9 +1406,8 @@ 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);
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);
13991413
}

0 commit comments

Comments
 (0)