-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #545 from adpi2/fix-main-class-in-test
[sbt plugin] Fix debug main class in test scope
- Loading branch information
Showing
8 changed files
with
64 additions
and
6 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
10 changes: 10 additions & 0 deletions
10
modules/sbt-plugin/src/sbt-test/debug-session/test-main-class/build.sbt
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import ch.epfl.scala.debugadapter.testfmk._ | ||
|
||
val checkDebugSession = inputKey[Unit]("Check the main class debug session") | ||
|
||
scalaVersion := "2.12.14" | ||
checkDebugSession := { | ||
val uri = (Test / startMainClassDebugSession).evaluated | ||
val source = (Test / sources).value.head.toPath | ||
DebugTest.check(uri)(Breakpoint(source, 5)) | ||
} |
12 changes: 12 additions & 0 deletions
12
modules/sbt-plugin/src/sbt-test/debug-session/test-main-class/project/plugins.sbt
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
val pluginVersion = sys.props | ||
.get("plugin.version") | ||
.getOrElse { | ||
sys.error( | ||
"""|The system property 'plugin.version' is not defined. | ||
|Specify this property using the scriptedLaunchOpts -D. | ||
|""".stripMargin | ||
) | ||
} | ||
|
||
addSbtPlugin("ch.epfl.scala" % "sbt-debug-adapter" % pluginVersion) | ||
libraryDependencies += "ch.epfl.scala" %% "scala-debug-adapter-test" % pluginVersion |
2 changes: 2 additions & 0 deletions
2
modules/sbt-plugin/src/sbt-test/debug-session/test-main-class/project/project/plugins.sbt
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// required for adopt@1.8 | ||
addSbtPlugin("org.scala-debugger" % "sbt-jdi-tools" % "1.1.1") |
7 changes: 7 additions & 0 deletions
7
...s/sbt-plugin/src/sbt-test/debug-session/test-main-class/src/test/scala/example/Main.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package example | ||
|
||
object Main { | ||
def main(args: Array[String]): Unit = { | ||
println("Hello, World!") | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
modules/sbt-plugin/src/sbt-test/debug-session/test-main-class/test
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
> 'checkDebugSession {"class":"example.Main","arguments":[],"jvmOptions":[]}' | ||
> stopDebugSession |