Skip to content

Commit

Permalink
added -g javac option & updated bin/scalafmt
Browse files Browse the repository at this point in the history
  • Loading branch information
iusildra committed Jul 17, 2023
1 parent 22781b3 commit 71a482f
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 2 deletions.
Binary file modified bin/scalafmt
Binary file not shown.
2 changes: 1 addition & 1 deletion modules/java-debug
Submodule java-debug updated 0 files
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,12 @@ object DebugAdapterPlugin extends sbt.AutoPlugin {
def runSettings: Seq[Def.Setting[_]] = Seq(
startMainClassDebugSession := mainClassSessionTask.evaluated,
startRemoteDebugSession := remoteSessionTask.evaluated,
stopDebugSession := stopSessionTask.value
stopDebugSession := stopSessionTask.value,
Keys.compile / Keys.javacOptions := {
val jo = (Keys.compile / Keys.javacOptions).value
if (jo.contains("-g")) jo
else jo :+ "-g"
}
)

/**
Expand Down
17 changes: 17 additions & 0 deletions modules/sbt-plugin/src/sbt-test/debug-session/debug-java/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import ch.epfl.scala.debugadapter.testfmk._

val checkDebugJava = inputKey[Unit]("Check that the -g option has been added")

def checkDebugJavaTask = Def.inputTask {
val uri = (Compile / startMainClassDebugSession).evaluated
val source = (Compile / sources).value.head.toPath
implicit val context: TestingContext = TestingContext(source, "3.3.0")
DebugTest.check(uri)(Breakpoint(source, 6), Evaluation.success("x", 1))
}

lazy val debugJavaWithG =
project
.in(file("./withG"))
.settings(javacOptions += "-g", checkDebugJava := checkDebugJavaTask.evaluated)

lazy val debugJavaWithoutG = project.in(file("./withoutG")).settings(checkDebugJava := checkDebugJavaTask.evaluated)
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// required for [email protected]
addSbtPlugin("org.scala-debugger" % "sbt-jdi-tools" % "1.1.1")
2 changes: 2 additions & 0 deletions modules/sbt-plugin/src/sbt-test/debug-session/debug-java/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
> 'debugJavaWithG / checkDebugJava {"class":"example.Main","arguments":[],"jvmOptions":[]}'
> 'debugJavaWithoutG / checkDebugJava {"class":"example.Main","arguments":[],"jvmOptions":[]}'
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package example;

public class Main {
public static void main(String[] args) {
var x = 1;
System.out.println("Hello, world!");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package example;

public class Main {
public static void main(String[] args) {
var x = 1;
System.out.println("Hello, world!");
}
}

0 comments on commit 71a482f

Please sign in to comment.