Created
November 4, 2019 21:49
-
-
Save hrhino/fc8abd48b04dce0a38caf72339ff1aa5 to your computer and use it in GitHub Desktop.
commands for enabling / disabling java debugger in scala/scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package scala.build | |
import sbt._, Keys._, plugins._ | |
object Debug extends AutoPlugin { | |
override def requires = JvmPlugin | |
override def trigger = allRequirements | |
import VersionUtil._ | |
override def globalSettings: Seq[Def.Setting[_]] = { | |
def enableDebugger(suspend: Boolean) = | |
s"-agentlib:jdwp=transport=dt_socket,server=y,suspend=${if (suspend) "y" else "n"},address=5005" | |
def commandPair(name: String, scope: String, suspend: Boolean): List[Command] = { | |
List(name + "On" -> "+=", name + "Off" -> "-=") map { case (cmd, op) => | |
Command.command(cmd)(s"""set javaOptions in $scope $op "${enableDebugger(suspend)}" """ :: _) | |
} | |
} | |
val repl = if (versionProps("starr.version") startsWith "2.13") "replFrontend" else "replJlineEmbedded" | |
List( | |
commands ++= commandPair("replDebug", s"run in $repl", suspend = false), | |
commands ++= commandPair("partestDebug", "test in IntegrationTest", suspend = true ), | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment