forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common
executable file
·117 lines (103 loc) · 3.29 KB
/
common
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/usr/bin/env bash
#/*--------------------------------------------------------------------------
# * Credits: This script is based on the script generated by sbt-pack.
# *--------------------------------------------------------------------------*/
cygwin=false
mingw=false
darwin=false
case "`uname`" in
CYGWIN*) cygwin=true
;;
MINGW*) mingw=true
;;
Darwin*) darwin=true
if [ -z "$JAVA_VERSION" ] ; then
JAVA_VERSION="CurrentJDK"
else
echo "Using Java version: $JAVA_VERSION" 1>&2
fi
if [ -z "$JAVA_HOME" ] ; then
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home
fi
JAVA_OPTS="$JAVA_OPTS -Xdock:name=\"${PROG_NAME}\" -Xdock:icon=\"$PROG_HOME/icon-mac.png\" -Dapple.laf.useScreenMenuBar=true"
JAVACMD="`which java`"
;;
esac
# Resolve JAVA_HOME from javac command path
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" -a -f "$javaExecutable" -a ! "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
javaExecutable="`readlink -f \"$javaExecutable\"`"
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`which java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly."
echo " We cannot execute $JAVACMD"
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSPATH_SUFFIX=""
# Path separator used in EXTRA_CLASSPATH
PSEP=":"
# For Cygwin, switch paths to Windows-mixed format before running java
if $cygwin; then
[ -n "$PROG_HOME" ] &&
PROG_HOME=`cygpath -am "$PROG_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath -am "$JAVA_HOME"`
CLASSPATH_SUFFIX=";"
PSEP=";"
fi
# For Migwn, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$PROG_HOME" ] &&
PROG_HOME="`(cd "$PROG_HOME"; pwd -W | sed 's|/|\\\\|g')`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd -W | sed 's|/|\\\\|g')`"
CLASSPATH_SUFFIX=";"
PSEP=";"
fi
#/*--------------------------------------------------
# * The code below is for Dotty
# *-------------------------------------------------*/
find_lib () {
local lib=$(find $PROG_HOME/lib/ -name "$1")
if $cygwin; then
cygpath -am $lib
elif $mingw; then
echo $lib | sed 's|/|\\\\|g'
else
echo $lib
fi
}
DOTTY_COMP=$(find_lib "*dotty-compiler*")
DOTTY_INTF=$(find_lib "*dotty-interfaces*")
DOTTY_LIB=$(find_lib "*dotty-library*")
SCALA_ASM=$(find_lib "*scala-asm*")
SCALA_LIB=$(find_lib "*scala-library*")
SCALA_XML=$(find_lib "*scala-xml*")
SBT_INTF=$(find_lib "*sbt-interface*")
# debug
DEBUG_STR=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005