Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit e90fa60

Browse files
jbdeboervsavkin
authored andcommitted
feat(travis): Also check for dart2js sizes that are unexpectedly small
Closes #1427
1 parent a199df8 commit e90fa60

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

scripts/travis/build.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,26 @@ echo '==========='
77
echo '== BUILD =='
88
echo '==========='
99

10-
SIZE_TOO_BIG_COUNT=0
10+
SIZE_UNEXPECTED_COUNT=0
1111

1212
export SAUCE_ACCESS_KEY=`echo $SAUCE_ACCESS_KEY | rev`
1313

1414
function checkSize() {
1515
file=$1
1616
if [[ ! -e $file ]]; then
1717
echo Could not find file: $file
18-
SIZE_TOO_BIG_COUNT=$((SIZE_TOO_BIG_COUNT + 1));
18+
SIZE_UNEXPECTED_COUNT=$((SIZE_UNEXPECTED_COUNT + 1));
1919
else
2020
expected=$2
2121
actual=`cat $file | gzip | wc -c`
2222
if (( 100 * $actual >= 105 * $expected )); then
2323
echo ${file} is too large expecting ${expected} was ${actual}.
24-
SIZE_TOO_BIG_COUNT=$((SIZE_TOO_BIG_COUNT + 1));
24+
SIZE_UNEXPECTED_COUNT=$((SIZE_UNEXPECTED_COUNT + 1));
25+
fi
26+
if (( 100 * $actual <= 95 * $expected )); then
27+
echo ${file} is too small expecting ${expected} was ${actual}.
28+
echo Please update scripts/travis/build.sh with the correct value.
29+
SIZE_UNEXPECTED_COUNT=$((SIZE_UNEXPECTED_COUNT + 1));
2530
fi
2631
fi
2732
}
@@ -35,7 +40,7 @@ function checkAllSizes() {(
3540
checkSize build/web/bouncing_balls.dart.js 223927
3641
checkSize build/web/hello_world.dart.js 221838
3742
checkSize build/web/todo.dart.js 224414
38-
if ((SIZE_TOO_BIG_COUNT > 0)); then
43+
if ((SIZE_UNEXPECTED_COUNT > 0)); then
3944
exit 1
4045
else
4146
echo Generated JavaScript file size check OK.

0 commit comments

Comments
 (0)