From e1e12031ac3d1f28683b90cc9a6e628f2693b57c Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 14 Oct 2017 13:38:24 +0200 Subject: [PATCH] REPL: Add support to enable a JDWP debug link --- repl | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/repl b/repl index 889022260..f11456edb 100755 --- a/repl +++ b/repl @@ -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}" @@ -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 \