Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Bump debug adapter #2365

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions frontend/src/main/scala/bloop/dap/BloopDebugToolsResolver.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package bloop.dap

import java.net.URLClassLoader
import java.nio.file.Path

import scala.collection.mutable
import scala.util.Success
Expand Down Expand Up @@ -34,13 +35,13 @@ class BloopDebugToolsResolver(logger: Logger) extends DebugToolsResolver {
}
}

override def resolveDecoder(scalaVersion: ScalaVersion): Try[ClassLoader] = {
override def resolveDecoder(scalaVersion: ScalaVersion): Try[Seq[Path]] = {
getOrTryUpdate(decoderCache, scalaVersion) {
val decoderModule = s"${BuildInfo.decoderName}_${scalaVersion.binaryVersion}"
val artifact = Artifact(BuildInfo.organization, decoderModule, BuildInfo.version)
DependencyResolution
.resolveWithErrors(List(artifact), logger)
.map(jars => toClassLoader(jars, true))
.map(_.map(_.underlying).toSeq)
.toTry
}
}
Expand All @@ -50,10 +51,10 @@ class BloopDebugToolsResolver(logger: Logger) extends DebugToolsResolver {
new URLClassLoader(jars.map(_.underlying.toUri.toURL), null)
}

private def getOrTryUpdate(
cache: mutable.Map[ScalaVersion, ClassLoader],
private def getOrTryUpdate[T](
cache: mutable.Map[ScalaVersion, T],
scalaVersion: ScalaVersion
)(resolve: => Try[ClassLoader]): Try[ClassLoader] = {
)(resolve: => Try[T]): Try[T] = {
if (cache.contains(scalaVersion)) Success(cache(scalaVersion))
else
resolve.map { classLoader =>
Expand All @@ -65,5 +66,5 @@ class BloopDebugToolsResolver(logger: Logger) extends DebugToolsResolver {

object BloopDebugToolsResolver {
private val expressionCompilerCache: mutable.Map[ScalaVersion, ClassLoader] = mutable.Map.empty
private val decoderCache: mutable.Map[ScalaVersion, ClassLoader] = mutable.Map.empty
private val decoderCache: mutable.Map[ScalaVersion, Seq[Path]] = mutable.Map.empty
}
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ object Dependencies {
val asmVersion = "9.7"
val snailgunVersion = "0.4.0"
val ztExecVersion = "1.12"
val debugAdapterVersion = "4.1.1"
val debugAdapterVersion = "4.2.0"
val bloopConfigVersion = "2.0.2"
val semanticdbVersion = "4.8.15"
val zinc = "org.scala-sbt" %% "zinc" % zincVersion
Expand Down
Loading