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

Commit 465cfd5

Browse files
committed
chore(travis): download the dart zips in parallel
1 parent 83f0f94 commit 465cfd5

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

scripts/travis/install.sh

+22-19
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,37 @@ if [[ "$USE_G3" == "YES" && "$AVAILABLE_DART_VERSION" == "1.5.8" ]]; then
4444
exit 0
4545
fi
4646

47-
DARTIUM_ZIP=http://storage.googleapis.com/dart-archive/channels/$CHANNEL/release/latest/dartium/dartium-linux-x64-release.zip
48-
49-
shopt -s nocasematch
50-
51-
if [[ $BROWSERS =~ "dartium" ]]; then
52-
echo "Installing Dartium from $DARTIUM_ZIP"
53-
curl -L $DARTIUM_ZIP > dartium.zip
54-
unzip dartium.zip > /dev/null
55-
rm -rf dartium
56-
rm dartium.zip
57-
mv dartium-* chromium
58-
fi
5947

6048
echo Fetch Dart channel: $CHANNEL
6149

62-
DART_SDK_ZIP=dartsdk-linux-x64-release.zip
63-
6450
# TODO(chirayu): Remove this once issue 1350 is fixed.
6551
SVN_REVISION=latest
6652
if [[ "$AVAILABLE_DART_VERSION" == "1.6.0-dev.8.0" ]]; then
6753
SVN_REVISION=38831 # Use prior working version (1.6.0-dev.7.0)
6854
fi
6955

70-
URL=https://storage.googleapis.com/dart-archive/channels/$CHANNEL/release/$SVN_REVISION/sdk/$DART_SDK_ZIP
71-
echo $URL
72-
curl -L -O $URL
56+
URL_PREFIX=https://storage.googleapis.com/dart-archive/channels/$CHANNEL/release/$SVN_REVISION
57+
DART_SDK_URL=$URL_PREFIX/sdk/dartsdk-linux-x64-release.zip
58+
if [[ "${BROWSERS,,}" =~ "dartium" ]]; then
59+
DARTIUM_URL=$URL_PREFIX/dartium/dartium-linux-x64-release.zip
60+
fi
61+
62+
parallel_get() {(
63+
_download_and_unzip() {
64+
ZIPFILE=${1/*\//}
65+
curl -O -L $1 && unzip -q $ZIPFILE && rm $ZIPFILE
66+
}
67+
export -f _download_and_unzip
68+
69+
echo "$@" | xargs -d ' ' -n 1 -P 2 -I URL bash -c '_download_and_unzip URL'
70+
)}
71+
72+
parallel_get $DART_SDK_URL $DARTIUM_URL
7373

74-
echo Fetched new dart version $(unzip -p $DART_SDK_ZIP dart-sdk/version)
75-
unzip -q $DART_SDK_ZIP
74+
echo Fetched new dart version $(<dart-sdk/version)
75+
76+
if [[ -n $DARTIUM_URL ]]; then
77+
mv dartium-* chromium
78+
fi
7679

7780
sh -e /etc/init.d/xvfb start

0 commit comments

Comments
 (0)