Index: sdk/bin/dart2js |
diff --git a/sdk/bin/dart2js b/sdk/bin/dart2js |
index 988a6febfc556c158c07f5e48c29bc4df59c6102..248ab07de30f9cee3fab6f2207ae651d5c778955 100755 |
--- a/sdk/bin/dart2js |
+++ b/sdk/bin/dart2js |
@@ -52,16 +52,40 @@ DART_ROOT="$(cd "${SDK_DIR}/.." ; pwd -P)" |
DART2JS="$DART_ROOT/pkg/compiler/lib/src/dart2js.dart" |
+if [[ `uname` == 'Darwin' ]]; then |
+ OUT_DIR="$DART_ROOT/xcodebuild/" |
+else |
+ OUT_DIR="$DART_ROOT/out/" |
+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' ]]; then |
- BUILD_DIR="$DART_ROOT/xcodebuild/$DART_CONFIGURATION" |
-else |
- BUILD_DIR="$DART_ROOT/out/$DART_CONFIGURATION" |
-fi |
+BUILD_DIR="$OUT_DIR$DART_CONFIGURATION" |
PACKAGE_ROOT="$BUILD_DIR/packages/" |