Skip to content

Commit

Permalink
repl: update script
Browse files Browse the repository at this point in the history
  • Loading branch information
Flowdalic committed Oct 20, 2024
1 parent 3a334e4 commit 153e784
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions repl
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
set -euo pipefail

JDWP=false
JDWP_PORT=8000

while getopts d OPTION "$@"; do
while getopts djp: OPTION "$@"; do
case $OPTION in
d)
set -x
;;
j)
JDWP=true
;;
p)
JDWP_PORT=$OPTARG
;;
esac
done

EXTRA_JAVA_ARGS=()
if $JDWP; then
EXTRA_JAVA_ARGS+=("-Xdebug")
EXTRA_JAVA_ARGS+=("-Xrunjdwp:server=y,transport=dt_socket,address=${JDWP_PORT},suspend=n")
fi

PROJECT_ROOT=$(dirname "${BASH_SOURCE[0]}")
cd "${PROJECT_ROOT}"

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

java \
exec java \
"${EXTRA_JAVA_ARGS[@]}" \
-Dscala.usejavacp=true \
-classpath "${GRADLE_CLASSPATH}" \
ammonite.Main \
-f jxmpp-repl/scala.repl
--predef jxmpp-repl/scala.repl

0 comments on commit 153e784

Please sign in to comment.