File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed
build/src/main/scala/scala/build/bsp
cli/src/main/scala/scala/cli/commands/bsp Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -620,10 +620,10 @@ final class BspImpl(
620
620
case Right (preBuildProject) =>
621
621
// FIXME we might want to report overridden options or chose a better merge strategy
622
622
val projectBuildOptions = preBuildProject.prebuildModules
623
- .map(_.mainScope.buildOptions)
624
- .reduce(_ orElse _)
623
+ .flatMap(m => Seq (m.mainScope.buildOptions, m.testScope.buildOptions))
625
624
626
- lazy val projectJavaHome = projectBuildOptions.javaHome().value
625
+ lazy val projectJavaHome = projectBuildOptions.map(_.javaHome().value)
626
+ .maxBy(_.version)
627
627
628
628
val finalBloopSession =
629
629
if (
@@ -633,10 +633,8 @@ final class BspImpl(
633
633
s " Bloop JVM version too low, current ${bloopSession.get().remoteServer.jvmVersion.get
634
634
.value} expected ${projectJavaHome.version}, restarting server "
635
635
)
636
- // RelodableOptions don't take into account buildOptions from sources
636
+ // ReloadableOptions don't take into account buildOptions from sources, so we need to update the bloopRifleConfig
637
637
val updatedReloadableOptions = reloadableOptions.copy(
638
- buildOptions =
639
- reloadableOptions.buildOptions orElse projectBuildOptions,
640
638
bloopRifleConfig = reloadableOptions.bloopRifleConfig.copy(
641
639
javaPath = projectJavaHome.javaCommand,
642
640
minimumBloopJvm = projectJavaHome.version
Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ import scala.build.Logger
6
6
import scala .build .options .BuildOptions
7
7
8
8
/** The options and configurations that may be picked up on a bsp workspace/reload request.
9
+ * They don't take into account options from sources.
10
+ * The only two exceptions are the initial options in BspImpl.run
11
+ * and in options used to launch new bloop in BspImpl.reloadBsp, which have the [[bloopRifleConfig ]] updated.
9
12
*
10
13
* @param buildOptions
11
14
* passed options for building sources
Original file line number Diff line number Diff line change @@ -137,11 +137,11 @@ object Bsp extends ScalaCommand[BspOptions] {
137
137
138
138
// TODO reported override option values
139
139
// FIXME Only some options need to be unified for the whole project, like scala version, JVM
140
- val finalBuildOptions = inputsAndBuildOptions.map(_._2).reduceLeft(_ orElse _)
140
+ val combinedBuildOptions = inputsAndBuildOptions.map(_._2).reduceLeft(_ orElse _)
141
141
val inputs = inputsAndBuildOptions.map(_._1)
142
142
143
143
if (options.shared.logging.verbosity >= 3 )
144
- pprint.err.log(finalBuildOptions )
144
+ pprint.err.log(combinedBuildOptions )
145
145
146
146
/** values used for launching the bsp, especially for launching the bloop server, they do not
147
147
* include options extracted from sources, except in bloopRifleConfig - it's needed for
You can’t perform that action at this time.
0 commit comments