-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move debug mode configurations to reference.conf (#314)
* Move debug mode configurations to reference.conf * PR fixes - rename vmOption to vmOptions and add tests
- Loading branch information
1 parent
5dfee1d
commit 91a1654
Showing
7 changed files
with
49 additions
and
21 deletions.
There are no files selected for viewing
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
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
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
16 changes: 6 additions & 10 deletions
16
core/driver/sources/src/main/scala/org/virtuslab/ideprobe/ide/intellij/DebugMode.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
package org.virtuslab.ideprobe.ide.intellij | ||
|
||
object DebugMode { | ||
private val enabled: Boolean = env("IDEPROBE_DEBUG", "false").toBoolean | ||
private val suspend: Boolean = env("IDEPROBE_DEBUG_SUSPEND", "false").toBoolean | ||
private val port: Int = env("IDEPROBE_DEBUG_PORT", "5005").toInt | ||
import org.virtuslab.ideprobe.config.DriverConfig.DebugConfig | ||
|
||
def vmOption: Seq[String] = { | ||
if (enabled) { | ||
val suspendOpt = if (suspend) "suspend=y" else "suspend=n" | ||
val addressOpt = s"address=$port" | ||
object DebugMode { | ||
def vmOptions(debugMode: DebugConfig): Seq[String] = { | ||
if (debugMode.enabled) { | ||
val suspendOpt = if (debugMode.suspend) "suspend=y" else "suspend=n" | ||
val addressOpt = s"address=${debugMode.port}" | ||
s"-agentlib:jdwp=transport=dt_socket,server=y,$suspendOpt,$addressOpt" :: Nil | ||
} else { | ||
Nil | ||
} | ||
} | ||
|
||
private def env(name: String, default: String) = System.getenv.getOrDefault(name, default) | ||
} |
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
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
This file was deleted.
Oops, something went wrong.