@@ -7,8 +7,9 @@ echo ===========================================================================
77
88# go to project dir
99SCRIPT_DIR=$( dirname $0 )
10+ REPO_ROOT_DIR=` cd ${SCRIPT_DIR} /../..; pwd`
1011source $SCRIPT_DIR /env_dart.sh
11- cd $SCRIPT_DIR /../..
12+ cd $REPO_ROOT_DIR
1213
1314# Variables
1415DDC_TOTAL_WARNING_CAP=" 210"
@@ -29,11 +30,23 @@ git clone https://github.com/dart-lang/dev_compiler.git tmp/dev_compiler
2930./node_modules/.bin/gulp build/pubspec.dart
3031node ./scripts/ci/dart_ddc/pubspec_for_ddc.js \
3132 --pubspec-file=dist/dart/playground/pubspec.yaml
32-
33- # Compile playground
3433cd dist/dart/playground
3534$PUB build --mode=debug
3635cd build/web
36+
37+ # TODO: temporarily remove references to dart.js as ddc doesn't do it
38+ # automatically yet (https://github.com/dart-lang/dev_compiler/issues/437)
39+ echo ` pwd`
40+ for htmlFile in ` find ./src -name ' *.html' ` ; do
41+ tmpFile=$REPO_ROOT_DIR /tmp/scriptless_html.tmp
42+ cat $htmlFile | grep -vE ' <script.*dart\.js' > $tmpFile
43+ mv $tmpFile $htmlFile
44+ done
45+
46+ # #############################################################################
47+ # Analyze code
48+ # #############################################################################
49+
3750LOG_FILE=" analyzer.log"
3851set +e
3952$DART_SDK /bin/dart $DDC_DIR /bin/dartdevc.dart \
91104 echo " Warning count ok"
92105fi
93106
107+
108+ # #############################################################################
109+ # Run e2e tests
110+ # #############################################################################
111+
112+ DIST_DIR=" ${REPO_ROOT_DIR} /dist/js/ddc"
113+
114+ # Build the apps (again)
115+ # TODO: ddc does not yet support compiling multiple html files. Ideally we
116+ # could build everything during analysis above.
117+ # See: https://github.com/dart-lang/dev_compiler/issues/430
118+
119+ ln -s ` pwd` /packages src/hello_world/packages
120+
121+ set +e
122+ OUT_DIR=" ${DIST_DIR} /playground/src/hello_world"
123+ mkdir -p $OUT_DIR
124+ $DART_SDK /bin/dart $DDC_DIR /bin/dartdevc.dart \
125+ --force-compile \
126+ --dart-sdk=$DART_SDK_LIB_SEARCH_PATH -o $OUT_DIR \
127+ src/hello_world/index.html
128+ EXIT_CODE=` echo $? `
129+ set -e
130+
131+ if [[ " $EXIT_CODE " -ne " 0" && " $EXIT_CODE " -ne " 1" ]]
132+ then
133+ echo " DDC compiler crashed with exit code $EXIT_CODE "
134+ exit 1
135+ fi
136+
137+
138+ # Run e2e tests
139+ cd $REPO_ROOT_DIR
140+
141+ ./node_modules/.bin/webdriver-manager update
142+
143+ function killServer () {
144+ kill $serverPid
145+ }
146+
147+ ./node_modules/.bin/gulp serve.js.ddc&
148+ serverPid=$!
149+
150+ trap killServer EXIT
151+
152+ # wait for server to come up
153+ sleep 10
154+
155+ function runSpec {
156+ SPEC=$1
157+ ./node_modules/.bin/protractor protractor-ddc.conf.js \
158+ --browsers=${E2E_BROWSERS:- Dartium} \
159+ --spec=$SPEC
160+ }
161+
162+ # TODO: add more e2e tests
163+ runSpec hello_world/hello_world_spec.js
164+
94165echo ' Dart DDC build finished'
95166exit $EXIT_CODE
0 commit comments