OLD | NEW |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 function follow_links() { | 6 function follow_links() { |
7 file="$1" | 7 file="$1" |
8 while [ -h "$file" ]; do | 8 while [ -h "$file" ]; do |
9 # On Mac OS, readlink -f doesn't work. | 9 # On Mac OS, readlink -f doesn't work. |
10 file="$(readlink "$file")" | 10 file="$(readlink "$file")" |
11 done | 11 done |
12 echo "$file" | 12 echo "$file" |
13 } | 13 } |
14 | 14 |
15 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. | 15 # Unlike $0, $BASH_SOURCE points to the absolute path of this file. |
16 PROG_NAME="$(follow_links "$BASH_SOURCE")" | 16 PROG_NAME="$(follow_links "$BASH_SOURCE")" |
17 | 17 |
18 # Handle the case where dart-sdk/bin has been symlinked to. | 18 # Handle the case where dart-sdk/bin has been symlinked to. |
19 CUR_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" | 19 CUR_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" |
20 | 20 |
21 if [[ `uname` == 'Darwin' ]]; | |
22 then | |
23 OUT_DIR="$CUR_DIR"/../../xcodebuild/ | |
24 else | |
25 OUT_DIR="$CUR_DIR"/../../out/ | |
26 fi | |
27 | |
21 if [ -z "$DART_CONFIGURATION" ]; | 28 if [ -z "$DART_CONFIGURATION" ]; |
22 then | 29 then |
23 DART_CONFIGURATION="ReleaseIA32" | 30 DIRS=$( ls "$OUT_DIR" ) |
31 COUNT=$( echo $DIRS | wc -w ) | |
floitsch
2015/08/12 11:26:08
You can drop the COUNT part. It will just run thro
stanm
2015/08/12 12:30:18
Done.
| |
32 if [ "$COUNT" -eq "0" ]; | |
33 then | |
34 echo "There are no available dart configurations in $OUT_DIR" | |
35 exit 1 | |
36 else | |
37 # list of possible configurations in decreasing desirability | |
38 CONFIGS=("ReleaseIA32" "ReleaseX64" | |
39 "ReleaseARM" "ReleaseARM64" "ReleaseARMV5TE" "ReleaseMIPS" | |
40 "ReleaseSIMARM" "ReleaseSIMARM64" "ReleaseSIMARMV5TE" "ReleaseSIMMIPS" | |
floitsch
2015/08/12 11:26:08
Remove the simarm and simmips (simulated)
stanm
2015/08/12 12:30:18
Done.
| |
41 "DebugIA32" "DebugX64" | |
floitsch
2015/08/12 11:26:08
Put DebugIA32 and DebugX64 before the ARM ones.
stanm
2015/08/12 12:30:18
Done.
| |
42 "DebugARM" "DebugARM64" "DebugARMV5TE" "DebugMIPS" | |
43 "DebugSIMARM" "DebugSIMARM64" "DebugSIMARMV5TE" "DebugSIMMIPS") | |
44 DART_CONFIGURATION="None" | |
45 for CONFIG in ${CONFIGS[*]} | |
46 do | |
47 for DIR in $DIRS; | |
48 do | |
49 if [ "$CONFIG" = "$DIR" ]; | |
50 then | |
51 # choose most desirable configuration that is available and break | |
52 DART_CONFIGURATION=$DIR | |
floitsch
2015/08/12 11:26:08
"$DIR"
stanm
2015/08/12 12:30:18
Done.
| |
53 break 2 | |
54 fi | |
55 done | |
56 done | |
57 if [ "$DART_CONFIGURATION" = "None" ] | |
58 then | |
59 echo "None of the folders in $OUT_DIR contain a valid dart configuration" | |
60 exit 1 | |
61 fi | |
62 fi | |
24 fi | 63 fi |
25 | 64 |
26 if [[ `uname` == 'Darwin' ]]; | 65 BIN_DIR="$OUT_DIR$DART_CONFIGURATION" |
27 then | |
28 BIN_DIR="$CUR_DIR"/../../xcodebuild/$DART_CONFIGURATION | |
29 else | |
30 BIN_DIR="$CUR_DIR"/../../out/$DART_CONFIGURATION | |
31 fi | |
32 | 66 |
33 exec "$BIN_DIR"/dart "$@" | 67 exec "$BIN_DIR"/dart "$@" |
OLD | NEW |