From cc0f74fd338a0a8c898a421f69b888580266efb6 Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Thu, 29 Aug 2024 17:04:20 +0200 Subject: [PATCH] Don't assume a Zinc compiler in BSP JVM extension Instead we use the compilation-task independent discovery of main classes. --- .../src/mill/bsp/worker/MillJvmBuildServer.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bsp/worker/src/mill/bsp/worker/MillJvmBuildServer.scala b/bsp/worker/src/mill/bsp/worker/MillJvmBuildServer.scala index b358ddcc28e..4f0bb963037 100644 --- a/bsp/worker/src/mill/bsp/worker/MillJvmBuildServer.scala +++ b/bsp/worker/src/mill/bsp/worker/MillJvmBuildServer.scala @@ -52,13 +52,13 @@ private trait MillJvmBuildServer extends JvmBuildServer { this: MillBuildServer case m: JavaModule => T.task { ( + m.localRunClasspath(), m.runClasspath(), m.forkArgs(), m.forkWorkingDir(), m.forkEnv(), m.mainClass(), - m.zincWorker().worker(), - m.compile() + m.zincWorker().worker() ) } } @@ -69,7 +69,7 @@ private trait MillJvmBuildServer extends JvmBuildServer { this: MillBuildServer state, id, _: JavaModule, - (runClasspath, forkArgs, forkWorkingDir, forkEnv, mainClass, zincWorker, compile) + (localRunClasspath, runClasspath, forkArgs, forkWorkingDir, forkEnv, mainClass, zincWorker) ) => val classpath = runClasspath.map(_.path).map(sanitizeUri) val item = new JvmEnvironmentItem( @@ -80,8 +80,8 @@ private trait MillJvmBuildServer extends JvmBuildServer { this: MillBuildServer forkEnv.asJava ) - val classes = mainClass.toList ++ zincWorker.discoverMainClasses(compile) - item.setMainClasses(classes.map(new JvmMainClass(_, Nil.asJava)).asJava) + val classes = mainClass.toList ++ zincWorker.discoverMainClasses(localRunClasspath.map(_.path)) + item.setMainClasses(classes.distinct.map(new JvmMainClass(_, Nil.asJava)).asJava) item } { agg