Index: sdk/bin/dart |
diff --git a/sdk/bin/dart b/sdk/bin/dart |
index 675963f746cab46906ff24938d59bf6f07a8023a..e4b2dfc10d7f2c9856818946b247cd9b04aad3de 100755 |
--- a/sdk/bin/dart |
+++ b/sdk/bin/dart |
@@ -18,16 +18,50 @@ PROG_NAME="$(follow_links "$BASH_SOURCE")" |
# Handle the case where dart-sdk/bin has been symlinked to. |
CUR_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" |
-if [ -z "$DART_CONFIGURATION" ]; |
+if [[ `uname` == 'Darwin' ]]; |
then |
- DART_CONFIGURATION="ReleaseIA32" |
+ OUT_DIR="$CUR_DIR"/../../xcodebuild/ |
+else |
+ OUT_DIR="$CUR_DIR"/../../out/ |
fi |
-if [[ `uname` == 'Darwin' ]]; |
+if [ -z "$DART_CONFIGURATION" ]; |
then |
- BIN_DIR="$CUR_DIR"/../../xcodebuild/$DART_CONFIGURATION |
-else |
- BIN_DIR="$CUR_DIR"/../../out/$DART_CONFIGURATION |
+ DIRS=$( ls "$OUT_DIR" ) |
+ 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.
|
+ if [ "$COUNT" -eq "0" ]; |
+ then |
+ echo "There are no available dart configurations in $OUT_DIR" |
+ exit 1 |
+ else |
+ # list of possible configurations in decreasing desirability |
+ CONFIGS=("ReleaseIA32" "ReleaseX64" |
+ "ReleaseARM" "ReleaseARM64" "ReleaseARMV5TE" "ReleaseMIPS" |
+ "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.
|
+ "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.
|
+ "DebugARM" "DebugARM64" "DebugARMV5TE" "DebugMIPS" |
+ "DebugSIMARM" "DebugSIMARM64" "DebugSIMARMV5TE" "DebugSIMMIPS") |
+ DART_CONFIGURATION="None" |
+ for CONFIG in ${CONFIGS[*]} |
+ do |
+ for DIR in $DIRS; |
+ do |
+ if [ "$CONFIG" = "$DIR" ]; |
+ then |
+ # choose most desirable configuration that is available and break |
+ DART_CONFIGURATION=$DIR |
floitsch
2015/08/12 11:26:08
"$DIR"
stanm
2015/08/12 12:30:18
Done.
|
+ break 2 |
+ fi |
+ done |
+ done |
+ if [ "$DART_CONFIGURATION" = "None" ] |
+ then |
+ echo "None of the folders in $OUT_DIR contain a valid dart configuration" |
+ exit 1 |
+ fi |
+ fi |
fi |
+BIN_DIR="$OUT_DIR$DART_CONFIGURATION" |
+ |
exec "$BIN_DIR"/dart "$@" |