File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,53 @@ SCRIPT_DIR=$(dirname $0)
1010source $SCRIPT_DIR /env_dart.sh
1111cd $SCRIPT_DIR /../..
1212
13+ # Variables
14+ DDC_WARNING_CAP=" 260"
15+ DDC_DIR=` pwd` /tmp/dev_compiler
16+ DDC_VERSION=" 0.1.14"
17+
18+ # Get DDC
19+ mkdir -p tmp
20+ rm -rf tmp/dev_compiler
21+ git clone https://github.com/dart-lang/dev_compiler.git tmp/dev_compiler
22+ (cd $DDC_DIR && \
23+ git checkout tags/$DDC_VERSION && \
24+ $PUB get)
25+
26+ # Convert TypeScript to Dart
1327./node_modules/.bin/gulp build/packages.dart
1428./node_modules/.bin/gulp build/pubspec.dart
15- ./node_modules/.bin/gulp build/analyze.ddc.dart
29+ node ./scripts/ci/dart_experimental/pubspec_for_ddc.js \
30+ --pubspec-file=dist/dart/playground/pubspec.yaml
31+
32+ # Compile playground
33+ cd dist/dart/playground
34+ $PUB build --mode=debug
35+ cd build/web
36+ LOG_FILE=" analyzer.log"
37+ set +e
38+ $DART_SDK /bin/dart $DDC_DIR /bin/dartdevc.dart \
39+ --dart-sdk=$DART_SDK_LIB_SEARCH_PATH -o out src/hello_world/index.dart \
40+ > $LOG_FILE
41+ EXIT_CODE=` echo $? `
42+ set -e
43+
44+ # Analyzer exits with 1 when there are warnings and something crazy
45+ # like 255 when it crashes. We don't want to fail the build if its
46+ # only warnings (until our code is warning-free).
47+ if [[ " $EXIT_CODE " -ne " 0" && " $EXIT_CODE " -ne " 1" ]]
48+ then
49+ echo " DDC compiler crashed with exit code $EXIT_CODE "
50+ exit 1
51+ fi
52+
53+ cat $LOG_FILE
54+ WARNING_COUNT=` cat $LOG_FILE | wc -l | sed -e ' s/^[[:space:]]*//' `
55+
56+ if [[ " $WARNING_COUNT " -gt " $DDC_WARNING_CAP " ]]
57+ then
58+ echo " Too many warnings: $WARNING_COUNT "
59+ exit 1
60+ else
61+ echo " Warning count ok"
62+ fi
Original file line number Diff line number Diff line change 1+ // Removes dart2js from pubspec.yaml for faster building
2+ // Usage: node pubspec_for_ddc.js --pubspec-file=PATH_TO_PUBSPEC_YAML
3+
4+ var fs = require ( 'fs' ) ;
5+ var yaml = require ( 'js-yaml' ) ;
6+ var yargs = require ( 'yargs' ) ;
7+
8+ var pubspecFileOpt = 'pubspec-file' ;
9+ var pubspecFile = yargs
10+ . demand ( [ pubspecFileOpt ] )
11+ . argv [ pubspecFileOpt ] ;
12+
13+ var doc = yaml . safeLoad ( fs . readFileSync ( pubspecFile , 'utf8' ) ) ;
14+
15+ var transformers = doc [ 'transformers' ] ;
16+ if ( transformers ) {
17+ transformers . forEach ( function ( transformer ) {
18+ var dart2js = transformer [ '\$dart2js' ] ;
19+ if ( dart2js ) {
20+ dart2js [ '$exclude' ] = [ 'web/**/*' ] ;
21+ }
22+ } ) ;
23+ }
24+
25+ fs . writeFileSync ( pubspecFile , yaml . safeDump ( doc ) ) ;
Original file line number Diff line number Diff line change @@ -66,6 +66,12 @@ if [[ -z $ENV_SET ]]; then
6666 fi
6767 fi
6868
69+ case " $PLATFORM " in
70+ (Linux) export DART_SDK_LIB_SEARCH_PATH=" $DART_SDK " ;;
71+ (Darwin) export DART_SDK_LIB_SEARCH_PATH=" $DART_SDK /libexec" ;;
72+ (* ) echo Unsupported platform $PLATFORM . Exiting ... >&2 ; exit 3 ;;
73+ esac
74+
6975 export DART_SDK
7076 export DARTSDK
7177 export DART
@@ -85,6 +91,7 @@ if [[ -z $ENV_SET ]]; then
8591 echo ' ** ENV **'
8692 echo ' *********'
8793 echo DART_SDK=$DART_SDK
94+ echo DART_SDK_LIB_SEARCH_PATH=$DART_SDK_LIB_SEARCH_PATH
8895 echo DART=$DART
8996 echo PUB=$PUB
9097 echo DARTANALYZER=$DARTANALYZER
You can’t perform that action at this time.
0 commit comments