Skip to content

Commit

Permalink
Fixed empty BSP response for buildTarget/scalaTestClasses
Browse files Browse the repository at this point in the history
  • Loading branch information
lefou committed Nov 7, 2021
1 parent e404163 commit ef07421
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions bsp/src/mill/bsp/MillScalaBuildServer.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package mill.bsp

import java.util.concurrent.CompletableFuture

import scala.jdk.CollectionConverters._
import scala.util.chaining._

import ch.epfl.scala.bsp4j.{
ScalaBuildServer,
ScalaMainClass,
Expand All @@ -13,13 +18,10 @@ import ch.epfl.scala.bsp4j.{
ScalacOptionsParams,
ScalacOptionsResult
}
import mill.{Agg, T}
import mill.modules.Jvm
import mill.scalalib.{JavaModule, Lib, ScalaModule, TestModule, TestRunner}

import java.util.concurrent.CompletableFuture
import scala.jdk.CollectionConverters._
import scala.util.chaining._
import mill.{Agg, T}
import sbt.testing.Fingerprint

trait MillScalaBuildServer extends ScalaBuildServer { this: MillBuildServer =>

Expand All @@ -35,8 +37,8 @@ trait MillScalaBuildServer extends ScalaBuildServer { this: MillBuildServer =>
case (id, m: JavaModule) =>
val optionsTask = m match {
case sm: ScalaModule => T.task {
sm.allScalacOptions() ++ sm.scalacPluginClasspath().map(jar => s"-Xplugin:$jar")
}
sm.allScalacOptions() ++ sm.scalacPluginClasspath().map(jar => s"-Xplugin:$jar")
}
case _ => T.task { Seq.empty[String] }
}

Expand Down Expand Up @@ -92,7 +94,7 @@ trait MillScalaBuildServer extends ScalaBuildServer { this: MillBuildServer =>
val testFramework = m.testFramework()
val compResult = m.compile()

val classFingerprint = Jvm.inprocess(
val classFingerprint: Agg[(Class[_], Fingerprint)] = Jvm.inprocess(
classpath.map(_.path),
classLoaderOverrideSbtTesting = true,
isolated = true,
Expand All @@ -106,9 +108,7 @@ trait MillScalaBuildServer extends ScalaBuildServer { this: MillBuildServer =>
)
}
)
Seq.from(classFingerprint.map(classF => classF._1.getName.stripSuffix("$")))

val classes = Seq.empty[String]
val classes = Seq.from(classFingerprint.map(classF => classF._1.getName.stripSuffix("$")))
new ScalaTestClassesItem(id, classes.asJava)
}
case (id, _) => T.task {
Expand Down

0 comments on commit ef07421

Please sign in to comment.