From 80c804c5d297a5bc011b22bf9dbf1a7a129e6143 Mon Sep 17 00:00:00 2001 From: Nathan Glenn Date: Wed, 14 Aug 2024 08:50:20 -0500 Subject: [PATCH] improve debugger run scripts Mostly unify with the ones in the release, including adding trace capabilities and stronger warnings, and fix running on Mac. Explain the differences with the released scripts. --- scripts/SoarJavaDebugger.bat | 8 ++++---- scripts/SoarJavaDebugger.sh | 24 ++++++++++++++++++++---- scripts/readme.md | 4 ++-- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/scripts/SoarJavaDebugger.bat b/scripts/SoarJavaDebugger.bat index d3e0451f1a..a181cc6e69 100644 --- a/scripts/SoarJavaDebugger.bat +++ b/scripts/SoarJavaDebugger.bat @@ -1,4 +1,4 @@ -@echo off -set SOAR_HOME=%~dp0 -set PATH=%SOAR_HOME%;%PATH% -start javaw -Djava.library.path=%SOAR_HOME% -jar SoarJavaDebugger.jar %1 %2 %3 %4 %5 +@echo off +set SOAR_HOME=%~dp0 +set PATH=%SOAR_HOME%;%PATH% +start javaw -Djava.library.path="%SOAR_HOME%" -jar "%SOAR_HOME%"\SoarJavaDebugger.jar %1 %2 %3 %4 %5 diff --git a/scripts/SoarJavaDebugger.sh b/scripts/SoarJavaDebugger.sh index 71b41a693a..f6f34f6974 100755 --- a/scripts/SoarJavaDebugger.sh +++ b/scripts/SoarJavaDebugger.sh @@ -1,4 +1,20 @@ -#!/bin/bash -export SOAR_HOME="$(pwd)" -export LD_LIBRARY_PATH="$SOAR_HOME" -java -Djava.library.path="$SOAR_HOME" -jar "$SOAR_HOME/SoarJavaDebugger.jar" $1 $2 $3 $4 $5 & +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail +if [[ "${TRACE-0}" == "1" ]]; then + set -o xtrace +fi + +THISDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +export SOAR_HOME="$THISDIR" +export DYLD_LIBRARY_PATH="$SOAR_HOME" + +FLAG="" +# SWT requirement: display must be created on main thread due to Cocoa restrictions +if [[ $(uname) == 'Darwin' ]]; then + FLAG="-XstartOnFirstThread" +fi + +java $FLAG -Djava.library.path="$SOAR_HOME" -jar "$SOAR_HOME/SoarJavaDebugger.jar" "$@" & diff --git a/scripts/readme.md b/scripts/readme.md index 632ce2c3bb..6ad149ebe3 100644 --- a/scripts/readme.md +++ b/scripts/readme.md @@ -1,3 +1,3 @@ -Note that the scripts here are not the same ones that are distributed with the Soar release; those are in Release-Support/scripts. +# Scripts -TODO: it would be nice to use the same scripts for both. There's some logic that's different, though, so we can't just copy them over. +Note that the scripts here are not the same ones that are distributed with the Soar release; those are in Release-Support/scripts. They are almost the same; the release ones add `/bin` to SOAR_HOME and run the soar setup script.