Skip to content

Commit 3dfa172

Browse files
committed
chore(scripts): Some cleanup
1 parent fb9f2e4 commit 3dfa172

15 files changed

+101
-100
lines changed

DEVELOPER.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ To run base tests:
125125
dart --checked test/io/all.dart
126126

127127
# Run expression extractor tests:
128-
scripts/test-expression-extractor.sh
128+
./scripts/test-expression-extractor.sh
129129

130130
# Run the Dart Analyzer:
131131
./scripts/analyze.sh
@@ -146,7 +146,7 @@ tests proper by executing:
146146

147147
```shell
148148
. ./scripts/env.sh
149-
karma_run.sh
149+
./scripts/karma_run.sh
150150
```
151151

152152
**Note:**: If the dart analyzer fails with warnings, the tests will not run.

analyze.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

genDocs.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

generate.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

perf.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

run-test.sh

Lines changed: 0 additions & 49 deletions
This file was deleted.

scripts/analyze.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

33
set -e
44

@@ -27,6 +27,6 @@ do
2727
echo export \'../$FILE\' hide main, NestedRouteInitializer\; >> $OUT
2828
done
2929

30-
$(dirname $0)/generate-expressions.sh
30+
$NGDART_SCRIPT_DIR/generate-expressions.sh
3131

3232
$DARTANALYZER $OUT

scripts/env.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
set -e
33

44
if [ -n "$DART_SDK" ]; then
@@ -33,17 +33,24 @@ export DART_DOCGEN=${DART_DOCGEN:-"$DARTSDK/bin/docgen"}
3333

3434
export DARTIUM_BIN=${DARTIUM_BIN:-"$DARTIUM"}
3535
export CHROME_BIN=${CHROME_BIN:-"google-chrome"}
36+
3637
export PATH=$PATH:$DARTSDK/bin
3738

39+
export NGDART_SCRIPT_DIR=$(dirname $(readlink -f ${BASH_SOURCE[0]}))
40+
export NGDART_BASE_DIR=$(dirname $NGDART_SCRIPT_DIR)
41+
3842
echo '*********'
3943
echo '** ENV **'
4044
echo '*********'
4145
echo DART_SDK=$DART_SDK
4246
echo DART=$DART
47+
$DART --version
4348
echo PUB=$PUB
4449
echo DARTANALYZER=$DARTANALYZER
4550
echo DARTDOC=$DARTDOC
4651
echo DART_DOCGEN=$DART_DOCGEN
4752
echo DARTIUM_BIN=$DARTIUM_BIN
4853
echo CHROME_BIN=$CHROME_BIN
4954
echo PATH=$PATH
55+
echo NGDART_BASE_DIR=$NGDART_BASE_DIR
56+
echo NGDART_SCRIPT_DIR=$NGDART_SCRIPT_DIR

scripts/generate-expressions.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

33
. $(dirname $0)/env.sh
44

55
echo '=========================='
66
echo '== GENERATE EXPRESSIONS =='
77
echo '=========================='
88

9-
mkdir -p gen
9+
mkdir -p $NGDART_SCRIPT_DIR/gen
1010

11-
cat test/core/parser/generated_getter_setter.dart | sed -e 's/_template;/_generated;/' | grep -v REMOVE > gen/generated_getter_setter.dart
12-
$DART bin/parser_generator_for_spec.dart getter_setter >> gen/generated_getter_setter.dart
11+
cat $NGDART_BASE_DIR/test/core/parser/generated_getter_setter.dart | \
12+
sed -e 's/_template;/_generated;/' | \
13+
grep -v REMOVE > $NGDART_SCRIPT_DIR/gen/generated_getter_setter.dart
14+
15+
$DART $NGDART_BASE_DIR/bin/parser_generator_for_spec.dart getter_setter >> \
16+
$NGDART_SCRIPT_DIR/gen/generated_getter_setter.dart

scripts/karma/snapshot.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

33
rm -rf ../karma-snapshot
44
mkdir ../karma-snapshot
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

