| 
									
										
										
										
											2015-02-17 11:56:24 -08:00
										 |  |  | var autoprefixer = require('gulp-autoprefixer'); | 
					
						
							| 
									
										
										
										
											2015-04-01 10:45:56 -07:00
										 |  |  | var format = require('gulp-clang-format'); | 
					
						
							| 
									
										
										
										
											2014-10-28 11:45:48 +01:00
										 |  |  | var gulp = require('gulp'); | 
					
						
							| 
									
										
										
										
											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'); | 
					
						
							| 
									
										
										
										
											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-03-18 00:43:30 +01:00
										 |  |  | var path = require('path'); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | var gulpTraceur = require('./tools/transpiler/gulp-traceur'); | 
					
						
							|  |  |  | var clean = require('./tools/build/clean'); | 
					
						
							|  |  |  | var transpile = require('./tools/build/transpile'); | 
					
						
							| 
									
										
										
										
											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'); | 
					
						
							|  |  |  | var jsserve = require('./tools/build/jsserve'); | 
					
						
							|  |  |  | var pubserve = require('./tools/build/pubserve'); | 
					
						
							| 
									
										
										
										
											2015-01-30 11:03:11 -08:00
										 |  |  | var rundartpackage = require('./tools/build/rundartpackage'); | 
					
						
							| 
									
										
										
										
											2015-03-18 00:43:30 +01:00
										 |  |  | var file2moduleName = require('./tools/build/file2modulename'); | 
					
						
							| 
									
										
										
										
											2014-11-07 18:29:19 +01:00
										 |  |  | var karma = require('karma').server; | 
					
						
							|  |  |  | 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'); | 
					
						
							| 
									
										
										
										
											2015-03-01 22:17:36 +01:00
										 |  |  | var transformCJSTests = require('./tools/build/transformCJSTests'); | 
					
						
							| 
									
										
										
										
											2015-03-30 13:25:18 -07:00
										 |  |  | 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-04-13 09:52:02 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | // dynamic require in build.broccoli.tools so we can bootstrap TypeScript compilation
 | 
					
						
							|  |  |  | function missingDynamicBroccoli() { | 
					
						
							|  |  |  |   throw new Error('ERROR: build.broccoli.tools task should have been run before using broccoli'); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2015-04-13 16:39:47 -07:00
										 |  |  | var getBroccoli = missingDynamicBroccoli; | 
					
						
							| 
									
										
										
										
											2014-12-22 17:50:10 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-19 11:36:27 -07:00
										 |  |  | // Note: when DART_SDK is not found, all gulp tasks ending with `.dart` will be skipped.
 | 
					
						
							| 
									
										
										
										
											2015-03-23 13:18:05 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | var DART_SDK = require('./tools/build/dartdetect')(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 _COMPILER_CONFIG_JS_DEFAULT = { | 
					
						
							| 
									
										
										
										
											2014-10-30 18:52:32 +01:00
										 |  |  |   sourceMaps: true, | 
					
						
							| 
									
										
										
										
											2014-09-24 20:20:59 -07:00
										 |  |  |   annotations: true, // parse annotations
 | 
					
						
							|  |  |  |   types: true, // parse types
 | 
					
						
							|  |  |  |   script: false, // parse as a module
 | 
					
						
							| 
									
										
										
										
											2014-11-07 09:31:51 -08:00
										 |  |  |   memberVariables: true, // parse class fields
 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  |   modules: 'instantiate' | 
					
						
							| 
									
										
										
										
											2014-09-24 20:20:59 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-11 14:30:49 +02:00
										 |  |  | var _HTML_DEFAULT_SCRIPTS_JS = [ | 
					
						
							| 
									
										
										
										
											2015-03-02 15:15:36 -08:00
										 |  |  |   {src: gulpTraceur.RUNTIME_PATH, mimeType: 'text/javascript', copy: true}, | 
					
						
							|  |  |  |   {src: 'node_modules/es6-module-loader/dist/es6-module-loader-sans-promises.src.js', | 
					
						
							|  |  |  |       mimeType: 'text/javascript', copy: true}, | 
					
						
							|  |  |  |   {src: 'node_modules/zone.js/zone.js', mimeType: 'text/javascript', copy: true}, | 
					
						
							|  |  |  |   {src: 'node_modules/zone.js/long-stack-trace-zone.js', mimeType: 'text/javascript', copy: true}, | 
					
						
							|  |  |  |   {src: 'node_modules/systemjs/dist/system.src.js', mimeType: 'text/javascript', copy: true}, | 
					
						
							|  |  |  |   {src: 'node_modules/systemjs/lib/extension-register.js', mimeType: 'text/javascript', copy: true}, | 
					
						
							| 
									
										
										
										
											2015-03-24 13:45:39 -07:00
										 |  |  |   {src: 'node_modules/systemjs/lib/extension-cjs.js', mimeType: 'text/javascript', copy: true}, | 
					
						
							|  |  |  |   {src: 'node_modules/rx/dist/rx.all.js', mimeType: 'text/javascript', copy: true}, | 
					
						
							| 
									
										
										
										
											2015-03-02 15:15:36 -08:00
										 |  |  |   {src: 'tools/build/snippets/runtime_paths.js', mimeType: 'text/javascript', copy: true}, | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  |   { | 
					
						
							| 
									
										
										
										
											2015-03-02 15:48:18 -08:00
										 |  |  |     inline: 'System.import(\'$MODULENAME$\').then(function(m) { m.main(); }, console.error.bind(console))', | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  |     mimeType: 'text/javascript' | 
					
						
							| 
									
										
										
										
											2014-12-03 15:21:57 +01:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | ]; | 
					
						
							| 
									
										
										
										
											2014-09-25 14:04:46 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-23 17:56:47 -08:00
										 |  |  | var BASE_PACKAGE_JSON = require('./package.json'); | 
					
						
							|  |  |  | var COMMON_PACKAGE_JSON = { | 
					
						
							|  |  |  |   version: BASE_PACKAGE_JSON.version, | 
					
						
							|  |  |  |   homepage: BASE_PACKAGE_JSON.homepage, | 
					
						
							|  |  |  |   bugs: BASE_PACKAGE_JSON.bugs, | 
					
						
							|  |  |  |   license: BASE_PACKAGE_JSON.license, | 
					
						
							|  |  |  |   contributors: BASE_PACKAGE_JSON.contributors, | 
					
						
							|  |  |  |   dependencies: BASE_PACKAGE_JSON.dependencies, | 
					
						
							|  |  |  |   devDependencies: { | 
					
						
							|  |  |  |     "yargs": BASE_PACKAGE_JSON.devDependencies['yargs'], | 
					
						
							|  |  |  |     "gulp-sourcemaps": BASE_PACKAGE_JSON.devDependencies['gulp-sourcemaps'], | 
					
						
							|  |  |  |     "gulp-traceur": BASE_PACKAGE_JSON.devDependencies['gulp-traceur'], | 
					
						
							|  |  |  |     "gulp": BASE_PACKAGE_JSON.devDependencies['gulp'], | 
					
						
							|  |  |  |     "gulp-rename": BASE_PACKAGE_JSON.devDependencies['gulp-rename'], | 
					
						
							|  |  |  |     "through2": BASE_PACKAGE_JSON.devDependencies['through2'] | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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-01-16 14:21:55 +01:00
										 |  |  |     docs: 'dist/docs' | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  |   }, | 
					
						
							|  |  |  |   transpile: { | 
					
						
							|  |  |  |     src: { | 
					
						
							| 
									
										
										
										
											2015-02-11 11:40:29 -08:00
										 |  |  |       js: ['modules/**/*.js', 'modules/**/*.es6'], | 
					
						
							| 
									
										
										
										
											2015-03-30 13:25:18 -07:00
										 |  |  |       ts: ['modules/**/*.ts'], | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     options: { | 
					
						
							|  |  |  |       js: { | 
					
						
							|  |  |  |         dev: merge(true, _COMPILER_CONFIG_JS_DEFAULT, { | 
					
						
							|  |  |  |           typeAssertionModule: 'rtts_assert/rtts_assert', | 
					
						
							| 
									
										
										
										
											2015-02-06 21:04:43 -08:00
										 |  |  |           typeAssertions: true, | 
					
						
							|  |  |  |           outputLanguage: 'es6' | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  |         }), | 
					
						
							|  |  |  |         prod: merge(true, _COMPILER_CONFIG_JS_DEFAULT, { | 
					
						
							| 
									
										
										
										
											2015-02-06 21:04:43 -08:00
										 |  |  |           typeAssertions: false, | 
					
						
							|  |  |  |           outputLanguage: 'es6' | 
					
						
							| 
									
										
										
										
											2015-02-11 11:40:29 -08:00
										 |  |  |         }), | 
					
						
							|  |  |  |         cjs: merge(true, _COMPILER_CONFIG_JS_DEFAULT, { | 
					
						
							|  |  |  |           typeAssertionModule: 'rtts_assert/rtts_assert', | 
					
						
							| 
									
										
										
										
											2015-04-01 10:45:56 -07:00
										 |  |  |           // Don't use type assertions since this is partly transpiled by typescript
 | 
					
						
							|  |  |  |           typeAssertions: false, | 
					
						
							| 
									
										
										
										
											2015-02-11 11:40:29 -08:00
										 |  |  |           modules: 'commonjs' | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  |         }) | 
					
						
							| 
									
										
										
										
											2015-02-11 11:40:29 -08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  |     } | 
					
						
							|  |  |  |   }, | 
					
						
							| 
									
										
										
										
											2015-02-10 11:06:59 -08:00
										 |  |  |   copy: { | 
					
						
							| 
									
										
										
										
											2015-02-23 17:56:47 -08:00
										 |  |  |     js: { | 
					
						
							|  |  |  |       cjs: { | 
					
						
							| 
									
										
										
										
											2015-03-27 16:45:35 -07:00
										 |  |  |         src: [ | 
					
						
							|  |  |  |           'modules/**/*.md', '!modules/**/*.dart.md', 'modules/**/*.png', | 
					
						
							| 
									
										
										
										
											2015-03-31 19:14:07 +02:00
										 |  |  |           'modules/**/package.json' | 
					
						
							| 
									
										
										
										
											2015-03-27 16:45:35 -07:00
										 |  |  |         ], | 
					
						
							| 
									
										
										
										
											2015-02-23 17:56:47 -08:00
										 |  |  |         pipes: { | 
					
						
							|  |  |  |           '**/*.js.md': gulpPlugins.rename(function(file) { | 
					
						
							|  |  |  |             file.basename = file.basename.substring(0, file.basename.lastIndexOf('.')); | 
					
						
							|  |  |  |           }), | 
					
						
							|  |  |  |           '**/package.json': gulpPlugins.template({ 'packageJson': COMMON_PACKAGE_JSON }) | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2015-02-26 10:08:58 -08:00
										 |  |  |       }, | 
					
						
							|  |  |  |       dev: { | 
					
						
							|  |  |  |         src: ['modules/**/*.css'], | 
					
						
							|  |  |  |         pipes: {} | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       prod: { | 
					
						
							|  |  |  |         src: ['modules/**/*.css'], | 
					
						
							|  |  |  |         pipes: {} | 
					
						
							| 
									
										
										
										
											2015-02-23 17:56:47 -08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2015-02-17 11:56:24 -08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-02-10 11:06:59 -08:00
										 |  |  |   }, | 
					
						
							|  |  |  |   multicopy: { | 
					
						
							| 
									
										
										
										
											2015-02-23 17:56:47 -08:00
										 |  |  |     js: { | 
					
						
							|  |  |  |       cjs: { | 
					
						
							|  |  |  |         src: [ | 
					
						
							|  |  |  |           'LICENSE' | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |         pipes: {} | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       dev: { | 
					
						
							|  |  |  |         es6: { | 
					
						
							|  |  |  |           src: ['tools/build/es5build.js'], | 
					
						
							|  |  |  |           pipes: {} | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       prod: { | 
					
						
							|  |  |  |         es6: { | 
					
						
							|  |  |  |           src: ['tools/build/es5build.js'], | 
					
						
							|  |  |  |           pipes: {} | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2015-02-10 11:06:59 -08:00
										 |  |  |   }, | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  |   html: { | 
					
						
							|  |  |  |     src: { | 
					
						
							|  |  |  |       js: ['modules/*/src/**/*.html'], | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     scriptsPerFolder: { | 
					
						
							|  |  |  |       js: { | 
					
						
							| 
									
										
										
										
											2015-03-11 14:30:49 +02:00
										 |  |  |         '**': _HTML_DEFAULT_SCRIPTS_JS, | 
					
						
							| 
									
										
										
										
											2015-01-09 18:00:04 -08:00
										 |  |  |         'benchmarks/**': | 
					
						
							|  |  |  |           [ | 
					
						
							| 
									
										
										
										
											2015-03-02 15:15:36 -08:00
										 |  |  |             { src: 'tools/build/snippets/url_params_to_form.js', mimeType: 'text/javascript', copy: true } | 
					
						
							| 
									
										
										
										
											2015-03-11 14:30:49 +02:00
										 |  |  |           ].concat(_HTML_DEFAULT_SCRIPTS_JS), | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  |         'benchmarks_external/**': | 
					
						
							| 
									
										
										
										
											2015-01-09 18:00:04 -08:00
										 |  |  |           [ | 
					
						
							| 
									
										
										
										
											2015-03-02 15:15:36 -08:00
										 |  |  |             { src: 'node_modules/angular/angular.js', mimeType: 'text/javascript', copy: true }, | 
					
						
							|  |  |  |             { src: 'tools/build/snippets/url_params_to_form.js', mimeType: 'text/javascript', copy: true } | 
					
						
							| 
									
										
										
										
											2015-02-25 07:45:51 -08:00
										 |  |  |           ].concat(_HTML_DEFAULT_SCRIPTS_JS), | 
					
						
							|  |  |  |         'benchmarks_external/**/*polymer*/**': | 
					
						
							|  |  |  |           [ | 
					
						
							|  |  |  |             { src: 'bower_components/polymer/lib/polymer.html', copyOnly: true }, | 
					
						
							|  |  |  |             { src: 'tools/build/snippets/url_params_to_form.js', mimeType: 'text/javascript', copy: true } | 
					
						
							|  |  |  |           ] | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  |       }, | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }, | 
					
						
							| 
									
										
										
										
											2015-01-30 11:03:11 -08:00
										 |  |  |   formatDart: { | 
					
						
							|  |  |  |     packageName: 'dart_style', | 
					
						
							|  |  |  |     args: ['dart_style:format', '-w', 'dist/dart'] | 
					
						
							| 
									
										
										
										
											2015-03-09 17:41:49 +01:00
										 |  |  |   }, | 
					
						
							|  |  |  |   test: { | 
					
						
							|  |  |  |     js: { | 
					
						
							|  |  |  |       cjs: [ | 
					
						
							| 
									
										
										
										
											2015-04-14 11:31:35 +02:00
										 |  |  |         '/angular2/test/**/*_spec.js' | 
					
						
							| 
									
										
										
										
											2015-03-09 17:41:49 +01:00
										 |  |  |       ] | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2014-11-17 20:47:05 -08:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2015-03-09 17:41:49 +01:00
										 |  |  | CONFIG.test.js.cjs = CONFIG.test.js.cjs.map(function(s) {return CONFIG.dest.js.cjs + s}); | 
					
						
							| 
									
										
										
										
											2015-04-14 11:31:35 +02:00
										 |  |  | CONFIG.test.js.cjs.push('!**/core/zone/vm_turn_zone_spec.js'); //Disabled in nodejs because it relies on Zone.js
 | 
					
						
							|  |  |  | CONFIG.test.js.cjs.push('!**/render/dom/events/event_manager_spec.js'); //Disabled in nodejs because it relies on DOM events
 | 
					
						
							| 
									
										
										
										
											2014-10-08 16:15:38 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | // ------------
 | 
					
						
							|  |  |  | // clean
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('build/clean.js', clean(gulp, gulpPlugins, { | 
					
						
							|  |  |  |   path: CONFIG.dest.js.all | 
					
						
							|  |  |  | })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('build/clean.dart', clean(gulp, gulpPlugins, { | 
					
						
							|  |  |  |   path: CONFIG.dest.dart | 
					
						
							|  |  |  | })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-16 14:21:55 +01:00
										 |  |  | gulp.task('build/clean.docs', clean(gulp, gulpPlugins, { | 
					
						
							|  |  |  |     path: CONFIG.dest.docs | 
					
						
							|  |  |  | })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-06 15:19:22 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | // ------------
 | 
					
						
							|  |  |  | // transpile
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-13 16:22:23 -07:00
										 |  |  | gulp.task('build/tree.dart', ['build.broccoli.tools'], function() { | 
					
						
							| 
									
										
										
										
											2015-04-13 16:39:47 -07:00
										 |  |  |   return getBroccoli().forDartTree().buildOnce(); | 
					
						
							| 
									
										
										
										
											2015-03-18 14:42:18 -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 })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // 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-02-11 11:40:29 -08:00
										 |  |  | // ------------
 | 
					
						
							|  |  |  | // linknodemodules
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('build/linknodemodules.js.cjs', linknodemodules(gulp, gulpPlugins, { | 
					
						
							|  |  |  |   dir: CONFIG.dest.js.cjs | 
					
						
							|  |  |  | })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-22 17:50:10 -08:00
										 |  |  | // ------------
 | 
					
						
							|  |  |  | // pubbuild
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 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
										 |  |  | 
 | 
					
						
							|  |  |  | gulp.task('build/format.dart', rundartpackage(gulp, gulpPlugins, { | 
					
						
							|  |  |  |   pub: DART_SDK.PUB, | 
					
						
							|  |  |  |   packageName: CONFIG.formatDart.packageName, | 
					
						
							|  |  |  |   args: CONFIG.formatDart.args | 
					
						
							|  |  |  | })); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-11 13:29:32 -07:00
										 |  |  | function doCheckFormat() { | 
					
						
							|  |  |  |   return gulp.src(['Brocfile*.js', 'modules/**/*.ts', 'tools/**/*.ts', '!**/typings/**/*.d.ts']) | 
					
						
							|  |  |  |     .pipe(format.checkFormat('file')); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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) { | 
					
						
							|  |  |  |     console.log("ERROR: Some files need formatting"); | 
					
						
							|  |  |  |     process.exit(1); | 
					
						
							|  |  |  |   }); | 
					
						
							| 
									
										
										
										
											2015-04-01 10:45:56 -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], | 
					
						
							|  |  |  |     extensions: ['.js', '.es6'], | 
					
						
							|  |  |  |     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(); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-18 14:56:38 -07:00
										 |  |  | // ------------------
 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | // web servers
 | 
					
						
							|  |  |  | gulp.task('serve.js.dev', jsserve(gulp, gulpPlugins, { | 
					
						
							| 
									
										
										
										
											2015-02-06 21:04:43 -08:00
										 |  |  |   path: CONFIG.dest.js.dev.es5, | 
					
						
							| 
									
										
										
										
											2014-12-22 17:50:10 -08:00
										 |  |  |   port: 8000 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('serve.js.prod', jsserve(gulp, gulpPlugins, { | 
					
						
							| 
									
										
										
										
											2015-02-06 21:04:43 -08:00
										 |  |  |   path: CONFIG.dest.js.prod.es5, | 
					
						
							| 
									
										
										
										
											2014-12-22 17:50:10 -08:00
										 |  |  |   port: 8001 | 
					
						
							|  |  |  | })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('serve.js.dart2js', jsserve(gulp, gulpPlugins, { | 
					
						
							|  |  |  |   path: CONFIG.dest.js.dart2js, | 
					
						
							|  |  |  |   port: 8002 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('serve/examples.dart', pubserve(gulp, gulpPlugins, { | 
					
						
							|  |  |  |   command: DART_SDK.PUB, | 
					
						
							|  |  |  |   path: CONFIG.dest.dart + '/examples' | 
					
						
							|  |  |  | })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('serve/benchmarks.dart', pubserve(gulp, gulpPlugins, { | 
					
						
							|  |  |  |   command: DART_SDK.PUB, | 
					
						
							|  |  |  |   path: CONFIG.dest.dart + '/benchmarks' | 
					
						
							|  |  |  | })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('serve/benchmarks_external.dart', pubserve(gulp, gulpPlugins, { | 
					
						
							|  |  |  |   command: DART_SDK.PUB, | 
					
						
							|  |  |  |   path: CONFIG.dest.dart + '/benchmarks_external' | 
					
						
							|  |  |  | })); | 
					
						
							| 
									
										
										
										
											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 jasmine = require('gulp-jasmine'); | 
					
						
							|  |  |  | 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) { | 
					
						
							|  |  |  |     console.log('bower:', result.id, result.data.endpoint.name); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   bowerTask.on('error', function(error) { | 
					
						
							|  |  |  |     console.log(error); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   return bowerTask; | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-17 16:49:31 +00:00
										 |  |  | function createDocsTasks(public) { | 
					
						
							|  |  |  |   var dgeniPackage = public ? './docs/public-docs-package' : './docs/dgeni-package'; | 
					
						
							|  |  |  |   var distDocsPath = public ? 'dist/public_docs' : 'dist/docs'; | 
					
						
							|  |  |  |   var taskPrefix = public ? 'public_docs' : 'docs'; | 
					
						
							| 
									
										
										
										
											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() { | 
					
						
							|  |  |  |     return gulp.watch('docs/app/**/*', [taskPrefix + '/app']); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   gulp.task(taskPrefix + '/test', function () { | 
					
						
							|  |  |  |     return gulp.src('docs/**/*.spec.js') | 
					
						
							|  |  |  |         .pipe(jasmine({ | 
					
						
							|  |  |  |           includeStackTrace: true | 
					
						
							|  |  |  |         })); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   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-03-17 16:49:31 +00:00
										 |  |  | createDocsTasks(true); | 
					
						
							|  |  |  | createDocsTasks(false); | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-07 18:29:19 +01:00
										 |  |  | // ------------------
 | 
					
						
							| 
									
										
										
										
											2015-03-19 11:36:27 -07:00
										 |  |  | // CI tests suites
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('test.js', function(done) { | 
					
						
							|  |  |  |   runSequence('test.transpiler.unittest', 'docs/test', 'test.unit.js/ci', | 
					
						
							|  |  |  |               'test.unit.cjs/ci', done); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('test.dart', function(done) { | 
					
						
							|  |  |  |   runSequence('test.transpiler.unittest', 'docs/test', 'test.unit.dart/ci', done); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Reuse the Travis scripts
 | 
					
						
							|  |  |  | // TODO: rename test_*.sh to test_all_*.sh
 | 
					
						
							|  |  |  | 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-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() { | 
					
						
							|  |  |  |   var args = minimist(process.argv.slice(2)); | 
					
						
							|  |  |  |   return [args.browsers?args.browsers:'DartiumWithWebPlatform'] | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2015-02-20 17:44:23 -08:00
										 |  |  | gulp.task('test.unit.js', function (done) { | 
					
						
							| 
									
										
										
										
											2014-11-07 18:29:19 +01:00
										 |  |  |   karma.start({configFile: __dirname + '/karma-js.conf.js'}, done); | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-02-20 17:44:23 -08:00
										 |  |  | gulp.task('test.unit.dart', function (done) { | 
					
						
							| 
									
										
										
										
											2014-11-07 18:29:19 +01:00
										 |  |  |   karma.start({configFile: __dirname + '/karma-dart.conf.js'}, done); | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-02-20 17:44:23 -08:00
										 |  |  | gulp.task('test.unit.js/ci', function (done) { | 
					
						
							|  |  |  |   karma.start({configFile: __dirname + '/karma-js.conf.js', | 
					
						
							|  |  |  |       singleRun: true, reporters: ['dots'], browsers: getBrowsersFromCLI()}, done); | 
					
						
							| 
									
										
										
										
											2014-11-07 18:29:19 +01:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-02-20 17:44:23 -08:00
										 |  |  | gulp.task('test.unit.dart/ci', function (done) { | 
					
						
							|  |  |  |   karma.start({configFile: __dirname + '/karma-dart.conf.js', | 
					
						
							|  |  |  |       singleRun: true, reporters: ['dots'], browsers: getBrowsersFromCLI()}, done); | 
					
						
							| 
									
										
										
										
											2014-11-07 18:29:19 +01:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-03-18 00:43:30 +01:00
										 |  |  | gulp.task('test.unit.cjs/ci', function () { | 
					
						
							|  |  |  |   return gulp.src(CONFIG.test.js.cjs).pipe(jasmine({includeStackTrace: true, timeout: 1000})); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | gulp.task('test.unit.cjs', ['build.js.cjs'], function () { | 
					
						
							|  |  |  |   //Run tests once
 | 
					
						
							|  |  |  |   runSequence('test.unit.cjs/ci', function() {}); | 
					
						
							| 
									
										
										
										
											2015-04-13 18:59:37 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-18 00:43:30 +01:00
										 |  |  |   //Watcher to transpile file changed
 | 
					
						
							|  |  |  |   gulp.watch(CONFIG.transpile.src.js.concat(['modules/**/*.cjs']), function(event) { | 
					
						
							|  |  |  |     var relPath = path.relative(__dirname, event.path).replace(/\\/g, "/"); | 
					
						
							|  |  |  |     gulp.src(relPath) | 
					
						
							|  |  |  |       .pipe(gulpPlugins.rename({extname: '.'+ 'js'})) | 
					
						
							|  |  |  |       .pipe(gulpTraceur(CONFIG.transpile.options.js.cjs, file2moduleName)) | 
					
						
							|  |  |  |       .pipe(transformCJSTests()) | 
					
						
							|  |  |  |       .pipe(gulp.dest(CONFIG.dest.js.cjs + path.dirname(relPath.replace("modules", "")))); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  |   //Watcher to run tests when dist/js/cjs/angular2 is updated by the first watcher (after clearing the node cache)
 | 
					
						
							|  |  |  |   gulp.watch(CONFIG.dest.js.cjs + '/angular2/**/*.js', function(event) { | 
					
						
							| 
									
										
										
										
											2015-03-25 20:37:39 -07:00
										 |  |  |     for (var id in require.cache) { | 
					
						
							| 
									
										
										
										
											2015-03-18 00:43:30 +01:00
										 |  |  |       if (id.replace(/\\/g, "/").indexOf(CONFIG.dest.js.cjs) > -1) { | 
					
						
							| 
									
										
										
										
											2015-03-25 20:37:39 -07:00
										 |  |  |         delete require.cache[id]; | 
					
						
							| 
									
										
										
										
											2015-03-18 00:43:30 +01:00
										 |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-04-13 18:59:37 +02:00
										 |  |  |     global.assert = undefined; // https://github.com/angular/angular/issues/1340
 | 
					
						
							| 
									
										
										
										
											2015-03-18 00:43:30 +01:00
										 |  |  |     runSequence('test.unit.cjs/ci', function() {}); | 
					
						
							|  |  |  |   }); | 
					
						
							| 
									
										
										
										
											2015-03-25 20:37:39 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-01 22:17:36 +01: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-07 14:12:41 -07:00
										 |  |  | gulp.task('test.transpiler.unittest', function() { | 
					
						
							| 
									
										
										
										
											2015-02-04 14:59:12 -08:00
										 |  |  |   return gulp.src('tools/transpiler/unittest/**/*.js') | 
					
						
							| 
									
										
										
										
											2015-02-06 13:36:31 -08:00
										 |  |  |       .pipe(jasmine({ | 
					
						
							|  |  |  |         includeStackTrace: true | 
					
						
							| 
									
										
										
										
											2015-04-13 16:39:47 -07:00
										 |  |  |       })); | 
					
						
							| 
									
										
										
										
											2015-02-04 14:59:12 -08:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2014-11-07 18:29:19 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | // -----------------
 | 
					
						
							|  |  |  | // orchestrated targets
 | 
					
						
							| 
									
										
										
										
											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-13 16:22:23 -07:00
										 |  |  |   runSequence('build/tree.dart', 'build/format.dart', 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', | 
					
						
							| 
									
										
										
										
											2014-12-22 17:50:10 -08:00
										 |  |  |     'build/pubbuild.dart', | 
					
						
							| 
									
										
										
										
											2015-02-10 15:18:16 -08:00
										 |  |  |     done | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  |   ); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-10 16:45:24 -07:00
										 |  |  | gulp.task('build.broccoli.tools', function() { | 
					
						
							|  |  |  |   var tsResult = gulp.src('tools/broccoli/**/*.ts') | 
					
						
							| 
									
										
										
										
											2015-04-14 11:46:01 -07:00
										 |  |  |                      .pipe(tsc({target: 'ES5', module: 'commonjs'})) | 
					
						
							|  |  |  |                      .on('error', function() { | 
					
						
							|  |  |  |                        console.log("ERROR: Broccoli tools failed to build."); | 
					
						
							|  |  |  |                        process.exit(1); | 
					
						
							|  |  |  |                      }); | 
					
						
							| 
									
										
										
										
											2015-04-13 09:52:02 -07:00
										 |  |  |   return tsResult.js.pipe(gulp.dest('dist/broccoli')) | 
					
						
							|  |  |  |       .on('end', function() { | 
					
						
							| 
									
										
										
										
											2015-04-13 16:39:47 -07:00
										 |  |  |         var BroccoliBuilder = require('./dist/broccoli/broccoli_builder').BroccoliBuilder; | 
					
						
							| 
									
										
										
										
											2015-04-14 11:46:01 -07:00
										 |  |  |         getBroccoli = function() { return BroccoliBuilder; }; | 
					
						
							| 
									
										
										
										
											2015-04-13 09:52:02 -07:00
										 |  |  |       }); | 
					
						
							| 
									
										
										
										
											2015-04-10 16:45:24 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('broccoli.js.dev', ['build.broccoli.tools'], function() { | 
					
						
							| 
									
										
										
										
											2015-04-13 16:39:47 -07:00
										 |  |  |   return getBroccoli().forDevTree().buildOnce(); | 
					
						
							| 
									
										
										
										
											2015-04-08 08:28:12 -07:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-04-10 11:48:37 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-10 16:45:24 -07:00
										 |  |  | gulp.task('broccoli.js.prod', ['build.broccoli.tools'], function() { | 
					
						
							| 
									
										
										
										
											2015-04-13 16:39:47 -07:00
										 |  |  |   return getBroccoli().forProdTree().buildOnce(); | 
					
						
							| 
									
										
										
										
											2015-04-10 11:48:37 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-10 15:18:16 -08:00
										 |  |  | gulp.task('build.js.dev', function(done) { | 
					
						
							|  |  |  |   runSequence( | 
					
						
							| 
									
										
										
										
											2015-04-08 08:28:12 -07:00
										 |  |  |     'broccoli.js.dev', | 
					
						
							| 
									
										
										
										
											2015-03-16 18:48:14 +01:00
										 |  |  |     'build/checkCircularDependencies', | 
					
						
							| 
									
										
										
										
											2015-04-11 13:29:32 -07:00
										 |  |  |     'check-format', | 
					
						
							| 
									
										
										
										
											2015-02-10 15:18:16 -08:00
										 |  |  |     done | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  |   ); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-10 11:48:37 -07:00
										 |  |  | gulp.task('build.js.prod', ['broccoli.js.prod']); | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-10 16:45:24 -07:00
										 |  |  | gulp.task('broccoli.js.cjs', ['build.broccoli.tools'], function() { | 
					
						
							| 
									
										
										
										
											2015-04-13 16:39:47 -07:00
										 |  |  |   return getBroccoli().forNodeTree().buildOnce(); | 
					
						
							| 
									
										
										
										
											2015-04-09 15:56:54 -07:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2015-02-11 11:40:29 -08:00
										 |  |  | gulp.task('build.js.cjs', function(done) { | 
					
						
							| 
									
										
										
										
											2015-02-10 15:18:16 -08:00
										 |  |  |   runSequence( | 
					
						
							| 
									
										
										
										
											2015-04-09 15:56:54 -07:00
										 |  |  |     'broccoli.js.cjs', | 
					
						
							| 
									
										
										
										
											2015-02-23 17:56:47 -08:00
										 |  |  |     ['build/linknodemodules.js.cjs'], | 
					
						
							| 
									
										
										
										
											2015-02-10 15:18:16 -08:00
										 |  |  |     done | 
					
						
							| 
									
										
										
										
											2015-03-03 08:46:20 -06:00
										 |  |  |   ); | 
					
						
							| 
									
										
										
										
											2015-01-06 15:19:22 -08:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-23 13:18:05 -07:00
										 |  |  | var bundleConfig = { | 
					
						
							|  |  |  |   paths: { | 
					
						
							|  |  |  |     "*": "dist/js/prod/es6/*.es6", | 
					
						
							|  |  |  |     "rx/*": "node_modules/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
 | 
					
						
							|  |  |  |     'rx/dist/rx.all': { | 
					
						
							|  |  |  |         format: 'cjs' | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-03-23 13:18:05 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // production build
 | 
					
						
							|  |  |  | gulp.task('bundle.js.prod', ['build.js.prod'], function() { | 
					
						
							|  |  |  |   return bundler.bundle( | 
					
						
							| 
									
										
										
										
											2015-04-02 19:53:11 -07:00
										 |  |  |       bundleConfig, | 
					
						
							|  |  |  |       'angular2/angular2', | 
					
						
							|  |  |  |       './dist/build/angular2.js', | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         sourceMaps: true | 
					
						
							|  |  |  |       }); | 
					
						
							| 
									
										
										
										
											2015-03-23 13:18:05 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // minified production build
 | 
					
						
							| 
									
										
										
										
											2015-04-02 19:53:11 -07:00
										 |  |  | // TODO: minify zone.js
 | 
					
						
							| 
									
										
										
										
											2015-03-23 13:18:05 -07:00
										 |  |  | gulp.task('bundle.js.min', ['build.js.prod'], function() { | 
					
						
							|  |  |  |   return bundler.bundle( | 
					
						
							| 
									
										
										
										
											2015-04-02 19:53:11 -07:00
										 |  |  |       bundleConfig, | 
					
						
							|  |  |  |       'angular2/angular2', | 
					
						
							|  |  |  |       './dist/build/angular2.min.js', | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         sourceMaps: true, | 
					
						
							|  |  |  |         minify: true | 
					
						
							|  |  |  |       }); | 
					
						
							| 
									
										
										
										
											2015-03-23 13:18:05 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // development build
 | 
					
						
							|  |  |  | 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-04-02 19:53:11 -07:00
										 |  |  |        "*": "dist/js/dev/es6/*.es6" | 
					
						
							| 
									
										
										
										
											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-04-13 16:48:04 -07:00
										 |  |  |       { sourceMaps: true }); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // 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).
 | 
					
						
							|  |  |  | gulp.task('bundle.js.sfx.dev', ['build.js.dev'], function() { | 
					
						
							|  |  |  |   var devBundleConfig = merge(true, bundleConfig); | 
					
						
							|  |  |  |   devBundleConfig.paths = | 
					
						
							|  |  |  |       merge(true, devBundleConfig.paths, { | 
					
						
							|  |  |  |        '*': 'dist/js/dev/es6/*.es6' | 
					
						
							| 
									
										
										
										
											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 }, | 
					
						
							|  |  |  |       /* self-exectuting */ true); | 
					
						
							| 
									
										
										
										
											2015-04-02 19:53:11 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('bundle.js.prod.deps', ['bundle.js.prod'], function() { | 
					
						
							|  |  |  |   return bundler.modify( | 
					
						
							|  |  |  |       ['node_modules/zone.js/zone.js', 'dist/build/angular2.js'], 'angular2.js') | 
					
						
							|  |  |  |       .pipe(gulp.dest('dist/bundle')); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('bundle.js.min.deps', ['bundle.js.min'], function() { | 
					
						
							|  |  |  |   return bundler.modify( | 
					
						
							|  |  |  |       ['node_modules/zone.js/zone.js', 'dist/build/angular2.min.js'], 'angular2.min.js') | 
					
						
							|  |  |  |       .pipe(gulp.dest('dist/bundle')); | 
					
						
							| 
									
										
										
										
											2015-03-23 13:18:05 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-13 16:48:04 -07:00
										 |  |  | var JS_DEV_DEPS = ['node_modules/zone.js/zone.js', 'node_modules/zone.js/long-stack-trace-zone.js']; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-23 13:18:05 -07:00
										 |  |  | gulp.task('bundle.js.dev.deps', ['bundle.js.dev'], function() { | 
					
						
							| 
									
										
										
										
											2015-04-13 16:48:04 -07:00
										 |  |  |   return bundler.modify(JS_DEV_DEPS.concat(['dist/build/angular2.dev.js']), 'angular2.dev.js') | 
					
						
							|  |  |  |       .pipe(insert.append('\nzone = zone.fork(Zone.longStackTraceZone);\n')) | 
					
						
							|  |  |  |       .pipe(gulp.dest('dist/bundle')); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('bundle.js.sfx.dev.deps', ['bundle.js.sfx.dev'], function() { | 
					
						
							|  |  |  |   return bundler.modify(JS_DEV_DEPS.concat(['dist/build/angular2.sfx.dev.js']), | 
					
						
							|  |  |  |                         'angular2.sfx.dev.js') | 
					
						
							| 
									
										
										
										
											2015-04-02 19:53:11 -07:00
										 |  |  |       .pipe(insert.append('\nzone = zone.fork(Zone.longStackTraceZone);\n')) | 
					
						
							|  |  |  |       .pipe(gulp.dest('dist/bundle')); | 
					
						
							| 
									
										
										
										
											2015-03-23 13:18:05 -07:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-13 16:48:04 -07:00
										 |  |  | gulp.task('bundle.js.deps', ['bundle.js.prod.deps', 'bundle.js.dev.deps', 'bundle.js.min.deps', 'bundle.js.sfx.dev.deps']); | 
					
						
							| 
									
										
										
										
											2014-12-05 16:26:30 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-13 16:48:04 -07:00
										 |  |  | gulp.task('build.js', ['build.js.dev', 'build.js.prod', 'build.js.cjs', 'bundle.js.deps']); | 
					
						
							| 
									
										
										
										
											2015-04-08 08:28:12 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-11 11:40:29 -08:00
										 |  |  | gulp.task('clean', ['build/clean.js', 'build/clean.dart', 'build/clean.docs']); | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // ------------
 | 
					
						
							|  |  |  | // angular material testing rules
 | 
					
						
							|  |  |  | gulp.task('build/css.js.dev', function() { | 
					
						
							|  |  |  |   return gulp.src('modules/*/src/**/*.scss') | 
					
						
							|  |  |  |       .pipe(sass()) | 
					
						
							|  |  |  |       .pipe(autoprefixer()) | 
					
						
							|  |  |  |       .pipe(gulp.dest(CONFIG.dest.js.dev.es5)); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // TODO: this target is temporary until we find a way to use the SASS transformer
 | 
					
						
							|  |  |  | gulp.task('build/css.dart', function() { | 
					
						
							|  |  |  |   return gulp.src('dist/dart/angular2_material/lib/src/**/*.scss') | 
					
						
							|  |  |  |       .pipe(sass()) | 
					
						
							|  |  |  |       .pipe(autoprefixer()) | 
					
						
							|  |  |  |       .pipe(gulp.dest('dist/dart/angular2_material/lib/src')); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | gulp.task('build.material', ['build.js.dev', 'build/css.js.dev']); |