OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2013, 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 # Run dartanalyzer.dart on the Dart VM. This script assumes the Dart repo's | 6 # Run dartanalyzer.dart on the Dart VM. This script assumes the Dart repo's |
7 # directory structure. | 7 # directory structure. |
8 | 8 |
9 function follow_links() { | 9 function follow_links() { |
10 file="$1" | 10 file="$1" |
(...skipping 27 matching lines...) Expand all Loading... |
38 # We allow extra vm options to be passed in through an environment variable. | 38 # We allow extra vm options to be passed in through an environment variable. |
39 if [[ $DART_VM_OPTIONS ]]; then | 39 if [[ $DART_VM_OPTIONS ]]; then |
40 read -a OPTIONS <<< "$DART_VM_OPTIONS" | 40 read -a OPTIONS <<< "$DART_VM_OPTIONS" |
41 EXTRA_VM_OPTIONS+=("${OPTIONS[@]}") | 41 EXTRA_VM_OPTIONS+=("${OPTIONS[@]}") |
42 fi | 42 fi |
43 | 43 |
44 DART_ROOT="$(cd "${SDK_DIR}/.." ; pwd -P)" | 44 DART_ROOT="$(cd "${SDK_DIR}/.." ; pwd -P)" |
45 | 45 |
46 ANALYZER="$DART_ROOT/third_party/pkg/analyzer_cli/bin/analyzer.dart" | 46 ANALYZER="$DART_ROOT/third_party/pkg/analyzer_cli/bin/analyzer.dart" |
47 | 47 |
| 48 if [[ `uname` == 'Darwin' ]]; |
| 49 then |
| 50 OUT_DIR="$DART_ROOT/xcodebuild/" |
| 51 else |
| 52 OUT_DIR="$DART_ROOT/out/" |
| 53 fi |
| 54 |
48 if [ -z "$DART_CONFIGURATION" ]; | 55 if [ -z "$DART_CONFIGURATION" ]; |
49 then | 56 then |
50 DART_CONFIGURATION="ReleaseIA32" | 57 DIRS=$( ls "$OUT_DIR" ) |
| 58 # list of possible configurations in decreasing desirability |
| 59 CONFIGS=("ReleaseIA32" "ReleaseX64" "DebugIA32" "DebugX64" |
| 60 "ReleaseARM" "ReleaseARM64" "ReleaseARMV5TE" "ReleaseMIPS" |
| 61 "DebugARM" "DebugARM64" "DebugARMV5TE" "DebugMIPS") |
| 62 DART_CONFIGURATION="None" |
| 63 for CONFIG in ${CONFIGS[*]} |
| 64 do |
| 65 for DIR in $DIRS; |
| 66 do |
| 67 if [ "$CONFIG" = "$DIR" ]; |
| 68 then |
| 69 # choose most desirable configuration that is available and break |
| 70 DART_CONFIGURATION="$DIR" |
| 71 break 2 |
| 72 fi |
| 73 done |
| 74 done |
| 75 if [ "$DART_CONFIGURATION" = "None" ] |
| 76 then |
| 77 echo "No valid dart configuration found in $OUT_DIR" |
| 78 exit 1 |
| 79 fi |
51 fi | 80 fi |
52 | 81 |
53 if [[ `uname` == 'Darwin' ]]; then | 82 BUILD_DIR="$OUT_DIR$DART_CONFIGURATION" |
54 BUILD_DIR="$DART_ROOT/xcodebuild/$DART_CONFIGURATION" | |
55 else | |
56 BUILD_DIR="$DART_ROOT/out/$DART_CONFIGURATION" | |
57 fi | |
58 | 83 |
59 PACKAGE_ROOT="$BUILD_DIR/packages/" | 84 PACKAGE_ROOT="$BUILD_DIR/packages/" |
60 | 85 |
61 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "--package-root=$PACKAGE_ROOT" "$ANALYZER"
"$SDK_ARG" "$@" | 86 exec "$DART" "${EXTRA_VM_OPTIONS[@]}" "--package-root=$PACKAGE_ROOT" "$ANALYZER"
"$SDK_ARG" "$@" |
OLD | NEW |