3-
# OS-specific Dartium path defaults
4-
case $( uname -s ) in
5-
Darwin)
6-
DARTIUM_BIN=${DARTIUM_BIN:-"/Applications/dart/chromium/Chromium.app/Contents/MacOS/Chromium"};;
7-
esac
3+
. $(dirname $0)/env.sh
84

95
# Check for node
106
if [ -z "$(which node)" ]; then
@@ -14,10 +10,11 @@ if [ -z "$(which node)" ]; then
1410
fi
1511

1612
# Check for karma
17-
KARMA_PATH="node_modules/karma/bin/karma"
13+
KARMA_PATH="$NGDART_BASE_DIR/node_modules/karma/bin/karma"
1814
if [ ! -e "$KARMA_PATH" ]; then
1915
echo "karma does not appear to be installed. Installing:"
16+
cd $NGDART_BASE_DIR
2017
npm install
2118
fi
2219

23-
dartanalyzer lib/angular.dart && node $KARMA_PATH run --port=8765
20+
$DARTANALYZER $NGDART_BASE_DIR/lib/angular.dart && node $KARMA_PATH run --port=8765

scripts/perf.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
. $(dirname $0)/env.sh
4+
5+
# Check for node
6+
if [ -z "$(which node)" ]; then
7+
echo "node.js does not appear to be on the path."
8+
echo "You can obtain it from http://nodejs.org"
9+
exit 1;
10+
fi
11+
12+
if dart2js $NGDART_BASE_DIR/perf/mirror_perf.dart -o $NGDART_BASE_DIR/perf/mirror_perf.dart.js > /dev/null ; then
13+
echo DART:
14+
$DART $NGDART_BASE_DIR/perf/mirror_perf.dart
15+
echo JavaScript:
16+
node $NGDART_BASE_DIR/perf/mirror_perf.dart.js
17+
fi

scripts/run-test.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
. $(dirname $0)/env.sh
6+
7+
# Check for node
8+
if [ -z "$(which node)" ]; then
9+
echo "node.js does not appear to be on the path."
10+
echo "You can obtain it from http://nodejs.org"
11+
exit 1;
12+
fi
13+
14+
# Run npm install so we are up-to-date
15+
cd $NGDART_BASE_DIR
16+
npm install
17+
18+
# Print the dart VM version to the logs
19+
dart --version
20+
21+
# run io tests
22+
dart --checked $NGDART_BASE_DIR/test/io/all.dart
23+
24+
# run transformer tests
25+
dart --checked $NGDART_BASE_DIR/test/tools/transformer/all.dart
26+
27+
# run expression extractor tests
28+
dart --checked $NGDART_BASE_DIR/test/tools/symbol_inspector/symbol_inspector_spec.dart
29+
30+
$NGDART_SCRIPT_DIR/analyze.sh &&
31+
$NGDART_BASE_DIR/node_modules/jasmine-node/bin/jasmine-node playback_middleware/spec/ &&
32+
node "node_modules/karma/bin/karma" start karma.conf \
33+
--reporters=junit,dots --port=8765 --runner-port=8766 \
34+
--browsers=Dartium,Chrome,Firefox --single-run --no-colors
35+

scripts/test-expression-extractor.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22

33
set -e
44

5-
(cd example; pub get)
5+
. $(dirname $0)/env.sh
6+
7+
(cd $NGDART_BASE_DIR/example; pub get)
68

79
rm -rf xxx.dart
810

911
OUT=$(mktemp XXX.dart)
1012

11-
dart --package-root=example/packages bin/expression_extractor.dart example/web/todo.dart example /dev/null /dev/null $OUT
13+
$DART --package-root=example/packages bin/expression_extractor.dart \
14+
example/web/todo.dart example /dev/null /dev/null $OUT
1215

1316
if [[ -e $OUT ]]; then
1417
echo "Expression extractor created an output file"

scripts/travis/build.sh

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
set -e
4-
. ./scripts/env.sh
4+
. "$(dirname $0)/../env.sh"
55

