Index: sdk/bin/dartfmt |
diff --git a/sdk/bin/dartfmt b/sdk/bin/dartfmt |
index 0c69a750be56c00a3455a6677a77c04d09095c1c..436297707f04db7110869849bd72c01b682dafbc 100755 |
--- a/sdk/bin/dartfmt |
+++ b/sdk/bin/dartfmt |
@@ -3,8 +3,8 @@ |
# for details. All rights reserved. Use of this source code is governed by a |
# BSD-style license that can be found in the LICENSE file. |
-# Run dartfmt.dart on the Dart VM. This script assumes the Dart SDK's directory |
-# structure. |
+# Run dart_style/bin/format.dart on the Dart VM. This script assumes the Dart |
+# repo's directory structure. |
function follow_links() { |
file="$1" |
@@ -20,34 +20,25 @@ PROG_NAME="$(follow_links "$BASH_SOURCE")" |
# Handle the case where dart-sdk/bin has been symlinked to. |
BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)" |
- |
SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" |
-SNAPSHOT="$BIN_DIR/snapshots/dartfmt.dart.snapshot" |
+DART="$BIN_DIR/dart" |
+ |
+DART_ROOT="$(cd "${SDK_DIR}/.." ; pwd -P)" |
+ |
+DARTFMT="$DART_ROOT/third_party/pkg/dart_style/bin/format.dart" |
-if test -f "$SNAPSHOT"; then |
- # We are running the snapshot in the built SDK. |
- DART="$BIN_DIR/dart" |
- exec "$DART" "$SNAPSHOT" "$@" |
+if [ -z "$DART_CONFIGURATION" ]; |
+then |
+ DART_CONFIGURATION="ReleaseIA32" |
+fi |
+ |
+if [[ `uname` == 'Darwin' ]]; then |
+ BUILD_DIR="$DART_ROOT/xcodebuild/$DART_CONFIGURATION" |
else |
- # We are running dartfmt from source in the development repo. |
- if [ -z "$DART_CONFIGURATION" ]; |
- then |
- DART_CONFIGURATION="ReleaseIA32" |
- fi |
- |
- # TODO(pquitslund): this bit seems wrong, but was cribbed verbatim from pub |
- # Need to revisit and fix |
- if [[ `uname` == 'Darwin' ]]; |
- then |
- BUILD_DIR="$SDK_DIR/../xcodebuild/$DART_CONFIGURATION" |
- else |
- BUILD_DIR="$SDK_DIR/../out/$DART_CONFIGURATION" |
- fi |
- |
- DART="$BUILD_DIR/dart-sdk/bin/dart" |
- PKG_DIR="$BUILD_DIR/packages" |
- DARTFMT="$SDK_DIR/../pkg/analyzer/bin/formatter.dart" |
- |
- exec "$DART" "--package-root=$PKG_DIR" "$DARTFMT" "$@" |
-fi |
+ BUILD_DIR="$DART_ROOT/out/$DART_CONFIGURATION" |
+fi |
+ |
+PACKAGE_ROOT="$BUILD_DIR/packages/" |
+ |
+exec "$DART" "--package-root=$PACKAGE_ROOT" "$DARTFMT" "$@" |