Skip to content

Commit 153e784

Browse files
committed
repl: update script
1 parent 3a334e4 commit 153e784

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

repl

+20-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,29 @@
11
#!/usr/bin/env bash
2-
set -e
3-
set -u
4-
set -o pipefail
2+
set -euo pipefail
53

4+
JDWP=false
5+
JDWP_PORT=8000
66

7-
while getopts d OPTION "$@"; do
7+
while getopts djp: OPTION "$@"; do
88
case $OPTION in
99
d)
1010
set -x
1111
;;
12+
j)
13+
JDWP=true
14+
;;
15+
p)
16+
JDWP_PORT=$OPTARG
17+
;;
1218
esac
1319
done
1420

21+
EXTRA_JAVA_ARGS=()
22+
if $JDWP; then
23+
EXTRA_JAVA_ARGS+=("-Xdebug")
24+
EXTRA_JAVA_ARGS+=("-Xrunjdwp:server=y,transport=dt_socket,address=${JDWP_PORT},suspend=n")
25+
fi
26+
1527
PROJECT_ROOT=$(dirname "${BASH_SOURCE[0]}")
1628
cd "${PROJECT_ROOT}"
1729

@@ -23,12 +35,13 @@ echo "Compiling and computing classpath (May take a while)"
2335
# /smack/smack-repl/build/classes/main:/smack/smack-repl/build/
2436
# resources/main:/smack/smack-tcp/build/libs/smack-tcp-4.2.0-alpha4-SNAPSHOT.jar
2537
# So perform a "tail -n1" on the output of gradle
26-
GRADLE_CLASSPATH="$(gradle :jxmpp-repl:printClasspath --quiet |\
38+
GRADLE_CLASSPATH="$(${GRADLE_BIN:-./gradlew} :jxmpp-repl:printClasspath --quiet |\
2739
tail -n1)"
2840
echo "Finished, starting REPL"
2941

30-
java \
42+
exec java \
43+
"${EXTRA_JAVA_ARGS[@]}" \
3144
-Dscala.usejavacp=true \
3245
-classpath "${GRADLE_CLASSPATH}" \
3346
ammonite.Main \
34-
-f jxmpp-repl/scala.repl
47+
--predef jxmpp-repl/scala.repl

0 commit comments

Comments
 (0)