-
Notifications
You must be signed in to change notification settings - Fork 0
/
ceylonb
executable file
·75 lines (63 loc) · 2.01 KB
/
ceylonb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/sh
# resolve links - $0 may be a softlink
PRG="$0"
while [ -h "$PRG" ]; do
ls="$(ls -ld "$PRG")"
link="${ls##*-> }" # remove largest prefix: yields link target (behind ->)
if [ "$link" != "${link#/}" ]; then # remove prefix / if present
# path was absolute
PRG="$link"
else
# was not
PRG="$(dirname "$PRG")/$link"
fi
done
DIR="$(dirname "$PRG")"
# Check if we should use a distribution bootstrap
if [ -f "$DIR/.ceylon/bootstrap/ceylon-bootstrap.properties" ] && [ -f "$DIR/.ceylon/bootstrap/ceylon-bootstrap.jar" ]; then
# Using bootstrap
LIB="$DIR/.ceylon/bootstrap"
else
# Normal execution
CEYLON_HOME="$DIR/.."
LIB="$CEYLON_HOME/lib"
if [ "$1" = "--show-home" ]; then
echo "$CEYLON_HOME"
exit
fi
fi
if [ -z "$JAVA_HOME" ]; then
JAVA="java"
else
JAVA="$JAVA_HOME/bin/java"
fi
# Make sure we have java installed
if ! hash java 2>&-
then
echo >&2 "Java not found, you must install Java in order to compile and run Ceylon programs"
echo >&2 "Go to http://www.java.com/getjava/ to download the latest version of Java"
exit 1
fi
#JAVA_DEBUG_OPTS="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"
if [ "$PRESERVE_JAVA_OPTS" != "true" ]; then
PREPEND_JAVA_OPTS="$JAVA_DEBUG_OPTS"
if [ -n "$COLUMNS" ]; then
CEYL_COLS="$COLUMNS"
elif stty size 2>/dev/null >/dev/null; then
CEYL_COLS="$(stty size 2>/dev/null | cut -d' ' -f2)"
else
CEYL_COLS="$(tput 2>/dev/null cols)"
fi
PREPEND_JAVA_OPTS="$PREPEND_JAVA_OPTS -Dcom.redhat.ceylon.common.tool.terminal.width=$CEYL_COLS"
PREPEND_JAVA_OPTS="$PREPEND_JAVA_OPTS -Dcom.redhat.ceylon.common.tool.progname=$(basename "$PRG")"
fi
JAVA_OPTS="$PREPEND_JAVA_OPTS $JAVA_OPTS"
BOOTSTRAP="$LIB/ceylon-bootstrap.jar"
# Check for cygwin, convert bootstrap path to Windows format
case "`uname`" in
CYGWIN*) [ -n "$LIB" ] && BOOTSTRAP=`cygpath -w "$BOOTSTRAP"`
esac
exec "$JAVA" \
$JAVA_OPTS \
-jar "$BOOTSTRAP" \
"$@"