| 
									
										
										
										
											2015-06-03 17:22:30 -07:00
										 |  |  | #!/bin/bash
 | 
					
						
							| 
									
										
										
										
											2015-11-05 08:20:13 -08:00
										 |  |  | set -ex | 
					
						
							| 
									
										
										
										
											2015-06-03 17:22:30 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | echo ============================================================================= | 
					
						
							| 
									
										
										
										
											2016-01-25 22:47:42 -08:00
										 |  |  | echo "DART DEV COMPILER (DDC) BUILD" | 
					
						
							| 
									
										
										
										
											2015-06-03 17:22:30 -07:00
										 |  |  | echo ============================================================================= | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # go to project dir | 
					
						
							|  |  |  | SCRIPT_DIR=$(dirname $0) | 
					
						
							|  |  |  | source $SCRIPT_DIR/env_dart.sh | 
					
						
							|  |  |  | cd $SCRIPT_DIR/../.. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-12 09:25:01 -08:00
										 |  |  | # Variables | 
					
						
							| 
									
										
										
										
											2016-01-25 17:57:29 -08:00
										 |  |  | DDC_TOTAL_WARNING_CAP="1000" | 
					
						
							| 
									
										
										
										
											2016-01-27 11:19:56 -08:00
										 |  |  | DDC_TOTAL_ERROR_CAP="6" | 
					
						
							| 
									
										
										
										
											2016-01-12 09:25:01 -08:00
										 |  |  | DDC_DIR=`pwd`/tmp/dev_compiler | 
					
						
							|  |  |  | DDC_VERSION="0.1.14" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Get DDC | 
					
						
							|  |  |  | mkdir -p tmp | 
					
						
							|  |  |  | rm -rf tmp/dev_compiler | 
					
						
							|  |  |  | git clone https://github.com/dart-lang/dev_compiler.git tmp/dev_compiler | 
					
						
							|  |  |  | (cd $DDC_DIR && \
 | 
					
						
							|  |  |  |   git checkout tags/$DDC_VERSION && \
 | 
					
						
							|  |  |  |   $PUB get) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Convert TypeScript to Dart | 
					
						
							| 
									
										
										
										
											2015-06-03 17:22:30 -07:00
										 |  |  | ./node_modules/.bin/gulp build/packages.dart | 
					
						
							| 
									
										
										
										
											2016-01-25 17:57:29 -08:00
										 |  |  | ./node_modules/.bin/gulp build.dart.material.css | 
					
						
							| 
									
										
										
										
											2015-06-03 17:22:30 -07:00
										 |  |  | ./node_modules/.bin/gulp build/pubspec.dart | 
					
						
							| 
									
										
										
										
											2016-01-25 22:47:42 -08:00
										 |  |  | node ./scripts/ci/dart_ddc/pubspec_for_ddc.js \
 | 
					
						
							| 
									
										
										
										
											2016-01-12 09:25:01 -08:00
										 |  |  |     --pubspec-file=dist/dart/playground/pubspec.yaml | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Compile playground | 
					
						
							|  |  |  | cd dist/dart/playground | 
					
						
							|  |  |  | $PUB build --mode=debug | 
					
						
							|  |  |  | cd build/web | 
					
						
							|  |  |  | LOG_FILE="analyzer.log" | 
					
						
							|  |  |  | set +e | 
					
						
							|  |  |  | $DART_SDK/bin/dart $DDC_DIR/bin/dartdevc.dart \
 | 
					
						
							| 
									
										
										
										
											2016-01-25 17:57:29 -08:00
										 |  |  |   --dart-sdk=$DART_SDK_LIB_SEARCH_PATH -o out \
 | 
					
						
							|  |  |  |   src/animate/index.dart \
 | 
					
						
							|  |  |  |   src/async/index.dart \
 | 
					
						
							|  |  |  |   src/gestures/index.dart \
 | 
					
						
							|  |  |  |   src/hash_routing/index.dart \
 | 
					
						
							|  |  |  |   src/hello_world/index.dart \
 | 
					
						
							|  |  |  |   src/key_events/index.dart \
 | 
					
						
							|  |  |  |   src/material/button/index.dart \
 | 
					
						
							|  |  |  |   src/material/checkbox/index.dart \
 | 
					
						
							|  |  |  |   src/material/dialog/index.dart \
 | 
					
						
							|  |  |  |   src/material/grid_list/index.dart \
 | 
					
						
							|  |  |  |   src/material/input/index.dart \
 | 
					
						
							|  |  |  |   src/material/progress-linear/index.dart \
 | 
					
						
							|  |  |  |   src/material/radio/index.dart \
 | 
					
						
							|  |  |  |   src/material/switcher/index.dart \
 | 
					
						
							|  |  |  |   src/model_driven_forms/index.dart \
 | 
					
						
							|  |  |  |   src/observable_models/index.dart \
 | 
					
						
							|  |  |  |   src/order_management/index.dart \
 | 
					
						
							|  |  |  |   src/person_management/index.dart \
 | 
					
						
							|  |  |  |   src/relative_assets/index.dart \
 | 
					
						
							|  |  |  |   src/routing/index.dart \
 | 
					
						
							|  |  |  |   src/sourcemap/index.dart \
 | 
					
						
							|  |  |  |   src/svg/index.dart \
 | 
					
						
							|  |  |  |   src/template_driven_forms/index.dart \
 | 
					
						
							|  |  |  |   src/todo/index.dart \
 | 
					
						
							|  |  |  |   src/zippy_component/index.dart \
 | 
					
						
							| 
									
										
										
										
											2016-01-12 09:25:01 -08:00
										 |  |  |   >$LOG_FILE | 
					
						
							|  |  |  | EXIT_CODE=`echo $?` | 
					
						
							|  |  |  | set -e | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Analyzer exits with 1 when there are warnings and something crazy | 
					
						
							|  |  |  | # like 255 when it crashes. We don't want to fail the build if its | 
					
						
							|  |  |  | # only warnings (until our code is warning-free). | 
					
						
							|  |  |  | if [[ "$EXIT_CODE" -ne "0" && "$EXIT_CODE" -ne "1" ]] | 
					
						
							|  |  |  | then | 
					
						
							|  |  |  |   echo "DDC compiler crashed with exit code $EXIT_CODE" | 
					
						
							|  |  |  |   exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | cat $LOG_FILE | 
					
						
							|  |  |  | WARNING_COUNT=`cat $LOG_FILE | wc -l | sed -e 's/^[[:space:]]*//'` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 17:57:29 -08:00
										 |  |  | if [[ "$WARNING_COUNT" -gt "$DDC_TOTAL_WARNING_CAP" ]] | 
					
						
							| 
									
										
										
										
											2016-01-12 09:25:01 -08:00
										 |  |  | then | 
					
						
							|  |  |  |   echo "Too many warnings: $WARNING_COUNT" | 
					
						
							|  |  |  |   exit 1 | 
					
						
							|  |  |  | else | 
					
						
							|  |  |  |   echo "Warning count ok" | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2016-01-21 18:13:58 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-25 17:57:29 -08:00
										 |  |  | ERROR_COUNT=`cat $LOG_FILE | grep -E '^severe.*' | wc -l | sed -e 's/^[[:space:]]*//'` | 
					
						
							|  |  |  | if [[ "$ERROR_COUNT" -gt "$DDC_TOTAL_ERROR_CAP" ]] | 
					
						
							| 
									
										
										
										
											2016-01-21 18:13:58 -08:00
										 |  |  | then | 
					
						
							|  |  |  |   echo "Found severe errors in angular2 package" | 
					
						
							|  |  |  |   exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | echo 'Dart DDC build finished' |