Skip to content

Commit

Permalink
Don't assume a Zinc compiler in BSP JVM extension
Browse files Browse the repository at this point in the history
Instead we use the compilation-task independent discovery of main classes.
  • Loading branch information
lefou committed Aug 29, 2024
1 parent e5eb648 commit f059bcd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bsp/worker/src/mill/bsp/worker/MillJvmBuildServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
}
}
Expand All @@ -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(
Expand All @@ -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
Expand Down

0 comments on commit f059bcd

Please sign in to comment.