-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2195 from tgodzik/add-runtime
bugfix: Export runtime jars correctly from sbt
- Loading branch information
Showing
4 changed files
with
77 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
integrations/sbt-bloop/src/sbt-test/sbt-bloop/runtime-dependency/build.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import bloop.integrations.sbt.BloopDefaults | ||
|
||
name := "runtime-dependency" | ||
|
||
libraryDependencies += | ||
"ch.qos.logback" % "logback-classic" % "1.2.7" % Runtime | ||
|
||
val bloopConfigFile = settingKey[File]("Config file to test") | ||
ThisBuild / bloopConfigFile := { | ||
val bloopDir = Keys.baseDirectory.value./(".bloop") | ||
val config = bloopDir./("runtime-dependency.json") | ||
config | ||
} | ||
|
||
val bloopTestConfigFile = settingKey[File]("Test config file to test") | ||
ThisBuild / bloopTestConfigFile := { | ||
val bloopDir = Keys.baseDirectory.value./(".bloop") | ||
val config = bloopDir./("runtime-dependency-test.json") | ||
config | ||
} | ||
|
||
val checkBloopFiles = taskKey[Unit]("Check bloop file contents") | ||
ThisBuild / checkBloopFiles := { | ||
val configContents = BloopDefaults.unsafeParseConfig(bloopConfigFile.value.toPath) | ||
assert(configContents.project.platform.isDefined) | ||
val platformJvm = | ||
configContents.project.platform.get.asInstanceOf[bloop.config.Config.Platform.Jvm] | ||
val obtainedRuntimeClasspath = platformJvm.classpath.map(_.map(_.getFileName.toString)) | ||
val expectedRuntimeClasspath = Some( | ||
List( | ||
"classes", | ||
"logback-core-1.2.7.jar", | ||
"scala-library.jar", | ||
"slf4j-api-1.7.32.jar", | ||
"logback-classic-1.2.7.jar" | ||
) | ||
) | ||
assert(obtainedRuntimeClasspath == expectedRuntimeClasspath) | ||
|
||
assert(configContents.project.classpath.map(_.getFileName.toString) == List("scala-library.jar")) | ||
|
||
val configTestContents = BloopDefaults.unsafeParseConfig(bloopTestConfigFile.value.toPath) | ||
assert(configTestContents.project.platform.isDefined) | ||
val testPlatformJvm = | ||
configTestContents.project.platform.get.asInstanceOf[bloop.config.Config.Platform.Jvm] | ||
assert(testPlatformJvm.classpath.isEmpty) | ||
|
||
val obtainedTestClasspath = configTestContents.project.classpath.map(_.getFileName.toString) | ||
println(obtainedTestClasspath) | ||
val expectedTestClasspath = | ||
List( | ||
"classes", | ||
"logback-core-1.2.7.jar", | ||
"scala-library.jar", | ||
"slf4j-api-1.7.32.jar", | ||
"logback-classic-1.2.7.jar" | ||
) | ||
|
||
assert(obtainedTestClasspath == expectedTestClasspath) | ||
} |
1 change: 1 addition & 0 deletions
1
integrations/sbt-bloop/src/sbt-test/sbt-bloop/runtime-dependency/project/plugins.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % sys.props.apply("plugin.version")) |
3 changes: 3 additions & 0 deletions
3
integrations/sbt-bloop/src/sbt-test/sbt-bloop/runtime-dependency/test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
> bloopGenerate | ||
> test:bloopGenerate | ||
> checkBloopFiles |