Skip to content

Commit 0ca8df4

Browse files
committed
Merge pull request #453 from dart-lang/chrome-canary-on-mac
Make tool/get_chrome_canary.sh work on Mac
2 parents 3f85417 + 037f9bf commit 0ca8df4

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

pkg/dev_compiler/tool/get_chrome_canary.sh

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,32 @@
1010

1111
set -eu
1212

13-
readonly CHROME_URL=https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64
14-
readonly CHROME_REV=$(curl -s ${CHROME_URL}/LAST_CHANGE)
13+
readonly CHROME_SNAPSHOTS=https://storage.googleapis.com/chromium-browser-snapshots
14+
declare CHROME_URL
15+
declare CHROME_NAME
16+
declare CHROME_RELATIVE_BIN
17+
18+
if [[ "$OSTYPE" == "linux"* ]]; then
19+
CHROME_URL=$CHROME_SNAPSHOTS/Linux_x64
20+
CHROME_NAME=chrome-linux
21+
CHROME_RELATIVE_BIN=chrome
22+
elif [[ "$OSTYPE" == "darwin"* ]]; then
23+
CHROME_URL=$CHROME_SNAPSHOTS/Mac
24+
CHROME_NAME=chrome-mac
25+
CHROME_RELATIVE_BIN=Chromium.app/Contents/MacOS/Chromium
26+
elif [[ "$OSTYPE" == "cygwin" ]]; then
27+
CHROME_URL=$CHROME_SNAPSHOTS/Win
28+
CHROME_NAME=chrome-win32
29+
CHROME_RELATIVE_BIN=chrome.exe
30+
else
31+
echo "Unknown platform: $OSTYPE" >&2
32+
exit 1
33+
fi
1534

1635
readonly CHROME_CANARY_DIR=$HOME/.chrome/canary
17-
readonly CHROME_CANARY_BIN=$CHROME_CANARY_DIR/chrome-linux/chrome
36+
readonly CHROME_CANARY_BIN=$CHROME_CANARY_DIR/$CHROME_NAME/$CHROME_RELATIVE_BIN
1837
readonly CHROME_CANARY_REV_FILE=$CHROME_CANARY_DIR/VERSION
38+
readonly CHROME_REV=$(curl -s ${CHROME_URL}/LAST_CHANGE)
1939

2040
function getCanary() {
2141
local existing_version=""
@@ -29,7 +49,7 @@ function getCanary() {
2949
rm -fR $CHROME_CANARY_DIR
3050
mkdir -p $CHROME_CANARY_DIR
3151

32-
local file=chrome-linux.zip
52+
local file=$CHROME_NAME.zip
3353
curl ${CHROME_URL}/${CHROME_REV}/$file -o $file
3454
unzip $file -d $CHROME_CANARY_DIR
3555
rm $file
@@ -39,4 +59,4 @@ function getCanary() {
3959

4060
getCanary >&2
4161

42-
echo $CHROME_CANARY_BIN
62+
echo $CHROME_CANARY_BIN

0 commit comments

Comments
 (0)