X: Synchronize 'run.sh' and 'debug.sh'

This commit is contained in:
2026-10-22 10:46:04 +02:00
parent 1ab439b578
commit 7aab307381
+13 -3
View File
@@ -1,24 +1,34 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
LOG4J_CONFIG="conf/log4j2.xml"
if [[ ! -r "$LOG4J_CONFIG" || ! -s "$LOG4J_CONFIG" ]]; then
echo "ERROR: Log4j2 configuration file is missing, unreadable, or empty: $PWD/$LOG4J_CONFIG" >&2
exit 1
fi
shopt -s nullglob shopt -s nullglob
jars=(libs/*.jar) jars=(libs/*.jar)
if (( ${#jars[@]} == 0 )); then if (( ${#jars[@]} == 0 )); then
echo "ERROR: No JARs found in libs/" >&2 echo "ERROR: No JARs found in $PWD/libs/" >&2
exit 1 exit 1
fi fi
CLASSPATH=$(IFS=:; echo "${jars[*]}") CLASSPATH=$(IFS=:; echo "${jars[*]}")
DEBUG_PORT="${DEBUG_PORT:-5005}" DEBUG_PORT="${DEBUG_PORT:-5005}"
DEBUG_SUSPEND="${DEBUG_SUSPEND:-y}" DEBUG_SUSPEND="${DEBUG_SUSPEND:-n}"
echo "Starting NenjimHub in DEBUG mode on port ${DEBUG_PORT} (suspend=${DEBUG_SUSPEND})" echo "Starting NenjimHub in DEBUG mode on port ${DEBUG_PORT} (suspend=${DEBUG_SUSPEND})"
exec java \ exec java \
--enable-native-access=javafx.graphics \
--enable-preview \ --enable-preview \
"-agentlib:jdwp=transport=dt_socket,server=y,suspend=${DEBUG_SUSPEND},address=*:${DEBUG_PORT}" \ "-agentlib:jdwp=transport=dt_socket,server=y,suspend=${DEBUG_SUSPEND},address=*:${DEBUG_PORT}" \
-Dlog4j.configurationFile=conf/log4j2.xml \ "-Dlog4j.configurationFile=$LOG4J_CONFIG" \
-cp "$CLASSPATH" \ -cp "$CLASSPATH" \
com.r35157.nenjim.hubd.Main com.r35157.nenjim.hubd.Main