2017-01-27 09:17:50 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#!/usr/bin/env bash
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Build a folder using angular ES6 and the closure compiler
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								set -e -o pipefail
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# The ES6 distro we built for rxjs works only in the browser, not in nodejs.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# Since we installed rxjs in node_modules for ngc to use, we have to point
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								# to the alternate distro when compiling with closure.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								rm -rf vendor
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								mkdir vendor
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								cp -pr ../rxjs/dist/es6 vendor/rxjs
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								CLOSURE_ARGS=(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  "--language_in=ES6_STRICT"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  "--language_out=ES5"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  "--compilation_level=ADVANCED_OPTIMIZATIONS"
							 | 
						
					
						
							
								
									
										
										
										
											2017-01-27 18:25:17 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  "--warning_level=QUIET"
							 | 
						
					
						
							
								
									
										
										
										
											2017-01-27 09:17:50 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  "--js_output_file=dist/bundle.js"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  "--create_source_map=%outname%.map"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  "--variable_renaming_report=dist/variable_renaming_report"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  "--property_renaming_report=dist/property_renaming_report"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  # Don't include ES6 polyfills
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  "--rewrite_polyfills=false"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  # List of path prefixes to be removed from ES6 & CommonJS modules.
							 | 
						
					
						
							
								
									
										
										
										
											2017-01-27 17:39:48 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  "--js_module_root=node_modules/@angular/core"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  "--js_module_root=node_modules/@angular/common"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  "--js_module_root=node_modules/@angular/compiler"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  "--js_module_root=node_modules/@angular/platform-browser"
							 | 
						
					
						
							
								
									
										
										
										
											2017-01-27 09:17:50 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  "--js_module_root=vendor"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  # Uncomment for easier debugging
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  # "--formatting=PRETTY_PRINT"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-01 20:47:04 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  e2e/testability.externs.js
							 | 
						
					
						
							
								
									
										
										
										
											2017-01-27 09:17:50 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  node_modules/zone.js/dist/zone.js
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  $(find -L vendor/rxjs -name *.js)
							 | 
						
					
						
							
								
									
										
										
										
											2017-01-27 17:39:48 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  node_modules/@angular/core/@angular/core.js
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  node_modules/@angular/common/@angular/common.js
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  node_modules/@angular/compiler/@angular/compiler.js
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  node_modules/@angular/platform-browser/@angular/platform-browser.js
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-01 20:47:04 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  "built/src/*.js"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  "--entry_point=./built/src/main"
							 | 
						
					
						
							
								
									
										
										
										
											2017-01-27 09:17:50 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								java -jar node_modules/google-closure-compiler/compiler.jar $(echo ${CLOSURE_ARGS[*]})
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-01 20:47:04 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								# gzip on Travis doesn't have --keep option so copy the original file first
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								cp dist/bundle.js dist/bundle.tmp
							 | 
						
					
						
							
								
									
										
										
										
											2017-01-27 09:17:50 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								gzip -f dist/bundle.js
							 | 
						
					
						
							
								
									
										
										
										
											2017-02-01 20:47:04 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								mv dist/bundle.tmp dist/bundle.js
							 | 
						
					
						
							
								
									
										
										
										
											2017-01-27 09:17:50 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								ls -alH dist/bundle*
							 |