Skip to content

Commit

Permalink
sbt runEngineDistribution --debug to ease debuggging (#6745)
Browse files Browse the repository at this point in the history
  • Loading branch information
JaroslavTulach authored May 18, 2023
1 parent 9e491e7 commit 2bc7d34
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions project/DistributionPackage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import sbt.util.{CacheStore, CacheStoreFactory, FileInfo, Tracked}

import scala.sys.process._

import org.enso.build.WithDebugCommand

object DistributionPackage {

/** File extensions. */
Expand Down Expand Up @@ -263,6 +265,10 @@ object DistributionPackage {
all.add(enso.getAbsolutePath())
all.addAll(args.asJava)
pb.command(all)
if (args.contains("--debug")) {
all.remove("--debug")
pb.environment().put("JAVA_OPTS", WithDebugCommand.DEBUG_OPTION)
}
pb.inheritIO()
val p = pb.start()
val exitCode = p.waitFor()
Expand Down
6 changes: 3 additions & 3 deletions project/WithDebugCommand.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import sbt._
* }}}
*/
object WithDebugCommand {
val DEBUG_OPTION =
"-agentlib:jdwp=transport=dt_socket,server=n,address=localhost:5005,suspend=y";

val truffleNoBackgroundCompilationOptions = Seq(
"-Dpolyglot.engine.BackgroundCompilation=false"
Expand Down Expand Up @@ -78,9 +80,7 @@ object WithDebugCommand {
else Seq()
val debuggerOpts =
if (debugFlags.contains(debuggerOption))
Seq(
"-agentlib:jdwp=transport=dt_socket,server=n,address=localhost:5005,suspend=y"
)
Seq(DEBUG_OPTION)
else Seq()
val javaOpts: Seq[String] = Seq(
truffleNoBackgroundCompilationOptions,
Expand Down

0 comments on commit 2bc7d34

Please sign in to comment.