| 
									
										
										
										
											2015-04-25 14:45:08 -07:00
										 |  |  | 'use strict'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-17 11:56:24 -08:00
										 |  |  | var autoprefixer = require('gulp-autoprefixer'); | 
					
						
							| 
									
										
										
										
											2015-06-25 16:21:43 -07:00
										 |  |  | var clangFormat = require('clang-format'); | 
					
						
							| 
									
										
										
										
											2015-04-27 00:46:48 -07:00
										 |  |  | var del = require('del'); | 
					
						
							| 
									
										
										
										
											2015-05-07 22:37:35 -07:00
										 |  |  | var exec = require('child_process').exec; | 
					
						
							| 
									
										
										
										
											2015-04-13 23:56:07 -07:00
										 |  |  | var fork = require('child_process').fork; | 
					
						
							| 
									
										
										
										
											2014-10-28 11:45:48 +01:00
										 |  |  | var gulp = require('gulp'); | 
					
						
							| 
									
										
										
										
											2015-06-25 16:21:43 -07:00
										 |  |  | var gulpFormat = require('gulp-clang-format'); | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | var gulpPlugins = require('gulp-load-plugins')(); | 
					
						
							| 
									
										
										
										
											2015-02-17 11:56:24 -08:00
										 |  |  | var sass = require('gulp-sass'); | 
					
						
							| 
									
										
										
										
											2015-03-19 11:36:27 -07:00
										 |  |  | var shell = require('gulp-shell'); | 
					
						
							| 
									
										
										
										
											2015-05-08 19:23:49 -07:00
										 |  |  | var spawn = require('child_process').spawn; | 
					
						
							| 
									
										
										
										
											2014-10-28 11:45:48 +01:00
										 |  |  | var runSequence = require('run-sequence'); | 
					
						
							| 
									
										
										
										
											2015-03-16 18:48:14 +01:00
										 |  |  | var madge = require('madge'); | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | var merge = require('merge'); | 
					
						
							| 
									
										
										
										
											2015-04-24 15:59:13 -07:00
										 |  |  | var merge2 = require('merge2'); | 
					
						
							| 
									
										
										
										
											2015-03-18 00:43:30 +01:00
										 |  |  | var path = require('path'); | 
					
						
							| 
									
										
										
										
											2015-07-10 17:43:30 -07:00
										 |  |  | var licenseWrap = require('./tools/build/licensewrap'); | 
					
						
							| 
									
										
										
										
											2015-06-05 23:37:09 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-08 14:20:54 -04:00
										 |  |  | var watch = require('./tools/build/watch'); | 
					
						
							| 
									
										
										
										
											2015-03-18 00:43:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-23 17:56:47 -08:00
										 |  |  | var pubget = require('./tools/build/pubget'); | 
					
						
							| 
									
										
										
										
											2015-02-11 11:40:29 -08:00
										 |  |  | var linknodemodules = require('./tools/build/linknodemodules'); | 
					
						
							| 
									
										
										
										
											2014-12-22 17:50:10 -08:00
										 |  |  | var pubbuild = require('./tools/build/pubbuild'); | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | var dartanalyzer = require('./tools/build/dartanalyzer'); | 
					
						
							| 
									
										
										
										
											2015-08-06 15:07:33 -07:00
										 |  |  | var dartapidocs = require('./tools/build/dartapidocs'); | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | var jsserve = require('./tools/build/jsserve'); | 
					
						
							|  |  |  | var pubserve = require('./tools/build/pubserve'); | 
					
						
							| 
									
										
										
										
											2015-04-27 16:11:20 -07:00
										 |  |  | var karma = require('karma'); | 
					
						
							| 
									
										
										
										
											2014-11-07 18:29:19 +01:00
										 |  |  | var minimist = require('minimist'); | 
					
						
							| 
									
										
										
										
											2015-02-20 17:44:23 -08:00
										 |  |  | var runServerDartTests = require('./tools/build/run_server_dart_tests'); | 
					
						
							| 
									
										
										
										
											2015-03-30 13:25:18 -07:00
										 |  |  | var sourcemaps = require('gulp-sourcemaps'); | 
					
						
							|  |  |  | var tsc = require('gulp-typescript'); | 
					
						
							| 
									
										
										
										
											2015-02-23 17:56:47 -08:00
										 |  |  | var util = require('./tools/build/util'); | 
					
						
							| 
									
										
										
										
											2015-03-23 13:18:05 -07:00
										 |  |  | var bundler = require('./tools/build/bundle'); | 
					
						
							| 
									
										
										
										
											2015-04-02 19:53:11 -07:00
										 |  |  | var replace = require('gulp-replace'); | 
					
						
							|  |  |  | var insert = require('gulp-insert'); | 
					
						
							| 
									
										
										
										
											2015-08-20 13:19:34 -07:00
										 |  |  | var buildRouter = require('./modules/angular1_router/build'); | 
					
						
							| 
									
										
										
										
											2015-06-08 17:15:40 -07:00
										 |  |  | var uglify = require('gulp-uglify'); | 
					
						
							| 
									
										
										
										
											2015-05-22 11:19:45 -04:00
										 |  |  | var shouldLog = require('./tools/build/logging'); | 
					
						
							| 
									
										
										
										
											2015-06-24 15:36:16 -07:00
										 |  |  | var tslint = require('gulp-tslint'); | 
					
						
							| 
									
										
										
										
											2015-06-17 13:24:59 +02:00
										 |  |  | var dartSdk = require('./tools/build/dart'); | 
					
						
							| 
									
										
										
										
											2015-06-02 16:29:09 +02:00
										 |  |  | var sauceConf = require('./sauce.conf'); | 
					
						
							| 
									
										
										
										
											2015-05-22 11:19:45 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-05 23:37:09 -07:00
										 |  |  | require('./tools/check-environment')({ | 
					
						
							|  |  |  |   requiredNpmVersion: '>=2.9.0', | 
					
						
							|  |  |  |   requiredNodeVersion: '>=0.12.2' | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-22 11:19:45 -04:00
										 |  |  | // Make it easy to quiet down portions of the build.
 | 
					
						
							|  |  |  | // --logs=all -> log everything (This is the default)
 | 
					
						
							|  |  |  | // --logs=quiet -> log nothing
 | 
					
						
							|  |  |  | // --logs=<comma-separated-list> -> log listed items.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // Not all commands support optional logging, feel free
 | 
					
						
							|  |  |  | // to add support by adding a new key to this list,
 | 
					
						
							|  |  |  | // and toggling output from the command based on it.
 | 
					
						
							|  |  |  | var logs = { | 
					
						
							|  |  |  |   dartfmt: shouldLog('dartfmt') | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2015-04-26 00:31:53 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | // dynamic require in build.tools so we can bootstrap TypeScript compilation
 | 
					
						
							|  |  |  | function throwToolsBuildMissingError() { | 
					
						
							|  |  |  |   throw new Error('ERROR: build.tools task should have been run before using angularBuilder'); | 
					
						
							| 
									
										
										
										
											2015-04-13 09:52:02 -07:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2015-04-26 00:31:53 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | var angularBuilder = { | 
					
						
							|  |  |  |   rebuildBrowserDevTree: throwToolsBuildMissingError, | 
					
						
							|  |  |  |   rebuildBrowserProdTree: throwToolsBuildMissingError, | 
					
						
							|  |  |  |   rebuildNodeTree: throwToolsBuildMissingError, | 
					
						
							|  |  |  |   rebuildDartTree: throwToolsBuildMissingError, | 
					
						
							| 
									
										
										
										
											2015-06-05 23:43:11 -07:00
										 |  |  |   mock: true | 
					
						
							| 
									
										
										
										
											2015-04-26 00:31:53 -07:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2014-12-22 17:50:10 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-13 22:21:04 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-19 16:51:57 -07:00
										 |  |  | function sequenceComplete(done) { | 
					
						
							|  |  |  |   return function (err) { | 
					
						
							|  |  |  |     if (err) { | 
					
						
							|  |  |  |       var error = new Error('build sequence failed'); | 
					
						
							|  |  |  |       error.showStack = false; | 
					
						
							|  |  |  |       done(error); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |       done(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-13 22:21:04 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | var treatTestErrorsAsFatal = true; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function runJasmineTests(globs, done) { | 
					
						
							| 
									
										
										
										
											2015-05-13 22:40:53 -04:00
										 |  |  |   var args = ['--'].concat(globs); | 
					
						
							|  |  |  |   fork('./tools/traceur-jasmine', args, { | 
					
						
							| 
									
										
										
										
											2015-05-13 22:21:04 -07:00
										 |  |  |     stdio: 'inherit' | 
					
						
							|  |  |  |   }).on('close', function jasmineCloseHandler(exitCode) { | 
					
						
							|  |  |  |     if (exitCode && treatTestErrorsAsFatal) { | 
					
						
							| 
									
										
										
										
											2015-05-14 10:00:53 -07:00
										 |  |  |       var err = new Error('Jasmine tests failed'); | 
					
						
							|  |  |  |       // Mark the error for gulp similar to how gulp-utils.PluginError does it.
 | 
					
						
							|  |  |  |       // The stack is not useful in this context.
 | 
					
						
							|  |  |  |       err.showStack = false; | 
					
						
							|  |  |  |       done(err); | 
					
						
							| 
									
										
										
										
											2015-05-13 22:21:04 -07:00
										 |  |  |     } else { | 
					
						
							|  |  |  |       done(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2015-05-07 22:37:35 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | // Note: when DART_SDK is not found, all gulp tasks ending with `.dart` will be skipped.
 | 
					
						
							| 
									
										
										
										
											2015-06-17 13:24:59 +02:00
										 |  |  | var DART_SDK = dartSdk.detect(gulp); | 
					
						
							| 
									
										
										
										
											2015-03-23 13:18:05 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | // -----------------------
 | 
					
						
							|  |  |  | // configuration
 | 
					
						
							| 
									
										
										
										
											2014-09-18 14:56:38 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | var CONFIG = { | 
					
						
							|  |  |  |   dest: { | 
					
						
							|  |  |  |     js: { | 
					
						
							|  |  |  |       all: 'dist/js', | 
					
						
							| 
									
										
										
										
											2015-02-06 21:04:43 -08:00
										 |  |  |       dev: { | 
					
						
							|  |  |  |         es6: 'dist/js/dev/es6', | 
					
						
							|  |  |  |         es5: 'dist/js/dev/es5' | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       prod: { | 
					
						
							|  |  |  |         es6: 'dist/js/prod/es6', | 
					
						
							|  |  |  |         es5: 'dist/js/prod/es5' | 
					
						
							|  |  |  |       }, | 
					
						
							| 
									
										
										
										
											2015-02-11 11:40:29 -08:00
										 |  |  |       cjs: 'dist/js/cjs', | 
					
						
							| 
									
										
										
										
											2014-12-22 17:50:10 -08:00
										 |  |  |       dart2js: 'dist/js/dart2js' | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  |     }, | 
					
						
							| 
									
										
										
										
											2015-01-06 15:19:22 -08:00
										 |  |  |     dart: 'dist/dart', | 
					
						
							| 
									
										
										
										
											2015-06-19 19:04:41 +01:00
										 |  |  |     docs: 'dist/docs', | 
					
						
							| 
									
										
										
										
											2015-06-23 15:26:51 -07:00
										 |  |  |     docs_angular_io: 'dist/angular.io', | 
					
						
							|  |  |  |     benchpress_bundle: 'dist/build/benchpress_bundle/' | 
					
						
							| 
									
										
										
										
											2014-11-17 20:47:05 -08:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2014-10-08 16:15:38 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-23 15:26:51 -07:00
										 |  |  | var BENCHPRESS_BUNDLE_CONFIG = { | 
					
						
							|  |  |  |   entries: ['./dist/js/cjs/benchpress/index.js'], | 
					
						
							|  |  |  |   packageJson: './dist/js/cjs/benchpress/package.json', | 
					
						
							|  |  |  |   includes: [ | 
					
						
							| 
									
										
										
										
											2015-06-29 11:28:23 -07:00
										 |  |  |     'angular2' | 
					
						
							| 
									
										
										
										
											2015-06-23 15:26:51 -07:00
										 |  |  |   ], | 
					
						
							|  |  |  |   excludes: [ | 
					
						
							| 
									
										
										
										
											2015-06-29 11:28:23 -07:00
										 |  |  |     'traceur', | 
					
						
							| 
									
										
										
										
											2015-06-29 11:28:23 -07:00
										 |  |  |     'traceur/bin/traceur-runtime', | 
					
						
							| 
									
										
										
										
											2015-06-29 11:28:23 -07:00
										 |  |  |     'reflect-metadata', | 
					
						
							| 
									
										
										
										
											2015-06-23 15:26:51 -07:00
										 |  |  |     'selenium-webdriver', | 
					
						
							|  |  |  |     'rtts_assert', | 
					
						
							|  |  |  |     'zone.js' | 
					
						
							|  |  |  |   ], | 
					
						
							|  |  |  |   ignore: [ | 
					
						
							|  |  |  |     'rx' | 
					
						
							|  |  |  |   ], | 
					
						
							|  |  |  |   dest: CONFIG.dest.benchpress_bundle | 
					
						
							| 
									
										
										
										
											2015-07-20 15:54:30 -07:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2015-06-23 15:26:51 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | // ------------
 | 
					
						
							|  |  |  | // clean
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-27 00:46:48 -07:00
										 |  |  | gulp.task('build/clean.tools', function() { | 
					
						
							| 
									
										
										
										
											2015-05-04 08:32:58 -07:00
										 |  |  |   del(path.join('dist', 'tools')); | 
					
						
							| 
									
										
										
										
											2015-04-27 00:46:48 -07:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-04-26 23:14:52 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-19 21:53:06 -07:00
										 |  |  | gulp.task('build/clean.js', function(done) { | 
					
						
							|  |  |  |   del(CONFIG.dest.js.all, done); | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-19 21:53:06 -07:00
										 |  |  | gulp.task('build/clean.dart', function(done) { | 
					
						
							|  |  |  |   del(CONFIG.dest.dart, done); | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-19 21:53:06 -07:00
										 |  |  | gulp.task('build/clean.docs',  function(done) { | 
					
						
							|  |  |  |   del(CONFIG.dest.docs, done); | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-01-16 14:21:55 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-19 19:04:41 +01:00
										 |  |  | gulp.task('build/clean.docs_angular_io', function(done) { | 
					
						
							|  |  |  |   del(CONFIG.dest.docs_angular_io, done); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-23 15:26:51 -07:00
										 |  |  | gulp.task('build/clean.benchpress.bundle', function(done) { | 
					
						
							|  |  |  |   del(CONFIG.dest.benchpress_bundle, done); | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-01-06 15:19:22 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | // ------------
 | 
					
						
							|  |  |  | // transpile
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-06 08:45:28 -07:00
										 |  |  | gulp.task('build/tree.dart', ['build/clean.dart', 'build.tools'], function(done) { | 
					
						
							| 
									
										
										
										
											2015-05-19 16:51:57 -07:00
										 |  |  |   runSequence('!build/tree.dart', sequenceComplete(done)); | 
					
						
							| 
									
										
										
										
											2015-05-06 08:45:28 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('!build/tree.dart', function() { | 
					
						
							| 
									
										
										
										
											2015-04-26 00:31:53 -07:00
										 |  |  |   return angularBuilder.rebuildDartTree(); | 
					
						
							| 
									
										
										
										
											2015-03-18 14:42:18 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-06 08:45:28 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | // ------------
 | 
					
						
							|  |  |  | // pubspec
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-19 11:36:27 -07:00
										 |  |  | // Run a top-level `pub get` for this project.
 | 
					
						
							|  |  |  | gulp.task('pubget.dart', pubget.dir(gulp, gulpPlugins, { dir: '.', command: DART_SDK.PUB })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-14 13:14:45 -07:00
										 |  |  | // Run `pub get` only on the angular2 dir of CONFIG.dest.dart
 | 
					
						
							|  |  |  | gulp.task('!build/pubget.angular2.dart', pubget.dir(gulp, gulpPlugins, { | 
					
						
							|  |  |  |   dir: path.join(CONFIG.dest.dart, 'angular2'), | 
					
						
							|  |  |  |   command: DART_SDK.PUB | 
					
						
							|  |  |  | })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-19 11:36:27 -07:00
										 |  |  | // Run `pub get` over CONFIG.dest.dart
 | 
					
						
							|  |  |  | gulp.task('build/pubspec.dart', pubget.subDir(gulp, gulpPlugins, { | 
					
						
							| 
									
										
										
										
											2015-02-23 17:56:47 -08:00
										 |  |  |   dir: CONFIG.dest.dart, | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  |   command: DART_SDK.PUB | 
					
						
							|  |  |  | })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-30 21:37:14 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | // This is a hacky way to work around dart's pub that creates `packages` symlink in every directory
 | 
					
						
							|  |  |  | // that contains a dart file with the main method. For our tests this means that every test subfolder
 | 
					
						
							|  |  |  | // has a link to the root `packages` directory which causes Karma to sift through 80k files during
 | 
					
						
							|  |  |  | // each `karma run` invocation.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // Since these directories are not needed for karma tests to run, it's safe to delete them without
 | 
					
						
							|  |  |  | // breaking any functionality.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // See #2437 for more info.
 | 
					
						
							|  |  |  | gulp.task('!build/remove-pub-symlinks', function(done) { | 
					
						
							|  |  |  |   if (process.platform == 'win32') { | 
					
						
							|  |  |  |     done(); | 
					
						
							|  |  |  |     return; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   exec('find dist/dart/angular2/test/ -name packages | xargs rm -r', function (error, stdout, stderr) { | 
					
						
							|  |  |  |     if (error) { | 
					
						
							|  |  |  |       done(stderr); | 
					
						
							|  |  |  |       return; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     done(); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | // ------------
 | 
					
						
							| 
									
										
										
										
											2014-12-22 17:50:10 -08:00
										 |  |  | // dartanalyzer
 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | gulp.task('build/analyze.dart', dartanalyzer(gulp, gulpPlugins, { | 
					
						
							|  |  |  |   dest: CONFIG.dest.dart, | 
					
						
							| 
									
										
										
										
											2015-02-02 16:25:34 -08:00
										 |  |  |   command: DART_SDK.ANALYZER | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | })); | 
					
						
							| 
									
										
										
										
											2014-10-08 16:15:38 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-03 17:22:30 -07:00
										 |  |  | gulp.task('build/analyze.ddc.dart', dartanalyzer(gulp, gulpPlugins, { | 
					
						
							|  |  |  |   dest: CONFIG.dest.dart, | 
					
						
							|  |  |  |   command: DART_SDK.ANALYZER, | 
					
						
							|  |  |  |   use_ddc: true | 
					
						
							|  |  |  | })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-06 15:07:33 -07:00
										 |  |  | gulp.task('build/check.apidocs.dart', dartapidocs(gulp, gulpPlugins, { | 
					
						
							|  |  |  |   dest: CONFIG.dest.dart, | 
					
						
							|  |  |  |   command: DART_SDK.DARTDOCGEN | 
					
						
							|  |  |  | })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-22 17:50:10 -08:00
										 |  |  | // ------------
 | 
					
						
							|  |  |  | // pubbuild
 | 
					
						
							| 
									
										
										
										
											2015-07-20 15:54:30 -07:00
										 |  |  | // WARNING: this task is very slow (~15m as of July 2015)
 | 
					
						
							| 
									
										
										
										
											2014-12-22 17:50:10 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | gulp.task('build/pubbuild.dart', pubbuild(gulp, gulpPlugins, { | 
					
						
							|  |  |  |   src: CONFIG.dest.dart, | 
					
						
							|  |  |  |   dest: CONFIG.dest.js.dart2js, | 
					
						
							|  |  |  |   command: DART_SDK.PUB | 
					
						
							|  |  |  | })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-30 11:03:11 -08:00
										 |  |  | // ------------
 | 
					
						
							| 
									
										
										
										
											2015-04-01 10:45:56 -07:00
										 |  |  | // formatting
 | 
					
						
							| 
									
										
										
										
											2015-01-30 11:03:11 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-11 13:29:32 -07:00
										 |  |  | function doCheckFormat() { | 
					
						
							| 
									
										
										
										
											2015-06-12 09:25:57 -07:00
										 |  |  |   return gulp.src(['modules/**/*.ts', 'tools/**/*.ts', '!**/typings/**/*.d.ts']) | 
					
						
							| 
									
										
										
										
											2015-06-25 16:21:43 -07:00
										 |  |  |       .pipe(gulpFormat.checkFormat('file', clangFormat)); | 
					
						
							| 
									
										
										
										
											2015-04-11 13:29:32 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-01 10:45:56 -07:00
										 |  |  | gulp.task('check-format', function() { | 
					
						
							| 
									
										
										
										
											2015-04-11 13:29:32 -07:00
										 |  |  |   return doCheckFormat().on('warning', function(e) { | 
					
						
							|  |  |  |     console.log("NOTE: this will be promoted to an ERROR in the continuous build"); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('enforce-format', function() { | 
					
						
							|  |  |  |   return doCheckFormat().on('warning', function(e) { | 
					
						
							| 
									
										
										
										
											2015-05-22 09:56:31 -07:00
										 |  |  |     console.log("ERROR: You forgot to run clang-format on your change."); | 
					
						
							|  |  |  |     console.log("See https://github.com/angular/angular/blob/master/DEVELOPER.md#formatting"); | 
					
						
							| 
									
										
										
										
											2015-04-11 13:29:32 -07:00
										 |  |  |     process.exit(1); | 
					
						
							|  |  |  |   }); | 
					
						
							| 
									
										
										
										
											2015-04-01 10:45:56 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-24 15:36:16 -07:00
										 |  |  | gulp.task('lint', ['build.tools'], function() { | 
					
						
							| 
									
										
										
										
											2015-07-07 20:03:00 -07:00
										 |  |  |   // Built-in rules are at
 | 
					
						
							| 
									
										
										
										
											2015-06-24 15:36:16 -07:00
										 |  |  |   // https://github.com/palantir/tslint#supported-rules
 | 
					
						
							|  |  |  |   var tslintConfig = { | 
					
						
							|  |  |  |     "rules": { | 
					
						
							| 
									
										
										
										
											2015-07-15 12:12:23 -07:00
										 |  |  |       "semicolon": true, | 
					
						
							| 
									
										
										
										
											2015-07-07 20:03:00 -07:00
										 |  |  |       "requireReturnType": true, | 
					
						
							|  |  |  |       "requireParameterType": true | 
					
						
							| 
									
										
										
										
											2015-06-24 15:36:16 -07:00
										 |  |  |     } | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return gulp.src(['modules/angular2/src/**/*.ts', '!modules/angular2/src/test_lib/**']) | 
					
						
							|  |  |  |       .pipe(tslint({configuration: tslintConfig, rulesDirectory: 'dist/tools/tslint'})) | 
					
						
							| 
									
										
										
										
											2015-07-07 20:03:00 -07:00
										 |  |  |       .pipe(tslint.report('prose', {emitError: true})); | 
					
						
							| 
									
										
										
										
											2015-06-24 15:36:16 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-16 18:48:14 +01:00
										 |  |  | // ------------
 | 
					
						
							|  |  |  | // check circular dependencies in Node.js context
 | 
					
						
							|  |  |  | gulp.task('build/checkCircularDependencies', function (done) { | 
					
						
							|  |  |  |   var dependencyObject = madge(CONFIG.dest.js.dev.es6, { | 
					
						
							|  |  |  |     format: 'es6', | 
					
						
							|  |  |  |     paths: [CONFIG.dest.js.dev.es6], | 
					
						
							| 
									
										
										
										
											2015-06-10 00:02:37 -07:00
										 |  |  |     extensions: ['.js'], | 
					
						
							| 
									
										
										
										
											2015-03-16 18:48:14 +01:00
										 |  |  |     onParseFile: function(data) { | 
					
						
							|  |  |  |       data.src = data.src.replace(/import \* as/g, "//import * as"); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   var circularDependencies = dependencyObject.circular().getArray(); | 
					
						
							|  |  |  |   if (circularDependencies.length > 0) { | 
					
						
							|  |  |  |     console.log(circularDependencies); | 
					
						
							|  |  |  |     process.exit(1); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   done(); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-12 10:30:08 -07:00
										 |  |  | function jsServeDev() { | 
					
						
							|  |  |  |   return jsserve(gulp, gulpPlugins, { | 
					
						
							|  |  |  |     path: CONFIG.dest.js.dev.es5, | 
					
						
							|  |  |  |     port: 8000 | 
					
						
							|  |  |  |   })(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function jsServeProd() { | 
					
						
							|  |  |  |   return jsserve(gulp, gulpPlugins, { | 
					
						
							|  |  |  |     path: CONFIG.dest.js.prod.es5, | 
					
						
							|  |  |  |     port: 8001 | 
					
						
							|  |  |  |   })(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function jsServeDartJs() { | 
					
						
							|  |  |  |   return jsserve(gulp, gulpPlugins, { | 
					
						
							|  |  |  |     path: CONFIG.dest.js.dart2js, | 
					
						
							|  |  |  |     port: 8002 | 
					
						
							|  |  |  |   })(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-20 15:54:30 -07:00
										 |  |  | function proxyServeDart() { | 
					
						
							|  |  |  |   return jsserve(gulp, gulpPlugins, { | 
					
						
							|  |  |  |     port: 8002, | 
					
						
							|  |  |  |     proxies: [ | 
					
						
							|  |  |  |       {route: '/examples', url: 'http://localhost:8004'}, | 
					
						
							|  |  |  |       {route: '/benchmarks_external', url: 'http://localhost:8008'}, | 
					
						
							|  |  |  |       {route: '/benchmarks', url: 'http://localhost:8006'} | 
					
						
							|  |  |  |     ] | 
					
						
							|  |  |  |   })(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-18 14:56:38 -07:00
										 |  |  | // ------------------
 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | // web servers
 | 
					
						
							| 
									
										
										
										
											2015-04-27 15:24:32 -07:00
										 |  |  | gulp.task('serve.js.dev', ['build.js.dev'], function(neverDone) { | 
					
						
							| 
									
										
										
										
											2015-06-08 21:53:51 -07:00
										 |  |  |   watch('modules/**', { ignoreInitial: true }, '!broccoli.js.dev'); | 
					
						
							| 
									
										
										
										
											2015-06-12 10:30:08 -07:00
										 |  |  |   jsServeDev(); | 
					
						
							| 
									
										
										
										
											2015-06-10 16:52:19 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-12 10:30:08 -07:00
										 |  |  | gulp.task('serve.js.prod', jsServeProd); | 
					
						
							| 
									
										
										
										
											2015-04-27 15:24:32 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-12 10:30:08 -07:00
										 |  |  | gulp.task('serve.e2e.dev', ['build.js.dev', 'build.js.cjs', 'build.css.material'], function(neverDone) { | 
					
						
							|  |  |  |   watch('modules/**', { ignoreInitial: true }, ['!broccoli.js.dev', '!build.js.cjs']); | 
					
						
							|  |  |  |   jsServeDev(); | 
					
						
							| 
									
										
										
										
											2015-04-27 15:24:32 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-12 10:30:08 -07:00
										 |  |  | gulp.task('serve.e2e.prod', ['build.js.prod', 'build.js.cjs', 'build.css.material'], function(neverDone) { | 
					
						
							|  |  |  |   watch('modules/**', { ignoreInitial: true }, ['!broccoli.js.prod', '!build.js.cjs']); | 
					
						
							|  |  |  |   jsServeProd(); | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2014-12-22 17:50:10 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-12 10:30:08 -07:00
										 |  |  | gulp.task('serve.js.dart2js', jsServeDartJs); | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-20 15:54:30 -07:00
										 |  |  | gulp.task('!proxyServeDart', proxyServeDart); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('serve.dart', function(done) { | 
					
						
							|  |  |  |   runSequence([ | 
					
						
							|  |  |  |     '!proxyServeDart', | 
					
						
							|  |  |  |     'serve/examples.dart', | 
					
						
							|  |  |  |     'serve/benchmarks.dart', | 
					
						
							|  |  |  |     'serve/benchmarks_external.dart' | 
					
						
							|  |  |  |   ], done); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | gulp.task('serve/examples.dart', pubserve(gulp, gulpPlugins, { | 
					
						
							|  |  |  |   command: DART_SDK.PUB, | 
					
						
							| 
									
										
										
										
											2015-07-20 15:54:30 -07:00
										 |  |  |   path: CONFIG.dest.dart + '/examples', | 
					
						
							|  |  |  |   port: 8004 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('serve/benchmarks.dart', pubserve(gulp, gulpPlugins, { | 
					
						
							|  |  |  |   command: DART_SDK.PUB, | 
					
						
							| 
									
										
										
										
											2015-07-20 15:54:30 -07:00
										 |  |  |   path: CONFIG.dest.dart + '/benchmarks', | 
					
						
							|  |  |  |   port: 8006 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('serve/benchmarks_external.dart', pubserve(gulp, gulpPlugins, { | 
					
						
							|  |  |  |   command: DART_SDK.PUB, | 
					
						
							| 
									
										
										
										
											2015-07-20 15:54:30 -07:00
										 |  |  |   path: CONFIG.dest.dart + '/benchmarks_external', | 
					
						
							|  |  |  |   port: 8008 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | })); | 
					
						
							| 
									
										
										
										
											2014-12-04 14:02:03 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-22 09:42:05 -07:00
										 |  |  | gulp.task('serve.e2e.dart', ['build.js.cjs'], function(neverDone) { | 
					
						
							|  |  |  |   // Note: we are not using build.dart as the dart analyzer takes too long...
 | 
					
						
							|  |  |  |   watch('modules/**', { ignoreInitial: true }, ['!build/tree.dart', '!build.js.cjs']); | 
					
						
							|  |  |  |   runSequence('build/packages.dart', 'build/pubspec.dart', 'build.dart.material.css', 'serve.dart'); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-04 14:02:03 +00:00
										 |  |  | // --------------
 | 
					
						
							|  |  |  | // doc generation
 | 
					
						
							|  |  |  | var Dgeni = require('dgeni'); | 
					
						
							|  |  |  | var bower = require('bower'); | 
					
						
							| 
									
										
										
										
											2015-03-17 16:49:31 +00:00
										 |  |  | var webserver = require('gulp-webserver'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-04 14:02:03 +00:00
										 |  |  | gulp.task('docs/bower', function() { | 
					
						
							|  |  |  |   var bowerTask = bower.commands.install(undefined, undefined, { cwd: 'docs' }); | 
					
						
							|  |  |  |   bowerTask.on('log', function (result) { | 
					
						
							| 
									
										
										
										
											2015-08-25 14:18:07 -07:00
										 |  |  |     console.log('bower:', result.id, result.data); | 
					
						
							| 
									
										
										
										
											2014-12-04 14:02:03 +00:00
										 |  |  |   }); | 
					
						
							|  |  |  |   bowerTask.on('error', function(error) { | 
					
						
							|  |  |  |     console.log(error); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   return bowerTask; | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-11 07:21:21 +01:00
										 |  |  | function createDocsTasks(options) { | 
					
						
							|  |  |  |   var dgeniPackage = options.package; | 
					
						
							|  |  |  |   var distDocsPath = options.path; | 
					
						
							|  |  |  |   var taskPrefix = options.prefix; | 
					
						
							| 
									
										
										
										
											2014-12-04 14:02:03 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-17 16:49:31 +00:00
										 |  |  |   gulp.task(taskPrefix + '/dgeni', function() { | 
					
						
							|  |  |  |     try { | 
					
						
							|  |  |  |       var dgeni = new Dgeni([require(dgeniPackage)]); | 
					
						
							|  |  |  |       return dgeni.generate(); | 
					
						
							|  |  |  |     } catch(x) { | 
					
						
							| 
									
										
										
										
											2015-04-15 22:35:38 +00:00
										 |  |  |       console.log(x); | 
					
						
							| 
									
										
										
										
											2015-03-17 16:49:31 +00:00
										 |  |  |       console.log(x.stack); | 
					
						
							|  |  |  |       throw x; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }); | 
					
						
							| 
									
										
										
										
											2014-12-04 14:02:03 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-17 16:49:31 +00:00
										 |  |  |   gulp.task(taskPrefix + '/assets', ['docs/bower'], function() { | 
					
						
							|  |  |  |     return gulp.src('docs/bower_components/**/*') | 
					
						
							|  |  |  |       .pipe(gulp.dest(distDocsPath + '/lib')); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   gulp.task(taskPrefix + '/app', function() { | 
					
						
							|  |  |  |     return gulp.src('docs/app/**/*') | 
					
						
							|  |  |  |       .pipe(gulp.dest(distDocsPath)); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   gulp.task(taskPrefix, [taskPrefix + '/assets', taskPrefix + '/app', taskPrefix + '/dgeni']); | 
					
						
							|  |  |  |   gulp.task(taskPrefix + '/watch', function() { | 
					
						
							| 
									
										
										
										
											2015-06-02 13:07:36 -05:00
										 |  |  |     return watch('docs/app/**/*', [taskPrefix + '/app']); | 
					
						
							| 
									
										
										
										
											2015-03-17 16:49:31 +00:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-26 02:40:13 -07:00
										 |  |  |   gulp.task(taskPrefix + '/test', function (done) { | 
					
						
							| 
									
										
										
										
											2015-05-13 22:21:04 -07:00
										 |  |  |     runJasmineTests(['docs/**/*.spec.js'], done); | 
					
						
							| 
									
										
										
										
											2015-03-17 16:49:31 +00:00
										 |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   gulp.task(taskPrefix + '/serve', function() { | 
					
						
							|  |  |  |     gulp.src(distDocsPath + '/') | 
					
						
							|  |  |  |       .pipe(webserver({ | 
					
						
							|  |  |  |         fallback: 'index.html' | 
					
						
							| 
									
										
										
										
											2014-12-06 10:41:07 +00:00
										 |  |  |       })); | 
					
						
							| 
									
										
										
										
											2015-03-17 16:49:31 +00:00
										 |  |  |   }); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2014-12-04 14:02:03 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-11 07:21:21 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | createDocsTasks({ package: './docs/docs-package', path: 'dist/docs', prefix: 'docs'}); | 
					
						
							|  |  |  | createDocsTasks({ package: './docs/public-docs-package', path: 'dist/public_docs', prefix: 'public_docs'}); | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-19 19:04:41 +01:00
										 |  |  | gulp.task('docs/angular.io', ['build/clean.docs_angular_io'], function() { | 
					
						
							| 
									
										
										
										
											2015-04-25 14:29:20 -07:00
										 |  |  |   try { | 
					
						
							|  |  |  |     var dgeni = new Dgeni([require('./docs/angular.io-package')]); | 
					
						
							|  |  |  |     return dgeni.generate(); | 
					
						
							|  |  |  |   } catch(x) { | 
					
						
							|  |  |  |     console.log(x); | 
					
						
							|  |  |  |     console.log(x.stack); | 
					
						
							|  |  |  |     throw x; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-11 07:21:21 +01:00
										 |  |  | gulp.task('docs/typings', [], function() { | 
					
						
							|  |  |  |   try { | 
					
						
							|  |  |  |     var dgeni = new Dgeni([require('./docs/typescript-definition-package')]); | 
					
						
							|  |  |  |     return dgeni.generate(); | 
					
						
							|  |  |  |   } catch(x) { | 
					
						
							|  |  |  |     console.log(x); | 
					
						
							|  |  |  |     console.log(x.stack); | 
					
						
							|  |  |  |     throw x; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-25 14:29:20 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-07 18:29:19 +01:00
										 |  |  | // ------------------
 | 
					
						
							| 
									
										
										
										
											2015-03-19 11:36:27 -07:00
										 |  |  | // CI tests suites
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-09 13:44:42 +02:00
										 |  |  | function runKarma(configFile, done) { | 
					
						
							|  |  |  |   var cmd = process.platform === 'win32' ? 'node_modules\\.bin\\karma run ' : | 
					
						
							|  |  |  |                                            'node node_modules/.bin/karma run '; | 
					
						
							|  |  |  |   cmd += configFile; | 
					
						
							|  |  |  |   exec(cmd, function(e, stdout) { | 
					
						
							|  |  |  |     // ignore errors, we don't want to fail the build in the interactive (non-ci) mode
 | 
					
						
							|  |  |  |     // karma server will print all test failures
 | 
					
						
							|  |  |  |     done(); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-19 11:36:27 -07:00
										 |  |  | gulp.task('test.js', function(done) { | 
					
						
							| 
									
										
										
										
											2015-04-26 23:16:10 -07:00
										 |  |  |   runSequence('test.unit.tools/ci', 'test.transpiler.unittest', 'docs/test', 'test.unit.js/ci', | 
					
						
							| 
									
										
										
										
											2015-06-16 10:46:12 -07:00
										 |  |  |               'test.unit.cjs/ci', 'test.typings', sequenceComplete(done)); | 
					
						
							| 
									
										
										
										
											2015-03-19 11:36:27 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('test.dart', function(done) { | 
					
						
							| 
									
										
										
										
											2015-06-17 13:24:59 +02:00
										 |  |  |   runSequence('versions.dart', 'test.transpiler.unittest', 'docs/test', 'test.unit.dart/ci', | 
					
						
							|  |  |  |               sequenceComplete(done)); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('versions.dart', function() { | 
					
						
							|  |  |  |   dartSdk.logVersion(DART_SDK); | 
					
						
							| 
									
										
										
										
											2015-03-19 11:36:27 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Reuse the Travis scripts
 | 
					
						
							|  |  |  | // TODO: rename test_*.sh to test_all_*.sh
 | 
					
						
							| 
									
										
										
										
											2015-08-30 22:17:20 +02:00
										 |  |  | gulp.task('test.all.js', shell.task(['./scripts/ci/test_js.sh'])); | 
					
						
							|  |  |  | gulp.task('test.all.dart', shell.task(['./scripts/ci/test_dart.sh'])); | 
					
						
							| 
									
										
										
										
											2015-03-19 11:36:27 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-20 17:44:23 -08:00
										 |  |  | // karma tests
 | 
					
						
							|  |  |  | //     These tests run in the browser and are allowed to access
 | 
					
						
							|  |  |  | //     HTML DOM APIs.
 | 
					
						
							| 
									
										
										
										
											2014-11-07 18:29:19 +01:00
										 |  |  | function getBrowsersFromCLI() { | 
					
						
							| 
									
										
										
										
											2015-06-02 16:29:09 +02:00
										 |  |  |   var isSauce = false; | 
					
						
							| 
									
										
										
										
											2014-11-07 18:29:19 +01:00
										 |  |  |   var args = minimist(process.argv.slice(2)); | 
					
						
							| 
									
										
										
										
											2015-06-02 16:29:09 +02:00
										 |  |  |   var rawInput = args.browsers?args.browsers:'DartiumWithWebPlatform'; | 
					
						
							|  |  |  |   var inputList = rawInput.replace(' ', '').split(','); | 
					
						
							|  |  |  |   var outputList = []; | 
					
						
							|  |  |  |   for (var i = 0; i < inputList.length; i++) { | 
					
						
							|  |  |  |     var input = inputList[i]; | 
					
						
							| 
									
										
										
										
											2015-08-24 16:24:34 +02:00
										 |  |  |     var karmaChromeLauncher = require('karma-chrome-launcher'); | 
					
						
							|  |  |  |     if (sauceConf.customLaunchers.hasOwnProperty(input) || karmaChromeLauncher.hasOwnProperty("launcher:" + input)) { | 
					
						
							|  |  |  |       // In case of non-sauce browsers, or browsers defined in karma-chrome-launcher (Chrome, ChromeCanary and Dartium):
 | 
					
						
							|  |  |  |       // overrides everything, ignoring other options
 | 
					
						
							| 
									
										
										
										
											2015-06-02 16:29:09 +02:00
										 |  |  |       outputList = [input]; | 
					
						
							|  |  |  |       isSauce = false; | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     } else if (sauceConf.customLaunchers.hasOwnProperty("SL_" + input.toUpperCase())) { | 
					
						
							|  |  |  |       isSauce = true; | 
					
						
							|  |  |  |       outputList.push("SL_" + input.toUpperCase()); | 
					
						
							|  |  |  |     } else if (sauceConf.aliases.hasOwnProperty(input.toUpperCase())) { | 
					
						
							|  |  |  |       outputList = outputList.concat(sauceConf.aliases[input]); | 
					
						
							|  |  |  |       isSauce = true; | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |       throw new Error('ERROR: unknown browser found in getBrowsersFromCLI()'); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   return { | 
					
						
							|  |  |  |     browsersToRun: outputList.filter(function(item, pos, self) {return self.indexOf(item) == pos;}), | 
					
						
							|  |  |  |     isSauce: isSauce | 
					
						
							| 
									
										
										
										
											2015-07-29 17:00:54 -07:00
										 |  |  |   }; | 
					
						
							| 
									
										
										
										
											2014-11-07 18:29:19 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2015-04-27 16:11:20 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-02 16:29:09 +02:00
										 |  |  | gulp.task('test.unit.js', ['build.js.dev'], function (done) { | 
					
						
							| 
									
										
										
										
											2015-05-06 08:45:28 -07:00
										 |  |  |   runSequence( | 
					
						
							|  |  |  |     '!test.unit.js/karma-server', | 
					
						
							| 
									
										
										
										
											2015-05-19 23:14:20 -07:00
										 |  |  |     function() { | 
					
						
							|  |  |  |       watch('modules/**', [ | 
					
						
							|  |  |  |         '!broccoli.js.dev', | 
					
						
							|  |  |  |         '!test.unit.js/karma-run' | 
					
						
							|  |  |  |       ]); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-05-06 08:45:28 -07:00
										 |  |  |   ); | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-04-27 16:11:20 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-02 16:29:09 +02:00
										 |  |  | gulp.task('test.unit.js.sauce', ['build.js.dev'], function (done) { | 
					
						
							|  |  |  |   var browserConf = getBrowsersFromCLI(); | 
					
						
							|  |  |  |   if (browserConf.isSauce) { | 
					
						
							| 
									
										
										
										
											2015-07-29 17:00:54 -07:00
										 |  |  |     karma.server.start({ | 
					
						
							|  |  |  |         configFile: __dirname + '/karma-js.conf.js', | 
					
						
							|  |  |  |         singleRun: true, | 
					
						
							|  |  |  |         browserNoActivityTimeout: 240000, | 
					
						
							|  |  |  |         captureTimeout: 120000, | 
					
						
							|  |  |  |         reporters: ['dots'], | 
					
						
							|  |  |  |         browsers: browserConf.browsersToRun}, | 
					
						
							| 
									
										
										
										
											2015-08-30 22:17:20 +02:00
										 |  |  |       function(err) {done(); process.exit(err ? 1 : 0);}); | 
					
						
							| 
									
										
										
										
											2015-06-02 16:29:09 +02:00
										 |  |  |   } else { | 
					
						
							|  |  |  |     throw new Error('ERROR: no Saucelabs browsers provided, add them with the --browsers option'); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-04-27 16:11:20 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-06 08:45:28 -07:00
										 |  |  | gulp.task('!test.unit.js/karma-server', function() { | 
					
						
							| 
									
										
										
										
											2015-05-11 12:14:45 -07:00
										 |  |  |   karma.server.start({configFile: __dirname + '/karma-js.conf.js', reporters: 'dots'}); | 
					
						
							| 
									
										
										
										
											2015-04-27 16:11:20 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-06 08:45:28 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | gulp.task('!test.unit.js/karma-run', function(done) { | 
					
						
							| 
									
										
										
										
											2015-05-19 23:14:20 -07:00
										 |  |  |   // run the run command in a new process to avoid duplicate logging by both server and runner from
 | 
					
						
							|  |  |  |   // a single process
 | 
					
						
							| 
									
										
										
										
											2015-06-09 13:44:42 +02:00
										 |  |  |   runKarma('karma-js.conf.js', done); | 
					
						
							| 
									
										
										
										
											2014-11-07 18:29:19 +01:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-04-27 16:11:20 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-20 13:19:34 -07:00
										 |  |  | gulp.task('test.unit.router', function (done) { | 
					
						
							|  |  |  |   runSequence( | 
					
						
							|  |  |  |     '!test.unit.router/karma-server', | 
					
						
							|  |  |  |     function() { | 
					
						
							|  |  |  |       watch('modules/**', [ | 
					
						
							|  |  |  |         'buildRouter.dev', | 
					
						
							|  |  |  |         '!test.unit.router/karma-run' | 
					
						
							|  |  |  |       ]); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   ); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('!test.unit.router/karma-server', function() { | 
					
						
							|  |  |  |   karma.server.start({configFile: __dirname + '/modules/angular1_router/karma-router.conf.js'}); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('!test.unit.router/karma-run', function(done) { | 
					
						
							|  |  |  |   karma.runner.run({configFile: __dirname + '/modules/angular1_router/karma-router.conf.js'}, function(exitCode) { | 
					
						
							|  |  |  |     // ignore exitCode, we don't want to fail the build in the interactive (non-ci) mode
 | 
					
						
							|  |  |  |     // karma will print all test failures
 | 
					
						
							|  |  |  |     done(); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('buildRouter.dev', function () { | 
					
						
							|  |  |  |   buildRouter(); | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-05-06 08:45:28 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-21 23:33:49 -07:00
										 |  |  | gulp.task('test.unit.dart', function (done) { | 
					
						
							| 
									
										
										
										
											2015-05-06 08:45:28 -07:00
										 |  |  |   runSequence( | 
					
						
							| 
									
										
										
										
											2015-05-21 23:33:49 -07:00
										 |  |  |     'build/tree.dart', | 
					
						
							| 
									
										
										
										
											2015-08-25 11:15:18 -07:00
										 |  |  |     'build/pure-packages.dart', | 
					
						
							| 
									
										
										
										
											2015-05-29 17:32:43 -07:00
										 |  |  |     '!build/pubget.angular2.dart', | 
					
						
							|  |  |  |     '!build/change_detect.dart', | 
					
						
							| 
									
										
										
										
											2015-06-30 21:37:14 -07:00
										 |  |  |     '!build/remove-pub-symlinks', | 
					
						
							| 
									
										
										
										
											2015-05-06 08:45:28 -07:00
										 |  |  |     '!test.unit.dart/karma-server', | 
					
						
							| 
									
										
										
										
											2015-05-19 23:14:20 -07:00
										 |  |  |     '!test.unit.dart/karma-run', | 
					
						
							| 
									
										
										
										
											2015-05-21 23:33:49 -07:00
										 |  |  |     function(error) { | 
					
						
							|  |  |  |       // if initial build failed (likely due to build or formatting step) then exit
 | 
					
						
							|  |  |  |       // otherwise karma server doesn't start and we can't continue running properly
 | 
					
						
							|  |  |  |       if (error) { | 
					
						
							|  |  |  |         done(error); | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-12 13:03:28 -07:00
										 |  |  |       watch(['modules/angular2/**'], { ignoreInitial: true }, [ | 
					
						
							| 
									
										
										
										
											2015-05-19 23:14:20 -07:00
										 |  |  |         '!build/tree.dart', | 
					
						
							|  |  |  |         '!test.unit.dart/karma-run' | 
					
						
							|  |  |  |       ]); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-05-06 08:45:28 -07:00
										 |  |  |   ); | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-05-04 15:38:08 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-06 08:45:28 -07:00
										 |  |  | gulp.task('!test.unit.dart/karma-run', function (done) { | 
					
						
							| 
									
										
										
										
											2015-05-19 23:14:20 -07:00
										 |  |  |   // run the run command in a new process to avoid duplicate logging by both server and runner from
 | 
					
						
							|  |  |  |   // a single process
 | 
					
						
							| 
									
										
										
										
											2015-06-09 13:44:42 +02:00
										 |  |  |   runKarma('karma-dart.conf.js', done); | 
					
						
							| 
									
										
										
										
											2015-05-04 15:38:08 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-06 08:45:28 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | gulp.task('!test.unit.dart/karma-server', function() { | 
					
						
							| 
									
										
										
										
											2015-05-11 12:14:45 -07:00
										 |  |  |   karma.server.start({configFile: __dirname + '/karma-dart.conf.js', reporters: 'dots'}); | 
					
						
							| 
									
										
										
										
											2014-11-07 18:29:19 +01:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-04-27 16:11:20 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-06 08:45:28 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-20 13:19:34 -07:00
										 |  |  | gulp.task('test.unit.router/ci', function (done) { | 
					
						
							|  |  |  |   var browserConf = getBrowsersFromCLI(); | 
					
						
							|  |  |  |   karma.server.start({configFile: __dirname + '/modules/angular1_router/karma-router.conf.js', | 
					
						
							|  |  |  |       singleRun: true, reporters: ['dots'], browsers: browserConf.browsersToRun}, done); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-20 17:44:23 -08:00
										 |  |  | gulp.task('test.unit.js/ci', function (done) { | 
					
						
							| 
									
										
										
										
											2015-06-02 16:29:09 +02:00
										 |  |  |   var browserConf = getBrowsersFromCLI(); | 
					
						
							|  |  |  |   karma.server.start({configFile: __dirname + '/karma-js.conf.js', | 
					
						
							|  |  |  |       singleRun: true, reporters: ['dots'], browsers: browserConf.browsersToRun}, done); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('test.unit.js.sauce/ci', function (done) { | 
					
						
							| 
									
										
										
										
											2015-04-27 16:11:20 -07:00
										 |  |  |   karma.server.start({configFile: __dirname + '/karma-js.conf.js', | 
					
						
							| 
									
										
										
										
											2015-06-02 16:29:09 +02:00
										 |  |  |     singleRun: true, browserNoActivityTimeout: 240000, captureTimeout: 120000, reporters: ['dots', 'saucelabs'], browsers: sauceConf.aliases.CI}, | 
					
						
							| 
									
										
										
										
											2015-08-30 22:17:20 +02:00
										 |  |  |     function(err) {done(); process.exit(err ? 1 : 0);}); | 
					
						
							| 
									
										
										
										
											2014-11-07 18:29:19 +01:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-04-27 16:11:20 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-20 17:44:23 -08:00
										 |  |  | gulp.task('test.unit.dart/ci', function (done) { | 
					
						
							| 
									
										
										
										
											2015-06-02 16:29:09 +02:00
										 |  |  |   var browserConf = getBrowsersFromCLI(); | 
					
						
							| 
									
										
										
										
											2015-04-27 16:11:20 -07:00
										 |  |  |   karma.server.start({configFile: __dirname + '/karma-dart.conf.js', | 
					
						
							| 
									
										
										
										
											2015-06-02 16:29:09 +02:00
										 |  |  |     singleRun: true, reporters: ['dots'], browsers: browserConf.browsersToRun}, done); | 
					
						
							| 
									
										
										
										
											2014-11-07 18:29:19 +01:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-04-13 18:59:37 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-13 23:56:07 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-26 00:31:53 -07:00
										 |  |  | gulp.task('test.unit.cjs/ci', function(done) { | 
					
						
							| 
									
										
										
										
											2015-08-20 14:28:25 -07:00
										 |  |  |   runJasmineTests(['dist/js/cjs/{angular2,benchpress}/test/**/*_spec.js'], done); | 
					
						
							| 
									
										
										
										
											2015-04-26 00:31:53 -07:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-04-13 23:56:07 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-13 22:21:04 -07:00
										 |  |  | gulp.task('test.unit.cjs', ['build/clean.js', 'build.tools'], function (neverDone) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   treatTestErrorsAsFatal = false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-08 14:20:54 -04:00
										 |  |  |   var buildAndTest = [ | 
					
						
							|  |  |  |     '!build.js.cjs', | 
					
						
							|  |  |  |     'test.unit.cjs/ci' | 
					
						
							|  |  |  |   ]; | 
					
						
							| 
									
										
										
										
											2015-04-27 00:46:48 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-02 13:07:36 -05:00
										 |  |  |   watch('modules/**', buildAndTest); | 
					
						
							| 
									
										
										
										
											2015-03-01 22:17:36 +01:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-02-20 17:44:23 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-24 10:15:52 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-05 11:06:24 -07:00
										 |  |  | gulp.task('test.unit.dartvm', function (done) { | 
					
						
							|  |  |  |   runSequence( | 
					
						
							|  |  |  |     'build/tree.dart', | 
					
						
							| 
									
										
										
										
											2015-08-25 11:15:18 -07:00
										 |  |  |     'build/pure-packages.dart', | 
					
						
							| 
									
										
										
										
											2015-06-05 11:06:24 -07:00
										 |  |  |     'build/pubspec.dart', | 
					
						
							|  |  |  |     '!build/change_detect.dart', | 
					
						
							|  |  |  |     '!test.unit.dartvm/run', | 
					
						
							|  |  |  |     function(error) { | 
					
						
							|  |  |  |       // if initial build failed (likely due to build or formatting step) then exit
 | 
					
						
							|  |  |  |       // otherwise karma server doesn't start and we can't continue running properly
 | 
					
						
							|  |  |  |       if (error) { | 
					
						
							|  |  |  |         done(error); | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       watch('modules/angular2/**', { ignoreInitial: true }, [ | 
					
						
							|  |  |  |         '!build/tree.dart', | 
					
						
							|  |  |  |         '!test.unit.dartvm/run' | 
					
						
							|  |  |  |       ]); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   ); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('!test.unit.dartvm/run', runServerDartTests(gulp, gulpPlugins, { | 
					
						
							|  |  |  |   dir: 'dist/dart/angular2' | 
					
						
							|  |  |  | })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-26 23:14:52 -07:00
										 |  |  | gulp.task('test.unit.tools/ci', function(done) { | 
					
						
							| 
									
										
										
										
											2015-05-13 22:40:53 -04:00
										 |  |  |   runJasmineTests(['dist/tools/**/*.spec.js', 'tools/**/*.spec.js'], done); | 
					
						
							| 
									
										
										
										
											2015-04-24 16:23:25 -07:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-04-24 10:15:52 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-04 08:32:58 -07:00
										 |  |  | gulp.task('test.unit.tools', ['build/clean.tools'],  function(done) { | 
					
						
							| 
									
										
										
										
											2015-05-13 22:21:04 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   treatTestErrorsAsFatal = false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-08 14:20:54 -04:00
										 |  |  |   var buildAndTest = [ | 
					
						
							|  |  |  |     '!build.tools', | 
					
						
							|  |  |  |     'test.unit.tools/ci' | 
					
						
							|  |  |  |   ]; | 
					
						
							| 
									
										
										
										
											2015-04-26 23:14:52 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-02 13:07:36 -05:00
										 |  |  |   watch(['tools/**', '!tools/**/test-fixtures/**'], buildAndTest); | 
					
						
							| 
									
										
										
										
											2015-04-24 10:15:52 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-27 00:46:48 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-20 17:44:23 -08:00
										 |  |  | // ------------------
 | 
					
						
							|  |  |  | // server tests
 | 
					
						
							|  |  |  | //     These tests run on the VM on the command-line and are
 | 
					
						
							|  |  |  | //     allowed to access the file system and network.
 | 
					
						
							|  |  |  | gulp.task('test.server.dart', runServerDartTests(gulp, gulpPlugins, { | 
					
						
							|  |  |  |   dest: 'dist/dart' | 
					
						
							|  |  |  | })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // -----------------
 | 
					
						
							|  |  |  | // test builders
 | 
					
						
							| 
									
										
										
										
											2015-04-26 02:40:13 -07:00
										 |  |  | gulp.task('test.transpiler.unittest', function(done) { | 
					
						
							| 
									
										
										
										
											2015-05-13 22:21:04 -07:00
										 |  |  |   runJasmineTests(['tools/transpiler/unittest/**/*.js'], done); | 
					
						
							| 
									
										
										
										
											2015-02-04 14:59:12 -08:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2014-11-07 18:29:19 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-23 10:36:54 -07:00
										 |  |  | // -----------------
 | 
					
						
							| 
									
										
										
										
											2015-07-29 17:00:54 -07:00
										 |  |  | // Pre-test checks
 | 
					
						
							| 
									
										
										
										
											2015-06-23 10:36:54 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | gulp.task('pre-test-checks', function(done) { | 
					
						
							|  |  |  |   runSequence('build/checkCircularDependencies', sequenceComplete(done)); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-29 17:00:54 -07:00
										 |  |  | // -----------------
 | 
					
						
							|  |  |  | // Checks which should fail the build, but should not block us running the tests.
 | 
					
						
							|  |  |  | // This task is run in a separate travis worker, so these checks provide faster
 | 
					
						
							|  |  |  | // feedback while allowing tests to execute.
 | 
					
						
							|  |  |  | gulp.task('static-checks', ['!build.tools'], function(done) { | 
					
						
							|  |  |  |   runSequence( | 
					
						
							|  |  |  |     ['enforce-format', 'lint', 'test.typings'], | 
					
						
							|  |  |  |     sequenceComplete(done)); | 
					
						
							| 
									
										
										
										
											2015-06-23 10:36:54 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-11 07:21:21 +01:00
										 |  |  | gulp.task('!pre.test.typings', ['docs/typings'], function() { | 
					
						
							| 
									
										
										
										
											2015-06-16 10:46:12 -07:00
										 |  |  |   return gulp | 
					
						
							|  |  |  |     .src([ | 
					
						
							|  |  |  |       'modules/angular2/typings/**/*'], { | 
					
						
							|  |  |  |         base: 'modules/angular2/typings/**' | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  |     .pipe(gulp.dest('dist/docs/typings/*')); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // -----------------
 | 
					
						
							| 
									
										
										
										
											2015-06-23 23:10:07 -07:00
										 |  |  | gulp.task('test.typings', ['!pre.test.typings'], function() { | 
					
						
							| 
									
										
										
										
											2015-07-28 13:10:25 -07:00
										 |  |  |   return gulp.src(['typing_spec/*.ts', 'dist/docs/typings/angular2/*.d.ts', 'dist/docs/typings/http.d.ts']) | 
					
						
							| 
									
										
										
										
											2015-06-16 10:46:12 -07:00
										 |  |  |       .pipe(tsc({target: 'ES5', module: 'commonjs', | 
					
						
							| 
									
										
										
										
											2015-07-29 20:09:54 -07:00
										 |  |  |                  experimentalDecorators: true, | 
					
						
							| 
									
										
										
										
											2015-07-23 09:03:39 +01:00
										 |  |  |                  noImplicitAny: true, | 
					
						
							| 
									
										
										
										
											2015-06-16 10:46:12 -07:00
										 |  |  |                  // Don't use the version of typescript that gulp-typescript depends on, we need 1.5
 | 
					
						
							|  |  |  |                  // see https://github.com/ivogabe/gulp-typescript#typescript-version
 | 
					
						
							| 
									
										
										
										
											2015-06-23 23:10:07 -07:00
										 |  |  |                  typescript: require('typescript')})); | 
					
						
							| 
									
										
										
										
											2015-06-16 10:46:12 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | // -----------------
 | 
					
						
							|  |  |  | // orchestrated targets
 | 
					
						
							| 
									
										
										
										
											2015-02-27 14:50:06 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-23 17:37:05 -07:00
										 |  |  | // Pure Dart packages only contain Dart code and conform to pub package layout.
 | 
					
						
							|  |  |  | // These packages need no transpilation. All code is copied over to `dist`
 | 
					
						
							|  |  |  | // unmodified and directory structure is preserved.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // This task also fixes relative `dependency_overrides` paths in `pubspec.yaml`
 | 
					
						
							|  |  |  | // files.
 | 
					
						
							| 
									
										
										
										
											2015-08-19 10:36:52 -07:00
										 |  |  | //
 | 
					
						
							|  |  |  | // This task is expected to be run after build/tree.dart
 | 
					
						
							| 
									
										
										
										
											2015-04-23 17:37:05 -07:00
										 |  |  | gulp.task('build/pure-packages.dart', function() { | 
					
						
							|  |  |  |   var through2 = require('through2'); | 
					
						
							|  |  |  |   var yaml = require('js-yaml'); | 
					
						
							|  |  |  |   var originalPrefix = '../../dist/dart/'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-19 10:36:52 -07:00
										 |  |  |   var transformStream = gulp | 
					
						
							|  |  |  |     .src([ | 
					
						
							|  |  |  |       'modules_dart/transform/**/*', | 
					
						
							|  |  |  |       '!modules_dart/transform/pubspec.yaml' | 
					
						
							|  |  |  |     ]) | 
					
						
							|  |  |  |     .pipe(gulp.dest(path.join(CONFIG.dest.dart, 'angular2'))); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   var moveStream = gulp | 
					
						
							| 
									
										
										
										
											2015-04-23 17:37:05 -07:00
										 |  |  |     .src([ | 
					
						
							|  |  |  |       'modules_dart/**/*.dart', | 
					
						
							|  |  |  |       'modules_dart/**/pubspec.yaml', | 
					
						
							| 
									
										
										
										
											2015-08-19 10:36:52 -07:00
										 |  |  |       '!modules_dart/transform/**' | 
					
						
							| 
									
										
										
										
											2015-04-23 17:37:05 -07:00
										 |  |  |     ]) | 
					
						
							|  |  |  |     .pipe(through2.obj(function(file, enc, done) { | 
					
						
							|  |  |  |       if (file.path.endsWith('pubspec.yaml')) { | 
					
						
							|  |  |  |         // Pure packages specify dependency_overrides relative to
 | 
					
						
							|  |  |  |         // `modules_dart`, so they have to walk up and into `dist`.
 | 
					
						
							|  |  |  |         //
 | 
					
						
							|  |  |  |         // Example:
 | 
					
						
							| 
									
										
										
										
											2015-04-24 13:17:36 -07:00
										 |  |  |         //
 | 
					
						
							| 
									
										
										
										
											2015-04-23 17:37:05 -07:00
										 |  |  |         // dependency_overrides:
 | 
					
						
							|  |  |  |         //   angular2:
 | 
					
						
							|  |  |  |         //     path: ../../dist/dart/angular2
 | 
					
						
							|  |  |  |         //
 | 
					
						
							|  |  |  |         // When we copy a pure package into `dist` the relative path
 | 
					
						
							|  |  |  |         // must be updated. The code below replaces paths accordingly.
 | 
					
						
							|  |  |  |         // So the example above is turned into:
 | 
					
						
							| 
									
										
										
										
											2015-04-24 13:17:36 -07:00
										 |  |  |         //
 | 
					
						
							| 
									
										
										
										
											2015-04-23 17:37:05 -07:00
										 |  |  |         // dependency_overrides:
 | 
					
						
							|  |  |  |         //   angular2:
 | 
					
						
							|  |  |  |         //     path: ../angular2
 | 
					
						
							|  |  |  |         //
 | 
					
						
							|  |  |  |         var pubspec = yaml.safeLoad(file.contents.toString()); | 
					
						
							| 
									
										
										
										
											2015-08-30 22:17:20 +02:00
										 |  |  |         var overrides = pubspec.dependency_overrides; | 
					
						
							| 
									
										
										
										
											2015-04-23 17:37:05 -07:00
										 |  |  |         if (overrides) { | 
					
						
							|  |  |  |           Object.keys(overrides).forEach(function(pkg) { | 
					
						
							| 
									
										
										
										
											2015-08-30 22:17:20 +02:00
										 |  |  |             var overridePath = overrides[pkg].path; | 
					
						
							| 
									
										
										
										
											2015-04-23 17:37:05 -07:00
										 |  |  |             if (overridePath.startsWith(originalPrefix)) { | 
					
						
							| 
									
										
										
										
											2015-08-30 22:17:20 +02:00
										 |  |  |               overrides[pkg].path = overridePath.replace(originalPrefix, '../'); | 
					
						
							| 
									
										
										
										
											2015-04-23 17:37:05 -07:00
										 |  |  |             } | 
					
						
							|  |  |  |           }); | 
					
						
							|  |  |  |           file.contents = new Buffer(yaml.safeDump(pubspec)); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       this.push(file); | 
					
						
							|  |  |  |       done(); | 
					
						
							|  |  |  |     })) | 
					
						
							| 
									
										
										
										
											2015-08-19 10:36:52 -07:00
										 |  |  |     .pipe(gulp.dest(CONFIG.dest.dart)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return merge2(transformStream, moveStream); | 
					
						
							| 
									
										
										
										
											2015-04-23 17:37:05 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-27 14:50:06 -08:00
										 |  |  | // Builds all Dart packages, but does not compile them
 | 
					
						
							|  |  |  | gulp.task('build/packages.dart', function(done) { | 
					
						
							| 
									
										
										
										
											2015-04-23 17:37:05 -07:00
										 |  |  |   runSequence( | 
					
						
							|  |  |  |     'build/tree.dart', | 
					
						
							| 
									
										
										
										
											2015-08-19 10:36:52 -07:00
										 |  |  |     'build/pure-packages.dart', | 
					
						
							| 
									
										
										
										
											2015-04-23 17:37:05 -07:00
										 |  |  |     // Run after 'build/tree.dart' because broccoli clears the dist/dart folder
 | 
					
						
							| 
									
										
										
										
											2015-05-14 13:14:45 -07:00
										 |  |  |     '!build/pubget.angular2.dart', | 
					
						
							|  |  |  |     '!build/change_detect.dart', | 
					
						
							| 
									
										
										
										
											2015-05-19 16:51:57 -07:00
										 |  |  |     sequenceComplete(done)); | 
					
						
							| 
									
										
										
										
											2015-02-27 14:50:06 -08:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Builds and compiles all Dart packages
 | 
					
						
							|  |  |  | gulp.task('build.dart', function(done) { | 
					
						
							|  |  |  |   runSequence( | 
					
						
							|  |  |  |     'build/packages.dart', | 
					
						
							| 
									
										
										
										
											2015-04-09 23:17:05 -07:00
										 |  |  |     'build/pubspec.dart', | 
					
						
							| 
									
										
										
										
											2015-02-27 14:50:06 -08:00
										 |  |  |     'build/analyze.dart', | 
					
						
							| 
									
										
										
										
											2015-08-06 15:07:33 -07:00
										 |  |  |     'build/check.apidocs.dart', | 
					
						
							| 
									
										
										
										
											2015-07-15 10:13:04 -07:00
										 |  |  |     'build.dart.material.css', | 
					
						
							| 
									
										
										
										
											2015-05-19 16:51:57 -07:00
										 |  |  |     sequenceComplete(done) | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  |   ); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-26 23:14:52 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-04 08:32:58 -07:00
										 |  |  | // public task to build tools
 | 
					
						
							|  |  |  | gulp.task('build.tools', ['build/clean.tools'], function(done) { | 
					
						
							| 
									
										
										
										
											2015-05-19 16:51:57 -07:00
										 |  |  |   runSequence('!build.tools', sequenceComplete(done)); | 
					
						
							| 
									
										
										
										
											2015-05-04 08:32:58 -07:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-04-27 00:46:48 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-24 16:23:25 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-04 08:32:58 -07:00
										 |  |  | // private task to build tools
 | 
					
						
							|  |  |  | gulp.task('!build.tools', function() { | 
					
						
							| 
									
										
										
										
											2015-05-28 22:00:41 +02:00
										 |  |  |   var stream = gulp.src(['tools/**/*.ts']) | 
					
						
							| 
									
										
										
										
											2015-05-07 13:37:25 -07:00
										 |  |  |       .pipe(sourcemaps.init()) | 
					
						
							| 
									
										
										
										
											2015-05-28 22:00:41 +02:00
										 |  |  |       .pipe(tsc({target: 'ES5', module: 'commonjs', | 
					
						
							| 
									
										
										
										
											2015-05-07 13:37:25 -07:00
										 |  |  |                  // Don't use the version of typescript that gulp-typescript depends on, we need 1.5
 | 
					
						
							|  |  |  |                  // see https://github.com/ivogabe/gulp-typescript#typescript-version
 | 
					
						
							|  |  |  |                  typescript: require('typescript')})) | 
					
						
							|  |  |  |       .on('error', function(error) { | 
					
						
							| 
									
										
										
										
											2015-05-28 22:00:41 +02:00
										 |  |  |         // nodejs doesn't propagate errors from the src stream into the final stream so we are
 | 
					
						
							|  |  |  |         // forwarding the error into the final stream
 | 
					
						
							|  |  |  |         stream.emit('error', error); | 
					
						
							|  |  |  |       }) | 
					
						
							|  |  |  |       .pipe(sourcemaps.write('.')) | 
					
						
							|  |  |  |       .pipe(gulp.dest('dist/tools')) | 
					
						
							|  |  |  |       .on('end', function() { | 
					
						
							|  |  |  |         var AngularBuilder = require('./dist/tools/broccoli/angular_builder').AngularBuilder; | 
					
						
							|  |  |  |         angularBuilder = new AngularBuilder({ | 
					
						
							|  |  |  |           outputPath: 'dist', | 
					
						
							|  |  |  |           dartSDK: DART_SDK, | 
					
						
							|  |  |  |           logs: logs | 
					
						
							|  |  |  |         }); | 
					
						
							| 
									
										
										
										
											2015-05-07 13:37:25 -07:00
										 |  |  |       }); | 
					
						
							| 
									
										
										
										
											2015-04-24 15:59:13 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-28 22:00:41 +02:00
										 |  |  |   return stream; | 
					
						
							| 
									
										
										
										
											2015-04-10 16:45:24 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-06 08:45:28 -07:00
										 |  |  | gulp.task('broccoli.js.dev', ['build.tools'], function(done) { | 
					
						
							| 
									
										
										
										
											2015-05-19 16:51:57 -07:00
										 |  |  |   runSequence('!broccoli.js.dev', sequenceComplete(done)); | 
					
						
							| 
									
										
										
										
											2015-05-06 08:45:28 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('!broccoli.js.dev', function() { | 
					
						
							| 
									
										
										
										
											2015-04-26 00:31:53 -07:00
										 |  |  |   return angularBuilder.rebuildBrowserDevTree(); | 
					
						
							| 
									
										
										
										
											2015-04-08 08:28:12 -07:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-04-10 11:48:37 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-12 10:30:08 -07:00
										 |  |  | gulp.task('!broccoli.js.prod', function() { | 
					
						
							|  |  |  |   return angularBuilder.rebuildBrowserProdTree(); | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-04-10 11:48:37 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-06 08:45:28 -07:00
										 |  |  | gulp.task('build.js.dev', ['build/clean.js'], function(done) { | 
					
						
							| 
									
										
										
										
											2015-02-10 15:18:16 -08:00
										 |  |  |   runSequence( | 
					
						
							| 
									
										
										
										
											2015-04-08 08:28:12 -07:00
										 |  |  |     'broccoli.js.dev', | 
					
						
							| 
									
										
										
										
											2015-05-19 16:51:57 -07:00
										 |  |  |     sequenceComplete(done) | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  |   ); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-12 10:30:08 -07:00
										 |  |  | gulp.task('build.js.prod', ['build.tools'], function(done) { | 
					
						
							|  |  |  |   runSequence('!broccoli.js.prod', sequenceComplete(done)); | 
					
						
							| 
									
										
										
										
											2015-04-09 15:56:54 -07:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-04-26 00:31:53 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-05 16:09:09 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * public task | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | gulp.task('build.js.cjs', ['build.tools'], function(done) { | 
					
						
							| 
									
										
										
										
											2015-05-19 16:51:57 -07:00
										 |  |  |   runSequence('!build.js.cjs', sequenceComplete(done)); | 
					
						
							| 
									
										
										
										
											2015-05-05 16:09:09 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-26 00:31:53 -07:00
										 |  |  | var firstBuildJsCjs = true; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-05 16:09:09 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * private task | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | gulp.task('!build.js.cjs', function() { | 
					
						
							| 
									
										
										
										
											2015-04-26 00:31:53 -07:00
										 |  |  |   return angularBuilder.rebuildNodeTree().then(function() { | 
					
						
							|  |  |  |     if (firstBuildJsCjs) { | 
					
						
							|  |  |  |       firstBuildJsCjs = false; | 
					
						
							|  |  |  |       console.log('creating node_modules symlink hack'); | 
					
						
							|  |  |  |       // linknodemodules is all sync
 | 
					
						
							|  |  |  |       linknodemodules(gulp, gulpPlugins, { | 
					
						
							|  |  |  |         dir: CONFIG.dest.js.cjs | 
					
						
							|  |  |  |       })(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }); | 
					
						
							| 
									
										
										
										
											2015-01-06 15:19:22 -08:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-26 00:31:53 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-23 13:18:05 -07:00
										 |  |  | var bundleConfig = { | 
					
						
							|  |  |  |   paths: { | 
					
						
							| 
									
										
										
										
											2015-06-10 00:02:37 -07:00
										 |  |  |     "*": "dist/js/prod/es6/*.js", | 
					
						
							| 
									
										
										
										
											2015-04-27 16:11:20 -07:00
										 |  |  |     "rx": "node_modules/rx/dist/rx.js" | 
					
						
							| 
									
										
										
										
											2015-04-06 16:43:53 -07:00
										 |  |  |   }, | 
					
						
							|  |  |  |   meta: { | 
					
						
							|  |  |  |     // auto-detection fails to detect properly here - https://github.com/systemjs/builder/issues/123
 | 
					
						
							| 
									
										
										
										
											2015-05-01 12:03:11 -07:00
										 |  |  |     'rx': { | 
					
						
							| 
									
										
										
										
											2015-08-10 15:34:20 +02:00
										 |  |  |       format: 'cjs' | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     'angular2/src/router/route_definition': { | 
					
						
							|  |  |  |       format: 'es6' | 
					
						
							| 
									
										
										
										
											2015-04-06 16:43:53 -07:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-08-10 15:34:20 +02:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-03-23 13:18:05 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // production build
 | 
					
						
							| 
									
										
										
										
											2015-07-24 14:45:00 -07:00
										 |  |  | gulp.task('!bundle.js.prod', ['build.js.prod'], function() { | 
					
						
							| 
									
										
										
										
											2015-03-23 13:18:05 -07:00
										 |  |  |   return bundler.bundle( | 
					
						
							| 
									
										
										
										
											2015-04-02 19:53:11 -07:00
										 |  |  |       bundleConfig, | 
					
						
							|  |  |  |       'angular2/angular2', | 
					
						
							|  |  |  |       './dist/build/angular2.js', | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         sourceMaps: true | 
					
						
							| 
									
										
										
										
											2015-07-28 13:10:25 -07:00
										 |  |  |       }). | 
					
						
							|  |  |  |       then(function(){ | 
					
						
							|  |  |  |         return bundler.bundle( | 
					
						
							|  |  |  |           bundleConfig, | 
					
						
							| 
									
										
										
										
											2015-08-20 14:28:25 -07:00
										 |  |  |           'angular2/http', | 
					
						
							| 
									
										
										
										
											2015-07-28 13:10:25 -07:00
										 |  |  |           './dist/build/http.js', | 
					
						
							|  |  |  |           { | 
					
						
							|  |  |  |             sourceMaps: true | 
					
						
							|  |  |  |           } | 
					
						
							| 
									
										
										
										
											2015-08-30 22:17:20 +02:00
										 |  |  |         ); | 
					
						
							| 
									
										
										
										
											2015-04-02 19:53:11 -07:00
										 |  |  |       }); | 
					
						
							| 
									
										
										
										
											2015-03-23 13:18:05 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // minified production build
 | 
					
						
							| 
									
										
										
										
											2015-07-24 14:45:00 -07:00
										 |  |  | gulp.task('!bundle.js.min', ['build.js.prod'], function() { | 
					
						
							| 
									
										
										
										
											2015-03-23 13:18:05 -07:00
										 |  |  |   return bundler.bundle( | 
					
						
							| 
									
										
										
										
											2015-04-02 19:53:11 -07:00
										 |  |  |       bundleConfig, | 
					
						
							|  |  |  |       'angular2/angular2', | 
					
						
							|  |  |  |       './dist/build/angular2.min.js', | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         sourceMaps: true, | 
					
						
							|  |  |  |         minify: true | 
					
						
							| 
									
										
										
										
											2015-07-28 13:10:25 -07:00
										 |  |  |       }). | 
					
						
							|  |  |  |       then(function(){ | 
					
						
							|  |  |  |         return bundler.bundle( | 
					
						
							|  |  |  |           bundleConfig, | 
					
						
							| 
									
										
										
										
											2015-08-20 14:28:25 -07:00
										 |  |  |           'angular2/http', | 
					
						
							| 
									
										
										
										
											2015-07-28 13:10:25 -07:00
										 |  |  |           './dist/build/http.min.js', | 
					
						
							|  |  |  |           { | 
					
						
							|  |  |  |             sourceMaps: true, | 
					
						
							|  |  |  |             minify: true | 
					
						
							|  |  |  |           } | 
					
						
							| 
									
										
										
										
											2015-08-30 22:17:20 +02:00
										 |  |  |         ); | 
					
						
							| 
									
										
										
										
											2015-04-02 19:53:11 -07:00
										 |  |  |       }); | 
					
						
							| 
									
										
										
										
											2015-03-23 13:18:05 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // development build
 | 
					
						
							| 
									
										
										
										
											2015-07-24 14:45:00 -07:00
										 |  |  | gulp.task('!bundle.js.dev', ['build.js.dev'], function() { | 
					
						
							| 
									
										
										
										
											2015-04-06 16:43:53 -07:00
										 |  |  |   var devBundleConfig = merge(true, bundleConfig); | 
					
						
							|  |  |  |   devBundleConfig.paths = | 
					
						
							|  |  |  |       merge(true, devBundleConfig.paths, { | 
					
						
							| 
									
										
										
										
											2015-06-10 00:02:37 -07:00
										 |  |  |        "*": "dist/js/dev/es6/*.js" | 
					
						
							| 
									
										
										
										
											2015-04-06 16:43:53 -07:00
										 |  |  |       }); | 
					
						
							|  |  |  |   return bundler.bundle( | 
					
						
							|  |  |  |       devBundleConfig, | 
					
						
							| 
									
										
										
										
											2015-04-02 19:53:11 -07:00
										 |  |  |       'angular2/angular2', | 
					
						
							|  |  |  |       './dist/build/angular2.dev.js', | 
					
						
							| 
									
										
										
										
											2015-07-28 13:10:25 -07:00
										 |  |  |       { sourceMaps: true }). | 
					
						
							|  |  |  |       then(function() { | 
					
						
							|  |  |  |         return bundler.bundle( | 
					
						
							|  |  |  |           devBundleConfig, | 
					
						
							| 
									
										
										
										
											2015-08-20 14:28:25 -07:00
										 |  |  |           'angular2/http', | 
					
						
							| 
									
										
										
										
											2015-07-28 13:10:25 -07:00
										 |  |  |           './dist/build/http.dev.js', | 
					
						
							|  |  |  |           { sourceMaps: true }); | 
					
						
							|  |  |  |       }); | 
					
						
							| 
									
										
										
										
											2015-04-13 16:48:04 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-27 10:39:39 -07:00
										 |  |  | // WebWorker build
 | 
					
						
							|  |  |  | gulp.task("!bundle.web_worker.js.dev", ["build.js.dev"], function() { | 
					
						
							|  |  |  |   var devBundleConfig = merge(true, bundleConfig); | 
					
						
							|  |  |  |   devBundleConfig.paths = | 
					
						
							|  |  |  |       merge(true, devBundleConfig.paths, { | 
					
						
							|  |  |  |        "*": "dist/js/dev/es6/*.js" | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  |   return bundler.bundle( | 
					
						
							|  |  |  |       devBundleConfig, | 
					
						
							|  |  |  |       'angular2/web_worker/ui', | 
					
						
							|  |  |  |       './dist/build/web_worker/ui.dev.js', | 
					
						
							|  |  |  |       { sourceMaps: true }). | 
					
						
							|  |  |  |       then(function() { | 
					
						
							|  |  |  |         return bundler.bundle( | 
					
						
							|  |  |  |           devBundleConfig, | 
					
						
							|  |  |  |           'angular2/web_worker/worker', | 
					
						
							|  |  |  |           './dist/build/web_worker/worker.dev.js', | 
					
						
							|  |  |  |           { sourceMaps: true}); | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-24 14:45:00 -07:00
										 |  |  | gulp.task('!router.bundle.js.dev', ['build.js.dev'], function() { | 
					
						
							| 
									
										
										
										
											2015-05-01 16:39:38 -07:00
										 |  |  |   var devBundleConfig = merge(true, bundleConfig); | 
					
						
							|  |  |  |   devBundleConfig.paths = | 
					
						
							|  |  |  |     merge(true, devBundleConfig.paths, { | 
					
						
							| 
									
										
										
										
											2015-06-10 00:02:37 -07:00
										 |  |  |       "*": "dist/js/dev/es6/*.js" | 
					
						
							| 
									
										
										
										
											2015-05-01 16:39:38 -07:00
										 |  |  |     }); | 
					
						
							|  |  |  |   return bundler.bundle( | 
					
						
							|  |  |  |     devBundleConfig, | 
					
						
							| 
									
										
										
										
											2015-05-04 17:57:28 -07:00
										 |  |  |     'angular2/router - angular2/angular2', | 
					
						
							| 
									
										
										
										
											2015-07-24 14:45:00 -07:00
										 |  |  |     './dist/js/bundle/router.dev.js', | 
					
						
							| 
									
										
										
										
											2015-05-01 16:39:38 -07:00
										 |  |  |     { sourceMaps: true }); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-24 14:45:00 -07:00
										 |  |  | gulp.task('!test.bundle.js.dev', ['build.js.dev'], function() { | 
					
						
							| 
									
										
										
										
											2015-06-22 12:22:46 -07:00
										 |  |  |   var devBundleConfig = merge(true, bundleConfig); | 
					
						
							|  |  |  |   devBundleConfig.paths = | 
					
						
							|  |  |  |     merge(true, devBundleConfig.paths, { | 
					
						
							|  |  |  |       "*": "dist/js/dev/es6/*.js" | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   return bundler.bundle( | 
					
						
							|  |  |  |     devBundleConfig, | 
					
						
							| 
									
										
										
										
											2015-06-26 17:25:49 -07:00
										 |  |  |     'angular2/test + angular2/mock - angular2/angular2', | 
					
						
							| 
									
										
										
										
											2015-07-24 14:45:00 -07:00
										 |  |  |     './dist/js/bundle/test_lib.dev.js', | 
					
						
							| 
									
										
										
										
											2015-06-22 12:22:46 -07:00
										 |  |  |     { sourceMaps: true }); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-13 16:48:04 -07:00
										 |  |  | // self-executing development build
 | 
					
						
							|  |  |  | // This bundle executes its main module - angular2_sfx, when loaded, without
 | 
					
						
							|  |  |  | // a corresponding System.import call. It is aimed at ES5 developers that do not
 | 
					
						
							|  |  |  | // use System loader polyfills (like system.js and es6 loader).
 | 
					
						
							|  |  |  | // see: https://github.com/systemjs/builder (SFX bundles).
 | 
					
						
							| 
									
										
										
										
											2015-07-24 14:45:00 -07:00
										 |  |  | gulp.task('!bundle.js.sfx.dev', ['build.js.dev'], function() { | 
					
						
							| 
									
										
										
										
											2015-04-13 16:48:04 -07:00
										 |  |  |   var devBundleConfig = merge(true, bundleConfig); | 
					
						
							|  |  |  |   devBundleConfig.paths = | 
					
						
							|  |  |  |       merge(true, devBundleConfig.paths, { | 
					
						
							| 
									
										
										
										
											2015-06-10 00:02:37 -07:00
										 |  |  |        '*': 'dist/js/dev/es6/*.js' | 
					
						
							| 
									
										
										
										
											2015-04-02 19:53:11 -07:00
										 |  |  |       }); | 
					
						
							| 
									
										
										
										
											2015-04-13 16:48:04 -07:00
										 |  |  |   return bundler.bundle( | 
					
						
							|  |  |  |       devBundleConfig, | 
					
						
							|  |  |  |       'angular2/angular2_sfx', | 
					
						
							|  |  |  |       './dist/build/angular2.sfx.dev.js', | 
					
						
							|  |  |  |       { sourceMaps: true }, | 
					
						
							| 
									
										
										
										
											2015-08-20 14:28:25 -07:00
										 |  |  |       /* self-executing */ true); | 
					
						
							| 
									
										
										
										
											2015-04-02 19:53:11 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-24 14:45:00 -07:00
										 |  |  | gulp.task('!bundle.js.prod.deps', ['!bundle.js.prod'], function() { | 
					
						
							| 
									
										
										
										
											2015-07-28 13:10:25 -07:00
										 |  |  |   return merge2(bundler.modify( | 
					
						
							| 
									
										
										
										
											2015-06-12 09:25:57 -07:00
										 |  |  |       ['node_modules/zone.js/dist/zone-microtask.js', 'node_modules/reflect-metadata/Reflect.js', | 
					
						
							| 
									
										
										
										
											2015-06-08 17:15:40 -07:00
										 |  |  |       'dist/build/angular2.js'], | 
					
						
							| 
									
										
										
										
											2015-05-12 09:47:17 +02:00
										 |  |  |       'angular2.js' | 
					
						
							| 
									
										
										
										
											2015-07-28 13:10:25 -07:00
										 |  |  |     ), | 
					
						
							|  |  |  |     bundler.modify( | 
					
						
							|  |  |  |         ['node_modules/reflect-metadata/Reflect.js', 'node_modules/rx/dist/rx.lite.js', 'dist/build/http.js'], | 
					
						
							|  |  |  |         'http.js' | 
					
						
							|  |  |  |     )).pipe(gulp.dest('dist/js/bundle')); | 
					
						
							| 
									
										
										
										
											2015-04-02 19:53:11 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-24 14:45:00 -07:00
										 |  |  | gulp.task('!bundle.js.min.deps', ['!bundle.js.min'], function() { | 
					
						
							| 
									
										
										
										
											2015-07-28 13:10:25 -07:00
										 |  |  |   return merge2(bundler.modify( | 
					
						
							| 
									
										
										
										
											2015-06-12 09:25:57 -07:00
										 |  |  |       ['node_modules/zone.js/dist/zone-microtask.min.js', | 
					
						
							| 
									
										
										
										
											2015-06-08 17:15:40 -07:00
										 |  |  |       'node_modules/reflect-metadata/Reflect.js', 'dist/build/angular2.min.js'], | 
					
						
							| 
									
										
										
										
											2015-05-12 09:47:17 +02:00
										 |  |  |       'angular2.min.js' | 
					
						
							| 
									
										
										
										
											2015-07-28 13:10:25 -07:00
										 |  |  |     ), | 
					
						
							|  |  |  |     bundler.modify( | 
					
						
							|  |  |  |         ['node_modules/reflect-metadata/Reflect.js', 'node_modules/rx/dist/rx.lite.js','dist/build/http.min.js'], | 
					
						
							|  |  |  |         'http.min.js' | 
					
						
							|  |  |  |     )) | 
					
						
							|  |  |  |     .pipe(uglify()) | 
					
						
							|  |  |  |     .pipe(gulp.dest('dist/js/bundle')); | 
					
						
							| 
									
										
										
										
											2015-03-23 13:18:05 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-12 09:47:17 +02:00
										 |  |  | var JS_DEV_DEPS = [ | 
					
						
							| 
									
										
										
										
											2015-07-10 17:43:30 -07:00
										 |  |  |     licenseWrap('node_modules/zone.js/LICENSE', true), | 
					
						
							| 
									
										
										
										
											2015-05-12 09:47:17 +02:00
										 |  |  |     'node_modules/zone.js/dist/zone-microtask.js', | 
					
						
							|  |  |  |     'node_modules/zone.js/dist/long-stack-trace-zone.js', | 
					
						
							| 
									
										
										
										
											2015-07-10 17:43:30 -07:00
										 |  |  |     licenseWrap('node_modules/reflect-metadata/LICENSE', true), | 
					
						
							|  |  |  |     'node_modules/reflect-metadata/Reflect.js', | 
					
						
							|  |  |  |     // traceur-runtime is always first in the bundle
 | 
					
						
							|  |  |  |     licenseWrap('node_modules/traceur/LICENSE', true) | 
					
						
							| 
									
										
										
										
											2015-05-12 09:47:17 +02:00
										 |  |  | ]; | 
					
						
							| 
									
										
										
										
											2015-04-13 16:48:04 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-10 17:43:30 -07:00
										 |  |  | // Splice in RX license if rx is in the bundle.
 | 
					
						
							|  |  |  | function insertRXLicense(source) { | 
					
						
							|  |  |  |   var n = source.indexOf('System.register("rx"'); | 
					
						
							|  |  |  |   if (n >= 0) { | 
					
						
							|  |  |  |     var rxLicense = licenseWrap('node_modules/rx/license.txt'); | 
					
						
							|  |  |  |     return source.slice(0, n) + rxLicense + source.slice(n); | 
					
						
							|  |  |  |   } else { | 
					
						
							|  |  |  |     return source; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-27 10:39:39 -07:00
										 |  |  | function addDevDependencies(outputFile) { | 
					
						
							|  |  |  |   return bundler.modify( | 
					
						
							|  |  |  |     JS_DEV_DEPS.concat(['dist/build/' + outputFile]), | 
					
						
							|  |  |  |     outputFile) | 
					
						
							|  |  |  |       .pipe(insert.transform(insertRXLicense)) | 
					
						
							|  |  |  |       .pipe(gulp.dest('dist/js/bundle')); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-24 14:45:00 -07:00
										 |  |  | gulp.task('!bundle.js.dev.deps', ['!bundle.js.dev'], function() { | 
					
						
							| 
									
										
										
										
											2015-08-27 10:39:39 -07:00
										 |  |  |   var bundle = addDevDependencies('angular2.dev.js'); | 
					
						
							|  |  |  |   return merge2(bundle, bundler.modify( | 
					
						
							|  |  |  |     ['dist/build/http.dev.js'], 'http.dev.js') | 
					
						
							|  |  |  |       .pipe(gulp.dest('dist/js/bundle'))); | 
					
						
							| 
									
										
										
										
											2015-04-13 16:48:04 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-24 14:45:00 -07:00
										 |  |  | gulp.task('!bundle.js.sfx.dev.deps', ['!bundle.js.sfx.dev'], function() { | 
					
						
							| 
									
										
										
										
											2015-07-28 13:10:25 -07:00
										 |  |  |   return merge2( | 
					
						
							|  |  |  |     bundler.modify(JS_DEV_DEPS.concat(['dist/build/angular2.sfx.dev.js']), | 
					
						
							| 
									
										
										
										
											2015-04-13 16:48:04 -07:00
										 |  |  |                         'angular2.sfx.dev.js') | 
					
						
							| 
									
										
										
										
											2015-07-28 13:10:25 -07:00
										 |  |  |       .pipe(gulp.dest('dist/js/bundle')), | 
					
						
							|  |  |  |     bundler.modify(['dist/build/http.sfx.dev.js'], | 
					
						
							|  |  |  |                         'http.sfx.dev.js') | 
					
						
							|  |  |  |       .pipe(gulp.dest('dist/js/bundle'))); | 
					
						
							| 
									
										
										
										
											2015-03-23 13:18:05 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-27 10:39:39 -07:00
										 |  |  | gulp.task('!bundle.web_worker.js.dev.deps', ['!bundle.web_worker.js.dev'], function() { | 
					
						
							|  |  |  |   return merge2(addDevDependencies("web_worker/ui.dev.js", | 
					
						
							|  |  |  |                 addDevDependencies("web_worker/worker.dev.js"))); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-24 14:45:00 -07:00
										 |  |  | gulp.task('bundles.js', [ | 
					
						
							|  |  |  |   '!bundle.js.prod.deps', | 
					
						
							|  |  |  |   '!bundle.js.dev.deps', | 
					
						
							|  |  |  |   '!bundle.js.min.deps', | 
					
						
							| 
									
										
										
										
											2015-08-27 10:39:39 -07:00
										 |  |  |   '!bundle.web_worker.js.dev.deps', | 
					
						
							| 
									
										
										
										
											2015-07-24 14:45:00 -07:00
										 |  |  |   '!bundle.js.sfx.dev.deps', | 
					
						
							|  |  |  |   '!router.bundle.js.dev', | 
					
						
							|  |  |  |   '!test.bundle.js.dev']); | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-24 14:45:00 -07:00
										 |  |  | gulp.task('build.js', ['build.js.dev', 'build.js.prod', 'build.js.cjs', 'bundles.js', 'benchpress.bundle']); | 
					
						
							| 
									
										
										
										
											2015-04-08 08:28:12 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-23 15:26:51 -07:00
										 |  |  | gulp.task('clean', ['build/clean.tools', 'build/clean.js', 'build/clean.dart', 'build/clean.docs', 'build/clean.benchpress.bundle']); | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-11 11:40:29 -08:00
										 |  |  | gulp.task('build', ['build.js', 'build.dart']); | 
					
						
							| 
									
										
										
										
											2015-02-17 11:56:24 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-14 13:14:45 -07:00
										 |  |  | // ------------
 | 
					
						
							|  |  |  | // change detection codegen
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('build.change_detect.dart', function(done) { | 
					
						
							|  |  |  |   return runSequence('build/packages.dart', '!build/pubget.angular2.dart', | 
					
						
							|  |  |  |                      '!build/change_detect.dart', done); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('!build/change_detect.dart', function(done) { | 
					
						
							|  |  |  |   var fs = require('fs'); | 
					
						
							| 
									
										
										
										
											2015-08-20 14:28:25 -07:00
										 |  |  |   var changeDetectDir = path.join(CONFIG.dest.dart, 'angular2/test/core/change_detection/'); | 
					
						
							| 
									
										
										
										
											2015-05-14 13:14:45 -07:00
										 |  |  |   var srcDir = path.join(changeDetectDir, 'generator'); | 
					
						
							|  |  |  |   var destDir = path.join(changeDetectDir, 'generated'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-10 14:56:08 -07:00
										 |  |  |   var dartStream = fs.createWriteStream(path.join(destDir, 'change_detector_classes.dart')); | 
					
						
							| 
									
										
										
										
											2015-05-14 13:14:45 -07:00
										 |  |  |   var genMain = path.join(srcDir, 'gen_change_detectors.dart'); | 
					
						
							|  |  |  |   var proc = spawn(DART_SDK.VM, [genMain], { stdio:['ignore', 'pipe', 'inherit'] }); | 
					
						
							|  |  |  |   proc.on('error', function(code) { | 
					
						
							|  |  |  |     done(new Error('Failed while generating change detector classes. Please run manually: ' + | 
					
						
							|  |  |  |                    DART_SDK.VM + ' ' + dartArgs.join(' '))); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   proc.on('close', function() { | 
					
						
							|  |  |  |     dartStream.close(); | 
					
						
							|  |  |  |     done(); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   proc.stdout.pipe(dartStream); | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-02-17 11:56:24 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | // ------------
 | 
					
						
							|  |  |  | // angular material testing rules
 | 
					
						
							| 
									
										
										
										
											2015-05-04 18:34:06 -07:00
										 |  |  | gulp.task('build.css.material', function() { | 
					
						
							| 
									
										
										
										
											2015-02-17 11:56:24 -08:00
										 |  |  |   return gulp.src('modules/*/src/**/*.scss') | 
					
						
							|  |  |  |       .pipe(sass()) | 
					
						
							|  |  |  |       .pipe(autoprefixer()) | 
					
						
							| 
									
										
										
										
											2015-05-04 18:34:06 -07:00
										 |  |  |       .pipe(gulp.dest(CONFIG.dest.js.prod.es5)) | 
					
						
							|  |  |  |       .pipe(gulp.dest(CONFIG.dest.js.dev.es5)) | 
					
						
							|  |  |  |       .pipe(gulp.dest(CONFIG.dest.js.dart2js + '/examples/packages')); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('build.js.material', function(done) { | 
					
						
							| 
									
										
										
										
											2015-05-19 16:51:57 -07:00
										 |  |  |   runSequence('build.js.dev', 'build.css.material', sequenceComplete(done)); | 
					
						
							| 
									
										
										
										
											2015-05-04 18:34:06 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('build.dart2js.material', function(done) { | 
					
						
							| 
									
										
										
										
											2015-05-19 16:51:57 -07:00
										 |  |  |   runSequence('build.dart', 'build.css.material', sequenceComplete(done)); | 
					
						
							| 
									
										
										
										
											2015-02-17 11:56:24 -08:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-15 10:13:04 -07:00
										 |  |  | gulp.task('build.dart.material.css', function() { | 
					
						
							| 
									
										
										
										
											2015-04-23 13:15:20 -07:00
										 |  |  |   return gulp.src('dist/dart/angular2_material/src/**/*.scss') | 
					
						
							| 
									
										
										
										
											2015-02-17 11:56:24 -08:00
										 |  |  |       .pipe(sass()) | 
					
						
							|  |  |  |       .pipe(autoprefixer()) | 
					
						
							|  |  |  |       .pipe(gulp.dest('dist/dart/angular2_material/lib/src')); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-15 10:13:04 -07:00
										 |  |  | gulp.task('build.dart.material', ['build/packages.dart'], function(done) { | 
					
						
							| 
									
										
										
										
											2015-08-30 22:17:20 +02:00
										 |  |  |   runSequence('build/packages.dart', 'build.dart.material.css', sequenceComplete(done)); | 
					
						
							| 
									
										
										
										
											2015-07-15 10:13:04 -07:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-04-26 00:31:53 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-01 16:34:08 -07:00
										 |  |  | gulp.task('cleanup.builder', function() { | 
					
						
							|  |  |  |   return angularBuilder.cleanup(); | 
					
						
							| 
									
										
										
										
											2015-04-26 00:31:53 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-23 15:26:51 -07:00
										 |  |  | gulp.task('benchpress.bundle', ['build/clean.benchpress.bundle', 'build.js.cjs'], function(cb) { | 
					
						
							|  |  |  |   bundler.benchpressBundle( | 
					
						
							|  |  |  |     BENCHPRESS_BUNDLE_CONFIG.entries, | 
					
						
							|  |  |  |     BENCHPRESS_BUNDLE_CONFIG.packageJson, | 
					
						
							|  |  |  |     BENCHPRESS_BUNDLE_CONFIG.includes, | 
					
						
							|  |  |  |     BENCHPRESS_BUNDLE_CONFIG.excludes, | 
					
						
							|  |  |  |     BENCHPRESS_BUNDLE_CONFIG.ignore, | 
					
						
							|  |  |  |     BENCHPRESS_BUNDLE_CONFIG.dest, | 
					
						
							|  |  |  |     cb | 
					
						
							|  |  |  |   ); | 
					
						
							| 
									
										
										
										
											2015-08-04 15:32:17 -07:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-06-23 15:26:51 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-26 00:31:53 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | // register cleanup listener for ctrl+c/kill used to quit any persistent task (autotest or serve tasks)
 | 
					
						
							|  |  |  | process.on('SIGINT', function() { | 
					
						
							| 
									
										
										
										
											2015-06-05 23:43:11 -07:00
										 |  |  |   if (!angularBuilder.mock) { | 
					
						
							|  |  |  |     runSequence('cleanup.builder', function () { | 
					
						
							|  |  |  |       process.exit(); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-04-26 00:31:53 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-19 21:58:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-26 00:31:53 -07:00
										 |  |  | // register cleanup listener for all non-persistent tasks
 | 
					
						
							| 
									
										
										
										
											2015-05-12 21:19:59 -07:00
										 |  |  | var beforeExitRan = false; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-26 00:31:53 -07:00
										 |  |  | process.on('beforeExit', function() { | 
					
						
							| 
									
										
										
										
											2015-05-12 21:19:59 -07:00
										 |  |  |   if (beforeExitRan) return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   beforeExitRan = true; | 
					
						
							| 
									
										
										
										
											2015-06-05 23:43:11 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   if (!angularBuilder.mock) { | 
					
						
							|  |  |  |     gulp.start('cleanup.builder'); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-04-26 00:31:53 -07:00
										 |  |  | }); |