Index: sdk/bin/pub |
diff --git a/sdk/bin/pub b/sdk/bin/pub |
index 50f0d1d391ad28dbc9b6ec39b788d6a7e53351b5..a8514ea1294f30d38a1024932aacf63d568f0876 100755 |
--- a/sdk/bin/pub |
+++ b/sdk/bin/pub |
@@ -29,6 +29,13 @@ SNAPSHOT="$BIN_DIR/snapshots/pub.dart.snapshot" |
unset VM_OPTIONS |
declare -a VM_OPTIONS |
+if [[ `uname` == 'Darwin' ]]; |
+then |
+ OUT_DIR="$BIN_DIR"/../../xcodebuild/ |
+else |
+ OUT_DIR="$BIN_DIR"/../../out/ |
+fi |
+ |
# Allow extra VM options to be passed in through an environment variable. |
if [[ $DART_VM_OPTIONS ]]; then |
read -a OPTIONS <<< "$DART_VM_OPTIONS" |
@@ -37,7 +44,29 @@ fi |
if [ -z "$DART_CONFIGURATION" ]; |
then |
- DART_CONFIGURATION="ReleaseX64" |
+ DIRS=$( ls "$OUT_DIR" ) |
+ # list of possible configurations in decreasing desirability |
+ CONFIGS=("ReleaseX64" "ReleaseIA32" "DebugX64" "DebugIA32" |
+ "ReleaseARM" "ReleaseARM64" "ReleaseARMV5TE" "ReleaseMIPS" |
+ "DebugARM" "DebugARM64" "DebugARMV5TE" "DebugMIPS") |
+ 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" |
+ break 2 |
+ fi |
+ done |
+ done |
+ if [ "$DART_CONFIGURATION" = "None" ] |
+ then |
+ echo "No valid dart configuration found in $OUT_DIR" |
+ exit 1 |
+ fi |
fi |
if [[ `uname` == 'Darwin' ]]; |