Skip to content

Commit

Permalink
fix: targetJarClasspath for mill-bsp
Browse files Browse the repository at this point in the history
  • Loading branch information
kasiaMarek committed May 21, 2024
1 parent 49a3fc4 commit ac3fdd5
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions metals/src/main/scala/scala/meta/internal/metals/TargetData.scala
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,20 @@ final class TargetData {
def targetJarClasspath(
id: BuildTargetIdentifier
): Option[List[AbsolutePath]] = {
buildTargetDependencyModules.get(id) match {
case None =>
jvmTarget(id).flatMap { target =>
target.jarClasspath
}
case Some(value) =>
Some(value.flatMap(_.getArtifacts().asScala).collect {
val fromDepModules =
for {
module <- buildTargetDependencyModules.getOrElse(id, Nil)
artifact <- module.getArtifacts().asScala
path <- artifact match {
case artifact: MavenDependencyModuleArtifact
if artifact.getClassifier() == null =>
artifact.getUri().toAbsolutePath
})
}
Some(artifact.getUri().toAbsolutePath)
case _ => None
}
} yield path

if (fromDepModules.isEmpty) jvmTarget(id).flatMap(_.jarClasspath)
else Some(fromDepModules)
}

def targetClasspath(
Expand Down

0 comments on commit ac3fdd5

Please sign in to comment.