Skip to content

Commit

Permalink
Merge pull request #1601 from tgodzik/bump-debug-adapter
Browse files Browse the repository at this point in the history
Bump scala-debug-adapter to 2.0.11
  • Loading branch information
tgodzik authored Nov 2, 2021
2 parents e2e6ede + b65f212 commit 12cca3a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
40 changes: 32 additions & 8 deletions frontend/src/main/scala/bloop/dap/BloopDebuggeeRunner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import monix.execution.Scheduler

import java.net.URLClassLoader
import scala.collection.mutable
import java.nio.file.Path

abstract class BloopDebuggeeRunner(initialState: State, ioScheduler: Scheduler)
extends DebuggeeRunner {
Expand All @@ -39,7 +40,8 @@ private final class MainClassDebugAdapter(
val evaluationClassLoader: Option[ClassLoader],
env: JdkConfig,
initialState: State,
ioScheduler: Scheduler
ioScheduler: Scheduler,
override val classPath: Seq[Path]
) extends BloopDebuggeeRunner(initialState, ioScheduler) {
val javaRuntime: Option[JavaRuntime] = JavaRuntime(env.javaHome.underlying)
def name: String = s"${getClass.getSimpleName}(${project.name}, ${mainClass.`class`})"
Expand Down Expand Up @@ -71,7 +73,8 @@ private final class TestSuiteDebugAdapter(
val javaRuntime: Option[JavaRuntime],
val evaluationClassLoader: Option[ClassLoader],
initialState: State,
ioScheduler: Scheduler
ioScheduler: Scheduler,
override val classPath: Seq[Path]
) extends BloopDebuggeeRunner(initialState, ioScheduler) {
override def name: String = {
val projectsStr = projects.map(_.bspUri).mkString("[", ", ", "]")
Expand Down Expand Up @@ -100,7 +103,8 @@ private final class AttachRemoteDebugAdapter(
val javaRuntime: Option[JavaRuntime],
val evaluationClassLoader: Option[ClassLoader],
initialState: State,
ioScheduler: Scheduler
ioScheduler: Scheduler,
override val classPath: Seq[Path]
) extends BloopDebuggeeRunner(initialState, ioScheduler) {
override def name: String = s"${getClass.getSimpleName}(${initialState.build.origin})"
override def start(state: State): Task[ExitStatus] = Task(ExitStatus.Ok)
Expand All @@ -120,6 +124,7 @@ object BloopDebuggeeRunner {
case jvm: Platform.Jvm =>
val classPathEntries = getClassPathEntries(state, project)
val evaluationClassLoader = getEvaluationClassLoader(project, state)
val classpath = getClasspath(state, project)
Right(
new MainClassDebugAdapter(
project,
Expand All @@ -128,7 +133,8 @@ object BloopDebuggeeRunner {
evaluationClassLoader,
jvm.config,
state,
ioScheduler
ioScheduler,
classpath
)
)
case platform =>
Expand All @@ -151,6 +157,7 @@ object BloopDebuggeeRunner {
val classPathEntries = getClassPathEntries(state, project)
val javaRuntime = JavaRuntime(config.javaHome.underlying)
val evaluationClassLoader = getEvaluationClassLoader(project, state)
val classpath = getClasspath(state, project)
Right(
new TestSuiteDebugAdapter(
projects,
Expand All @@ -159,12 +166,22 @@ object BloopDebuggeeRunner {
javaRuntime,
evaluationClassLoader,
state,
ioScheduler
ioScheduler,
classpath
)
)
case _ =>
Right(
new TestSuiteDebugAdapter(projects, filters, Seq.empty, None, None, state, ioScheduler)
new TestSuiteDebugAdapter(
projects,
filters,
Seq.empty,
None,
None,
state,
ioScheduler,
Seq.empty
)
)
}
}
Expand All @@ -180,14 +197,16 @@ object BloopDebuggeeRunner {
val classPathEntries = getClassPathEntries(state, project)
val javaRuntime = JavaRuntime(config.javaHome.underlying)
val evaluationClassLoader = getEvaluationClassLoader(project, state)
val classpath = getClasspath(state, project)
new AttachRemoteDebugAdapter(
classPathEntries,
javaRuntime,
evaluationClassLoader,
state,
ioScheduler
ioScheduler,
classpath
)
case _ => new AttachRemoteDebugAdapter(Seq.empty, None, None, state, ioScheduler)
case _ => new AttachRemoteDebugAdapter(Seq.empty, None, None, state, ioScheduler, Seq.empty)
}
}

Expand Down Expand Up @@ -238,6 +257,11 @@ object BloopDebuggeeRunner {
.distinct
}

private def getClasspath(state: State, project: Project): Seq[Path] = {
val dag = state.build.getDagFor(project)
project.fullClasspath(dag, state.client).map(_.underlying).toSeq
}

private def getClassDirectories(dag: Dag[Project], client: ClientInfo): Seq[ClassPathEntry] = {
Dag.dfs(dag).map { project =>
val sourceBuffer = mutable.Buffer.empty[SourceEntry]
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ object Dependencies {
val asmVersion = "7.0"
val snailgunVersion = "0.4.0"
val ztExecVersion = "1.11"
val debugAdapterVersion = "2.0.8"
val debugAdapterVersion = "2.0.11"

import sbt.librarymanagement.syntax.stringToOrganization
val zinc = "ch.epfl.scala" %% "zinc" % zincVersion
Expand Down

0 comments on commit 12cca3a

Please sign in to comment.