sbt runEngineDistribution --debug to ease debuggging (#6745)

This commit is contained in:
Jaroslav Tulach 2023-05-18 15:00:52 +02:00 committed by GitHub
parent 9e491e7c0b
commit 2bc7d346a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -7,6 +7,8 @@ import sbt.util.{CacheStore, CacheStoreFactory, FileInfo, Tracked}
import scala.sys.process._ import scala.sys.process._
import org.enso.build.WithDebugCommand
object DistributionPackage { object DistributionPackage {
/** File extensions. */ /** File extensions. */
@ -263,6 +265,10 @@ object DistributionPackage {
all.add(enso.getAbsolutePath()) all.add(enso.getAbsolutePath())
all.addAll(args.asJava) all.addAll(args.asJava)
pb.command(all) pb.command(all)
if (args.contains("--debug")) {
all.remove("--debug")
pb.environment().put("JAVA_OPTS", WithDebugCommand.DEBUG_OPTION)
}
pb.inheritIO() pb.inheritIO()
val p = pb.start() val p = pb.start()
val exitCode = p.waitFor() val exitCode = p.waitFor()

View File

@ -15,6 +15,8 @@ import sbt._
* }}} * }}}
*/ */
object WithDebugCommand { object WithDebugCommand {
val DEBUG_OPTION =
"-agentlib:jdwp=transport=dt_socket,server=n,address=localhost:5005,suspend=y";
val truffleNoBackgroundCompilationOptions = Seq( val truffleNoBackgroundCompilationOptions = Seq(
"-Dpolyglot.engine.BackgroundCompilation=false" "-Dpolyglot.engine.BackgroundCompilation=false"
@ -78,9 +80,7 @@ object WithDebugCommand {
else Seq() else Seq()
val debuggerOpts = val debuggerOpts =
if (debugFlags.contains(debuggerOption)) if (debugFlags.contains(debuggerOption))
Seq( Seq(DEBUG_OPTION)
"-agentlib:jdwp=transport=dt_socket,server=n,address=localhost:5005,suspend=y"
)
else Seq() else Seq()
val javaOpts: Seq[String] = Seq( val javaOpts: Seq[String] = Seq(
truffleNoBackgroundCompilationOptions, truffleNoBackgroundCompilationOptions,