Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(390)

Side by Side Diff: sdk/bin/pub_developer

Issue 68503004: Support symlinking to dart-sdk executables on Linux and Mac. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: remove trailing whitespace Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/bin/pub ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 # Run pub.dart on the Dart VM. This script assumes the Dart SDK's directory 6 # Run pub.dart on the Dart VM. This script assumes the Dart SDK's directory
7 # structure. 7 # structure.
8 8
9 # Setting BIN_DIR this way is ugly, but is needed to handle the case where 9 function follow_links() {
10 # dart-sdk/bin has been symlinked to. On MacOS, readlink doesn't work 10 file="$1"
11 # with this case. 11 while [ -h "$file" ]; do
12 BIN_DIR="$(cd "${0%/*}" ; pwd -P)" 12 # On Mac OS, readlink -f doesn't work.
13 file="$(readlink "$file")"
14 done
15 echo "$file"
16 }
17
18 # Unlike $0, $BASH_SOURCE points to the absolute path of this file.
19 PROG_NAME="$(follow_links "$BASH_SOURCE")"
20
21 # Handle the case where dart-sdk/bin has been symlinked to.
22 BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
23
13 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)" 24 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)"
14 25
15 SNAPSHOT="$BIN_DIR/snapshots/pub.dart.snapshot" 26 SNAPSHOT="$BIN_DIR/snapshots/pub.dart.snapshot"
16 27
17 if test -f "$SNAPSHOT"; then 28 if test -f "$SNAPSHOT"; then
18 # We are running the snapshot in the built SDK. 29 # We are running the snapshot in the built SDK.
19 DART="$BIN_DIR/dart" 30 DART="$BIN_DIR/dart"
20 exec "$DART" --checked "$SNAPSHOT" "$@" 31 exec "$DART" --checked "$SNAPSHOT" "$@"
21 else 32 else
22 # We are running pub from source in the development repo. 33 # We are running pub from source in the development repo.
(...skipping 10 matching lines...) Expand all
33 fi 44 fi
34 45
35 # Use the Dart binary in the built SDK so pub can find the version file next 46 # Use the Dart binary in the built SDK so pub can find the version file next
36 # to it. 47 # to it.
37 DART="$BUILD_DIR/dart-sdk/bin/dart" 48 DART="$BUILD_DIR/dart-sdk/bin/dart"
38 PACKAGES_DIR="$BUILD_DIR/packages/" 49 PACKAGES_DIR="$BUILD_DIR/packages/"
39 50
40 PUB="$SDK_DIR/lib/_internal/pub/bin/pub.dart" 51 PUB="$SDK_DIR/lib/_internal/pub/bin/pub.dart"
41 52
42 exec "$DART" "--checked" "--package-root=$PACKAGES_DIR" "$PUB" "$@" 53 exec "$DART" "--checked" "--package-root=$PACKAGES_DIR" "$PUB" "$@"
43 fi 54 fi
OLDNEW
« no previous file with comments | « sdk/bin/pub ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698