Skip to content

Commit

Permalink
REPL: Add support to enable a JDWP debug link
Browse files Browse the repository at this point in the history
  • Loading branch information
Flowdalic committed Oct 14, 2017
1 parent 01aa6d9 commit e1e1203
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions repl
Expand Up @@ -3,15 +3,29 @@ set -e
set -u
set -o 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 @@ -27,7 +41,7 @@ GRADLE_CLASSPATH="$(gradle :smack-repl:printClasspath --quiet |\
tail -n1)"
echo "Finished, starting REPL"

java \
java "${EXTRA_JAVA_ARGS[@]}" \
-Dscala.usejavacp=true \
-classpath "${GRADLE_CLASSPATH}" \
ammonite.Main \
Expand Down

0 comments on commit e1e1203

Please sign in to comment.