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

Side by Side Diff: sdk/bin/pub

Issue 15362003: Make it possible to symlink to dartdoc and pub in the SDK. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix follow_links in all bin scripts. Created 7 years, 6 months 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/dartdoc ('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) 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 function follow_links() { 6 function follow_links() {
7 while [ -h "$1" ]; do 7 file="$1"
8 while [ -h "$file" ]; do
8 # On Mac OS, readlink -f doesn't work. 9 # On Mac OS, readlink -f doesn't work.
9 1="$(readlink "$1")" 10 file="$(readlink "$file")"
10 done 11 done
11 echo "$1" 12 echo "$(cd "$(dirname $file)"; pwd -P)/$(basename "$file")"
12 } 13 }
13 14
14 # 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. Follow
15 PROG_NAME="$(follow_links "$BASH_SOURCE")" 16 # symlinks to handle the case where dart-sdk/bin or dart-sdk/bin/pub have been
16 17 # linked to.
17 # Handle the case where dart-sdk/bin has been symlinked to. 18 BIN_DIR="$(dirname "$(follow_links "$BASH_SOURCE")")"
18 BIN_DIR="$(follow_links "$(cd "${PROG_NAME%/*}" ; pwd -P)")" 19 SDK_DIR="$(dirname "$BIN_DIR")"
19
20 SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)"
21 20
22 DART="$BIN_DIR/dart" 21 DART="$BIN_DIR/dart"
23 22
24 SNAPSHOT="$BIN_DIR/snapshots/pub.dart.snapshot" 23 SNAPSHOT="$BIN_DIR/snapshots/pub.dart.snapshot"
25 24
26 if test -f "$SNAPSHOT"; then 25 if test -f "$SNAPSHOT"; then
27 # We are running the snapshot in the built SDK. 26 # We are running the snapshot in the built SDK.
28 exec "$DART" "--checked" "$SNAPSHOT" "$@" 27 exec "$DART" "--checked" "$SNAPSHOT" "$@"
29 else 28 else
30 # We are running pub from source in the development repo. 29 # We are running pub from source in the development repo.
31 if [ -z "$DART_CONFIGURATION" ]; 30 if [ -z "$DART_CONFIGURATION" ];
32 then 31 then
33 DART_CONFIGURATION="ReleaseIA32" 32 DART_CONFIGURATION="ReleaseIA32"
34 fi 33 fi
35 34
36 if [[ `uname` == 'Darwin' ]]; 35 if [[ `uname` == 'Darwin' ]];
37 then 36 then
38 PACKAGES_DIR="$SDK_DIR"/../xcodebuild/$DART_CONFIGURATION/packages/ 37 PACKAGES_DIR="$SDK_DIR"/../xcodebuild/$DART_CONFIGURATION/packages/
39 else 38 else
40 PACKAGES_DIR="$SDK_DIR"/../out/$DART_CONFIGURATION/packages/ 39 PACKAGES_DIR="$SDK_DIR"/../out/$DART_CONFIGURATION/packages/
41 fi 40 fi
42 41
43 PUB="$SDK_DIR/lib/_internal/pub/bin/pub.dart" 42 PUB="$SDK_DIR/lib/_internal/pub/bin/pub.dart"
44 43
45 exec "$DART" "--checked" "--package-root=$PACKAGES_DIR" "$PUB" "$@" 44 exec "$DART" "--checked" "--package-root=$PACKAGES_DIR" "$PUB" "$@"
46 fi 45 fi
OLDNEW
« no previous file with comments | « sdk/bin/dartdoc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698