66
echo '==========='
77
echo '== BUILD =='
@@ -24,14 +24,15 @@ function checkSize() {
2424
fi
2525
}
2626

27-
# skip auxiliary tests if we are only running dart2js
2827
if [[ $TESTS == "dart2js" ]]; then
28+
# skip auxiliary tests if we are only running dart2js
2929
echo '------------------------'
3030
echo '-- BUILDING: examples --'
3131
echo '------------------------'
3232

3333
if [[ $CHANNEL == "DEV" ]]; then
34-
dart "bin/pub_build.dart" -p example -e "example/expected_warnings.json"
34+
$DART "$NGDART_BASE_DIR/bin/pub_build.dart" -p example \
35+
-e "$NGDART_BASE_DIR/example/expected_warnings.json"
3536
else
3637
( cd example; pub build )
3738
fi
@@ -40,7 +41,7 @@ if [[ $TESTS == "dart2js" ]]; then
4041
echo '-----------------------------------'
4142
echo '-- BUILDING: verify dart2js size --'
4243
echo '-----------------------------------'
43-
cd example
44+
cd $NGDART_BASE_DIR/example
4445
checkSize build/web/animation.dart.js 208021
4546
checkSize build/web/bouncing_balls.dart.js 202325
4647
checkSize build/web/hello_world.dart.js 199919
@@ -55,33 +56,34 @@ else
5556
echo '--------------'
5657
echo '-- TEST: io --'
5758
echo '--------------'
58-
dart --checked test/io/all.dart
59+
$DART --checked $NGDART_BASE_DIR/test/io/all.dart
5960

6061
echo '----------------------------'
6162
echo '-- TEST: symbol extractor --'
6263
echo '----------------------------'
63-
dart --checked test/tools/symbol_inspector/symbol_inspector_spec.dart
64+
$DART --checked $NGDART_BASE_DIR/test/tools/symbol_inspector/symbol_inspector_spec.dart
6465

65-
./scripts/generate-expressions.sh
66-
./scripts/analyze.sh
66+
$NGDART_SCRIPT_DIR/generate-expressions.sh
67+
$NGDART_SCRIPT_DIR/analyze.sh
6768

6869
echo '-----------------------'
6970
echo '-- TEST: transformer --'
7071
echo '-----------------------'
71-
dart --checked test/tools/transformer/all.dart
72-
72+
$DART --checked $NGDART_BASE_DIR/test/tools/transformer/all.dart
7373

7474
echo '---------------------'
7575
echo '-- TEST: changelog --'
7676
echo '---------------------'
77-
./node_modules/jasmine-node/bin/jasmine-node ./scripts/changelog/;
77+
$NGDART_BASE_DIR/node_modules/jasmine-node/bin/jasmine-node \
78+
$NGDART_SCRIPT_DIR/changelog/;
7879

7980
(
8081
echo '----------------'
8182
echo '-- TEST: perf --'
8283
echo '----------------'
83-
cd perf
84-
pub install
84+
cd $NGDART_BASE_DIR/perf
85+
$PUB install
86+
8587
for file in *_perf.dart; do
8688
echo ======= $file ========
8789
$DART $file
@@ -100,11 +102,11 @@ echo '-----------------------'
100102
echo '-- TEST: AngularDart --'
101103
echo '-----------------------'
102104
echo BROWSER=$BROWSERS
103-
./node_modules/jasmine-node/bin/jasmine-node playback_middleware/spec/ &&
104-
node "node_modules/karma/bin/karma" start karma.conf \
105+
$NGDART_BASE_DIR/node_modules/jasmine-node/bin/jasmine-node playback_middleware/spec/ &&
106+
node "node_modules/karma/bin/karma" start karma.conf \
105107
--reporters=junit,dots --port=8765 --runner-port=8766 \
106108
--browsers=$BROWSERS --single-run --no-colors
107109

108110
if [[ $TESTS != "dart2js" ]]; then
109-
./scripts/generate-documentation.sh;
111+
$NGDART_SCRIPT_DIR/generate-documentation.sh;
110112
fi

0 commit comments

Comments
 (0)