mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 14:53:37 +00:00
Support symlinking to dart-sdk executables on Linux and Mac.
R=ahe@google.com, brianwilkerson@google.com, rnystrom@google.com BUG=9409 Review URL: https://codereview.chromium.org//68503004 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30287 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
5e90c211c7
commit
326891de60
21
sdk/bin/dart
21
sdk/bin/dart
|
@ -3,20 +3,31 @@
|
|||
# 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.
|
||||
|
||||
# Setting CUR_DIR this way is ugly, but is needed to handle the case where
|
||||
# sdk/bin has been symlinked to. On MacOS, readlink doesn't work with this case.
|
||||
CUR_DIR="$(cd "${0%/*}" ; pwd -P)"
|
||||
function follow_links() {
|
||||
file="$1"
|
||||
while [ -h "$file" ]; do
|
||||
# On Mac OS, readlink -f doesn't work.
|
||||
file="$(readlink "$file")"
|
||||
done
|
||||
echo "$file"
|
||||
}
|
||||
|
||||
# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
|
||||
PROG_NAME="$(follow_links "$BASH_SOURCE")"
|
||||
|
||||
# Handle the case where dart-sdk/bin has been symlinked to.
|
||||
CUR_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
|
||||
|
||||
if [ -z "$DART_CONFIGURATION" ];
|
||||
then
|
||||
DART_CONFIGURATION="ReleaseIA32"
|
||||
fi
|
||||
|
||||
if [[ `uname` == 'Darwin' ]];
|
||||
if [[ `uname` == 'Darwin' ]];
|
||||
then
|
||||
BIN_DIR="$CUR_DIR"/../../xcodebuild/$DART_CONFIGURATION
|
||||
else
|
||||
BIN_DIR="$CUR_DIR"/../../out/$DART_CONFIGURATION
|
||||
fi
|
||||
fi
|
||||
|
||||
exec "$BIN_DIR"/dart "$@"
|
||||
|
|
|
@ -4,18 +4,19 @@
|
|||
# BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
function follow_links() {
|
||||
while [ -h "$1" ]; do
|
||||
file="$1"
|
||||
while [ -h "$file" ]; do
|
||||
# On Mac OS, readlink -f doesn't work.
|
||||
1="$(readlink "$1")"
|
||||
file="$(readlink "$file")"
|
||||
done
|
||||
echo "$1"
|
||||
echo "$file"
|
||||
}
|
||||
|
||||
# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
|
||||
PROG_NAME="$(follow_links "$BASH_SOURCE")"
|
||||
|
||||
# Handle the case where dart-sdk/bin has been symlinked to.
|
||||
BIN_DIR="$(follow_links "$(cd "${PROG_NAME%/*}" ; pwd -P)")"
|
||||
BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
|
||||
|
||||
SDK_DIR="$(cd "${BIN_DIR}/.." ; pwd -P)"
|
||||
|
||||
|
|
|
@ -5,10 +5,21 @@
|
|||
|
||||
set -e
|
||||
|
||||
# Setting SCRIPT_DIR this way is ugly, but is needed to handle the case where
|
||||
# dart-sdk/bin has been symlinked to. On MacOS, readlink doesn't work
|
||||
# with this case.
|
||||
SCRIPT_DIR="$(cd "${0%/*}" ; pwd -P)"
|
||||
function follow_links() {
|
||||
file="$1"
|
||||
while [ -h "$file" ]; do
|
||||
# On Mac OS, readlink -f doesn't work.
|
||||
file="$(readlink "$file")"
|
||||
done
|
||||
echo "$file"
|
||||
}
|
||||
|
||||
# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
|
||||
PROG_NAME="$(follow_links "$BASH_SOURCE")"
|
||||
|
||||
# Handle the case where dart-sdk/bin has been symlinked to.
|
||||
SCRIPT_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
|
||||
|
||||
DART_ANALYZER_HOME="$(cd "${SCRIPT_DIR%/*}" ; pwd -P)"
|
||||
|
||||
FOUND_BATCH=0
|
||||
|
|
|
@ -8,14 +8,6 @@
|
|||
# the testing infrastructure.
|
||||
set -e
|
||||
|
||||
function follow_links() {
|
||||
while [ -h "$1" ]; do
|
||||
# On Mac OS, readlink -f doesn't work.
|
||||
1="$(readlink "$1")"
|
||||
done
|
||||
echo "$1"
|
||||
}
|
||||
|
||||
FOUND_BATCH=0
|
||||
for ARG in "$@"
|
||||
do
|
||||
|
@ -28,11 +20,20 @@ do
|
|||
esac
|
||||
done
|
||||
|
||||
function follow_links() {
|
||||
file="$1"
|
||||
while [ -h "$file" ]; do
|
||||
# On Mac OS, readlink -f doesn't work.
|
||||
file="$(readlink "$file")"
|
||||
done
|
||||
echo "$file"
|
||||
}
|
||||
|
||||
# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
|
||||
PROG_NAME="$(follow_links "$BASH_SOURCE")"
|
||||
|
||||
# Handle the case where the binary dir has been symlinked to.
|
||||
CUR_DIR="$(follow_links "$(cd "${PROG_NAME%/*}" ; pwd -P)")"
|
||||
# Handle the case where dart-sdk/bin has been symlinked to.
|
||||
CUR_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
|
||||
|
||||
SDK_DIR="$(cd "${CUR_DIR}/.." ; pwd -P)"
|
||||
|
||||
|
|
|
@ -3,10 +3,20 @@
|
|||
# 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.
|
||||
|
||||
# Setting BIN_DIR this way is ugly, but is needed to handle the case where
|
||||
# dart-sdk/bin has been symlinked to. On MacOS, readlink doesn't work
|
||||
# with this case.
|
||||
BIN_DIR="$(cd "${0%/*}" ; pwd -P)"
|
||||
function follow_links() {
|
||||
file="$1"
|
||||
while [ -h "$file" ]; do
|
||||
# On Mac OS, readlink -f doesn't work.
|
||||
file="$(readlink "$file")"
|
||||
done
|
||||
echo "$file"
|
||||
}
|
||||
|
||||
# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
|
||||
PROG_NAME="$(follow_links "$BASH_SOURCE")"
|
||||
|
||||
# Handle the case where dart-sdk/bin has been symlinked to.
|
||||
BIN_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
|
||||
|
||||
unset COLORS
|
||||
if test -t 1; then
|
||||
|
|
21
sdk/bin/pub
21
sdk/bin/pub
|
@ -6,10 +6,21 @@
|
|||
# Run pub.dart on the Dart VM. This script assumes the Dart SDK's directory
|
||||
# structure.
|
||||
|
||||
# Setting BIN_DIR this way is ugly, but is needed to handle the case where
|
||||
# dart-sdk/bin has been symlinked to. On MacOS, readlink doesn't work
|
||||
# with this case.
|
||||
BIN_DIR="$(cd "${0%/*}" ; pwd -P)"
|
||||
function follow_links() {
|
||||
file="$1"
|
||||
while [ -h "$file" ]; do
|
||||
# On Mac OS, readlink -f doesn't work.
|
||||
file="$(readlink "$file")"
|
||||
done
|
||||
echo "$file"
|
||||
}
|
||||
|
||||
# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
|
||||
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/pub.dart.snapshot"
|
||||
|
@ -40,4 +51,4 @@ else
|
|||
PUB="$SDK_DIR/lib/_internal/pub/bin/pub.dart"
|
||||
|
||||
exec "$DART" "--package-root=$PACKAGES_DIR" "$PUB" "$@"
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -6,10 +6,21 @@
|
|||
# Run pub.dart on the Dart VM. This script assumes the Dart SDK's directory
|
||||
# structure.
|
||||
|
||||
# Setting BIN_DIR this way is ugly, but is needed to handle the case where
|
||||
# dart-sdk/bin has been symlinked to. On MacOS, readlink doesn't work
|
||||
# with this case.
|
||||
BIN_DIR="$(cd "${0%/*}" ; pwd -P)"
|
||||
function follow_links() {
|
||||
file="$1"
|
||||
while [ -h "$file" ]; do
|
||||
# On Mac OS, readlink -f doesn't work.
|
||||
file="$(readlink "$file")"
|
||||
done
|
||||
echo "$file"
|
||||
}
|
||||
|
||||
# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
|
||||
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/pub.dart.snapshot"
|
||||
|
@ -40,4 +51,4 @@ else
|
|||
PUB="$SDK_DIR/lib/_internal/pub/bin/pub.dart"
|
||||
|
||||
exec "$DART" "--checked" "--package-root=$PACKAGES_DIR" "$PUB" "$@"
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue