Chromium Code Reviews| 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 [ -z "$DART_CONFIGURATION" ]; | 21 if [ -z "$DART_CONFIGURATION" ]; |
| 22 then | 22 then |
| 23 DART_CONFIGURATION="ReleaseIA32" | 23 CONFIGS=$( ls "$CUR_DIR"/../../out/ ) |
|
floitsch
2015/08/10 11:48:40
This only works for Linux.
Create a OUT_DIR varia
stanm
2015/08/10 14:51:40
Acknowledged.
| |
| 24 COUNT=$( echo $CONFIGS | wc -w ) | |
| 25 if [ "$COUNT" -eq "0" ]; | |
| 26 then | |
| 27 # keep original behaviour in the case of an empty "out" folder | |
| 28 DART_CONFIGURATION="ReleaseIA32" | |
| 29 else | |
| 30 # if there is a "ReleaseIA32" folder - use it, otherwise - use the last one | |
| 31 # lexicographically | |
|
floitsch
2015/08/10 11:48:40
I think it would be nicer to have a list of prefer
stanm
2015/08/10 14:51:40
I thought of doing that initially, but I couldn't
floitsch
2015/08/10 14:56:09
I wouldn't look too far.
I32 und I64 Release and D
floitsch
2015/08/10 14:56:49
You could furthermore include ARM (don't know what
| |
| 32 for CONFIG in $CONFIGS; | |
| 33 do | |
| 34 DART_CONFIGURATION="$CONFIG" | |
| 35 if [ "$CONFIG" = "ReleaseIA32" ]; | |
| 36 then | |
| 37 break | |
| 38 fi | |
| 39 done | |
| 40 fi | |
| 24 fi | 41 fi |
| 25 | 42 |
| 26 if [[ `uname` == 'Darwin' ]]; | 43 if [[ `uname` == 'Darwin' ]]; |
| 27 then | 44 then |
| 28 BIN_DIR="$CUR_DIR"/../../xcodebuild/$DART_CONFIGURATION | 45 BIN_DIR="$CUR_DIR"/../../xcodebuild/$DART_CONFIGURATION |
| 29 else | 46 else |
| 30 BIN_DIR="$CUR_DIR"/../../out/$DART_CONFIGURATION | 47 BIN_DIR="$CUR_DIR"/../../out/$DART_CONFIGURATION |
| 31 fi | 48 fi |
| 32 | 49 |
| 33 exec "$BIN_DIR"/dart "$@" | 50 exec "$BIN_DIR"/dart "$@" |
| OLD | NEW |