-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwf
executable file
·62 lines (49 loc) · 1.93 KB
/
wf
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
#!/bin/bash
# LICENSE
# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
# distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# END LICENSE
if [ -n "$SLIME_WF_BASH_DEBUG" ]; then
set -x
fi
export PROJECT="$(dirname $0)"
SLIME="${PROJECT}"
JSH_LOCAL_JDKS="${SLIME}/local/jdk"
JSH_SHELL_LIB="${SLIME}/local/jsh/lib"
# If this is a VMWare Linux guest, mount the source directory inside the VM at ${HOME}/src
if [ "$(uname)" == "Linux" ]; then
# We know (?) realpath is present because this is Linux
if [ "$(realpath $0)" == "/mnt/hgfs/slime/wf" ]; then
# VMWare Linux guest with host source directory mounted
if [ -z "${JSH_LOCAL_JDKS}" ]; then
# Set up profile which specifies "local" assets (ordinarily in the local/ subdirectory) should go under the home
# directory
echo "source $(realpath ${SLIME}/contributor/macos/linuxvm/profile.bashrc)" >>"${HOME}/.bashrc"
source ${SLIME}/contributor/macos/linuxvm/profile.bashrc
fi
if [ ! -h "${HOME}/src" ]; then
ln -s /mnt/hgfs/slime ${HOME}/src
fi
fi
fi
SLIME_WF_JDK_VERSION="${SLIME_WF_JDK_VERSION:-21}"
SLIME_WF_JDK_DEFAULT="${JSH_LOCAL_JDKS}/default"
# TODO this is very repetitive but would be cumbersome to simplify
if [ "${SLIME_WF_JDK_VERSION}" = "8" ] || [ "${SLIME_WF_JDK_VERSION}" = "11" ] || [ "${SLIME_WF_JDK_VERSION}" = "17" ] || [ "${SLIME_WF_JDK_VERSION}" = "21" ]; then
SLIME_WF_JDK_LOCAL="${JSH_LOCAL_JDKS}/${SLIME_WF_JDK_VERSION}"
if [ ! -d "${SLIME_WF_JDK_LOCAL}" ]; then
${SLIME}/jsh --add-jdk-${SLIME_WF_JDK_VERSION}
fi
if [ ! -d "${SLIME_WF_JDK_DEFAULT}" ]; then
${SLIME}/jsh --install-jdk-${SLIME_WF_JDK_VERSION}
fi
if [ ! -f "${JSH_SHELL_LIB}/js.jar" ]; then
${SLIME}/jsh --install-rhino
fi
export JSH_LAUNCHER_JDK_HOME="${SLIME_WF_JDK_LOCAL}"
else
>&2 echo "Unsupported JDK version ${SLIME_WF_JDK_VERSION}; exiting."
exit 1
fi
${PROJECT}/tools/wf.bash "$@"