From 9e992a6c0f7f8689aff9899691ed146b6e441170 Mon Sep 17 00:00:00 2001 From: Kamil Podsiadlo Date: Thu, 24 Feb 2022 12:33:52 +0100 Subject: [PATCH 1/3] feat: add framework name to the test classes BSP request [skip ci] --- bsp/src/mill/bsp/MillScalaBuildServer.scala | 7 ++++--- build.sc | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bsp/src/mill/bsp/MillScalaBuildServer.scala b/bsp/src/mill/bsp/MillScalaBuildServer.scala index 710e3fd409d..f9a231f30df 100644 --- a/bsp/src/mill/bsp/MillScalaBuildServer.scala +++ b/bsp/src/mill/bsp/MillScalaBuildServer.scala @@ -93,22 +93,23 @@ trait MillScalaBuildServer extends ScalaBuildServer { this: MillBuildServer => val testFramework = m.testFramework() val compResult = m.compile() - val classFingerprint: Agg[(Class[_], Fingerprint)] = Jvm.inprocess( + val (frameworkName, classFingerprint): (String, Agg[(Class[_], Fingerprint)]) = Jvm.inprocess( classpath.map(_.path), classLoaderOverrideSbtTesting = true, isolated = true, closeContextClassLoaderWhenDone = false, cl => { val framework = TestRunner.framework(testFramework)(cl) - TestRunner.discoverTests( + val discoveredTests = TestRunner.discoverTests( cl, framework, Agg(compResult.classes.path) ) + (framework.name(), discoveredTests) } ) val classes = Seq.from(classFingerprint.map(classF => classF._1.getName.stripSuffix("$"))) - new ScalaTestClassesItem(id, classes.asJava) + new ScalaTestClassesItem(id, classes.asJava, frameworkName) } case (id, _) => T.task { // Not a test module, so no test classes diff --git a/build.sc b/build.sc index 1e184f196e4..9a3e35c7219 100755 --- a/build.sc +++ b/build.sc @@ -133,7 +133,7 @@ object Deps { val utest = ivy"com.lihaoyi::utest:0.7.11" val windowsAnsi = ivy"io.github.alexarchambault.windows-ansi:windows-ansi:0.0.3" val zinc = ivy"org.scala-sbt::zinc:1.6.1" - val bsp = ivy"ch.epfl.scala:bsp4j:2.0.0" + val bsp = ivy"ch.epfl.scala:bsp4j:2.0.0+60-b6a5df8b-SNAPSHOT" val fansi = ivy"com.lihaoyi::fansi:0.3.1" val jarjarabrams = ivy"com.eed3si9n.jarjarabrams::jarjar-abrams-core:1.8.1" } From 5f6e338a643d6ebf4de7691ce393a39e3f8b2628 Mon Sep 17 00:00:00 2001 From: Kamil Podsiadlo Date: Mon, 21 Mar 2022 11:47:19 +0100 Subject: [PATCH 2/3] bump: bsp version --- build.sc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sc b/build.sc index 9a3e35c7219..aebbb4587d7 100755 --- a/build.sc +++ b/build.sc @@ -133,7 +133,7 @@ object Deps { val utest = ivy"com.lihaoyi::utest:0.7.11" val windowsAnsi = ivy"io.github.alexarchambault.windows-ansi:windows-ansi:0.0.3" val zinc = ivy"org.scala-sbt::zinc:1.6.1" - val bsp = ivy"ch.epfl.scala:bsp4j:2.0.0+60-b6a5df8b-SNAPSHOT" + val bsp = ivy"ch.epfl.scala:bsp4j:2.1.0-M1" val fansi = ivy"com.lihaoyi::fansi:0.3.1" val jarjarabrams = ivy"com.eed3si9n.jarjarabrams::jarjar-abrams-core:1.8.1" } From 7c10071c4aa5f13b4020f8e38f43b4cb022fdb0f Mon Sep 17 00:00:00 2001 From: Kamil Podsiadlo Date: Fri, 22 Apr 2022 09:29:32 +0200 Subject: [PATCH 3/3] fix: override debugSessionStart endpoint --- bsp/src/mill/bsp/MillBuildServer.scala | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bsp/src/mill/bsp/MillBuildServer.scala b/bsp/src/mill/bsp/MillBuildServer.scala index 03f1bb7321a..245759fd7ab 100644 --- a/bsp/src/mill/bsp/MillBuildServer.scala +++ b/bsp/src/mill/bsp/MillBuildServer.scala @@ -13,6 +13,8 @@ import ch.epfl.scala.bsp4j.{ CompileProvider, CompileResult, DebugProvider, + DebugSessionAddress, + DebugSessionParams, DependencyModule, DependencyModulesItem, DependencyModulesParams, @@ -625,6 +627,12 @@ class MillBuildServer( new CleanCacheResult(msg, cleaned) } + override def debugSessionStart(debugParams: DebugSessionParams) + : CompletableFuture[DebugSessionAddress] = + completable(s"debugSessionStart ${debugParams}") { state => + throw new NotImplementedError("debugSessionStart endpoint is not implemented") + } + def completableTasks[T: ClassTag, V]( hint: String, targetIds: Seq[BuildTargetIdentifier],