Skip to content

Commit

Permalink
improvement: Respect bspEnabled when generating bloop config files
Browse files Browse the repository at this point in the history
  • Loading branch information
tgodzik committed Sep 18, 2024
1 parent c6118de commit 04a16c6
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ object BloopDefaults {
BloopKeys.bloopProductDirectories := List(BloopKeys.bloopClassDirectory.value),
BloopKeys.bloopClassDirectory := generateBloopProductDirectories.value,
BloopKeys.bloopInternalClasspath := bloopInternalDependencyClasspath.value,
BloopKeys.bloopGenerate := bloopGenerate.value,
BloopKeys.bloopGenerate := {
if (Keys.bspEnabled.value) bloopGenerate.value else Value(None)
},
BloopKeys.bloopPostGenerate := bloopPostGenerate.value,
BloopKeys.bloopMainClass := None,
BloopKeys.bloopMainClass in Keys.run := BloopKeys.bloopMainClass.value
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
trait BarTest
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
val foo = project
.in(file(".") / "foo")

val bar = project
.in(file(".") / "bar")
.settings(
bspEnabled := false
)
.dependsOn(foo)

val checkBloopFiles = taskKey[Unit]("Check bloop file contents")
checkBloopFiles in ThisBuild := {
import java.nio.file.Files
val bloopDir = Keys.baseDirectory.value./(".bloop")
val fooConfig = bloopDir./("foo.json")
val barConfig = bloopDir./("bar.json")
val barTestConfig = bloopDir./("bar-test.json")
val fooTestConfig = bloopDir./("foo-test.json")

assert(Files.exists(fooConfig.toPath))
assert(Files.exists(fooTestConfig.toPath))
assert(!Files.exists(barConfig.toPath))
assert(!Files.exists(barTestConfig.toPath))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
class Foo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % sys.props.apply("plugin.version"))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
> bloopInstall
> checkBloopFiles
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ object Dependencies {
val Scala212Version = "2.12.20"
val Scala213Version = "2.13.14"

val SbtVersion = "1.3.3"
val SbtVersion = "1.5.8"

// Keep in sync in BloopComponentCompiler
val zincVersion = "1.10.2"
Expand Down

0 comments on commit 04a16c6

Please sign in to comment.