From b65f212cac1953803801687e915f47d2627e8c9d Mon Sep 17 00:00:00 2001 From: Tomasz Godzik Date: Tue, 2 Nov 2021 17:51:19 +0100 Subject: [PATCH] Bump scala-debug-adapter to 2.0.11 This fixes the issues with classpath manifest jars. --- .../scala/bloop/dap/BloopDebuggeeRunner.scala | 40 +++++++++++++++---- project/Dependencies.scala | 2 +- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/frontend/src/main/scala/bloop/dap/BloopDebuggeeRunner.scala b/frontend/src/main/scala/bloop/dap/BloopDebuggeeRunner.scala index 2b4ff0dea7..f99ab5da02 100644 --- a/frontend/src/main/scala/bloop/dap/BloopDebuggeeRunner.scala +++ b/frontend/src/main/scala/bloop/dap/BloopDebuggeeRunner.scala @@ -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 { @@ -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`})" @@ -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("[", ", ", "]") @@ -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) @@ -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, @@ -128,7 +133,8 @@ object BloopDebuggeeRunner { evaluationClassLoader, jvm.config, state, - ioScheduler + ioScheduler, + classpath ) ) case platform => @@ -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, @@ -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 + ) ) } } @@ -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) } } @@ -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] diff --git a/project/Dependencies.scala b/project/Dependencies.scala index f9b7318eab..0e0956bf24 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -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