From 8143bbfc2406f89a0f82116fe8c6566993d02140 Mon Sep 17 00:00:00 2001 From: abe Date: Tue, 3 Mar 2020 14:33:49 +0900 Subject: [PATCH 1/3] Fix --jvm-debug not working on Windows --- src/universal/bin/sbt.bat | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/universal/bin/sbt.bat b/src/universal/bin/sbt.bat index 105c9e7b2..d4fb4dbf3 100755 --- a/src/universal/bin/sbt.bat +++ b/src/universal/bin/sbt.bat @@ -375,6 +375,9 @@ if defined _jvm_debug_arg ( rem next argument wasn't a port, set a default and process next arg set /A JVM_DEBUG_PORT=5005 goto args_loop + ) else ( + shift + goto args_loop ) ) ) From bcf5f020fe610d406feded90f95a3440deab96ff Mon Sep 17 00:00:00 2001 From: abe Date: Wed, 4 Mar 2020 11:48:56 +0900 Subject: [PATCH 2/3] Fix --verbose output with --jvm-debug on Windows --- src/universal/bin/sbt.bat | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/universal/bin/sbt.bat b/src/universal/bin/sbt.bat index d4fb4dbf3..f063cac4b 100755 --- a/src/universal/bin/sbt.bat +++ b/src/universal/bin/sbt.bat @@ -640,6 +640,18 @@ if not "%p:~0,5%" == "-XX:+" if not "%p:~0,5%" == "-XX:-" if "%p:~0,3%" == "-XX" ) ) +if "%p:~0,14%" == "-agentlib:jdwp" ( + rem special handling for --jvm-debug since '=' and ',' gets parsed away + for /F "tokens=1 delims==" %%a in ("%p%") do ( + rem make sure it doesn't have the '=' already + if "%p%" == "%%a" if not "%~1" == "" if not "%~2" == "" if not "%~3" == "" if not "%~4" == "" if not "%~5" == "" if not "%~6" == "" if not "%~7" == "" if not "%~8" == "" ( + echo %0=%1=%2,%3=%4,%5=%6,%7=%8 + shift & shift & shift & shift & shift & shift & shift & shift + goto echolist + ) + ) +) + echo %0 goto echolist From 2242091012afd8d63514af28a0e0f101f7c6d078 Mon Sep 17 00:00:00 2001 From: abe Date: Wed, 4 Mar 2020 12:05:41 +0900 Subject: [PATCH 3/3] Add test for --jvm-debug --- integration-test/src/test/scala/RunnerTest.scala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/integration-test/src/test/scala/RunnerTest.scala b/integration-test/src/test/scala/RunnerTest.scala index b907828ec..29a0be9bb 100755 --- a/integration-test/src/test/scala/RunnerTest.scala +++ b/integration-test/src/test/scala/RunnerTest.scala @@ -190,4 +190,10 @@ object SbtRunnerTest extends SimpleTestSuite with PowerAssertions { assert(out.contains[String]("[info] HelloTest")) () } + + test("sbt --jvm-debug ") { + val out = sbtProcess("--jvm-debug", "12345", "compile", "-v").!!.linesIterator.toList + assert(out.contains[String]("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=12345")) + () + } }