@@ -25,6 +25,15 @@ object BloopIntegrationSpec extends TestSuite[Unit] {
25
25
override def setup (): Unit = ()
26
26
override def tearDown (env : Unit ): Unit = ()
27
27
28
+ def readBloopJson (path : Path ): bloop.config.Config .File = {
29
+ val content = FileUtils .readFileToString(path.toFile, " UTF-8" )
30
+
31
+ import io .circe .parser ._
32
+ decode[bloop.config.Config .File ](content)(
33
+ ConfigEncoderDecoders .allDecoder
34
+ ).right.get
35
+ }
36
+
28
37
def compileAndRun (projectPath : Path ) = {
29
38
def compile =
30
39
TestProcessHelper .runBloop(projectPath)(" compile" , " example" ).map { x =>
@@ -47,7 +56,7 @@ object BloopIntegrationSpec extends TestSuite[Unit] {
47
56
compileAndRun(projectPath)
48
57
}
49
58
50
- testAsync(" Build project with compiler plug-in" ) { _ =>
59
+ testAsync(" Build project with compiler plug-in defined on cross-platform module " ) { _ =>
51
60
val BuildConfig .Result (build, projectPath, _) = BuildConfig .load(
52
61
Paths .get(" test/example-paradise" ), Log .urgent).get
53
62
val buildPath = projectPath.resolve(" build" )
@@ -59,6 +68,58 @@ object BloopIntegrationSpec extends TestSuite[Unit] {
59
68
compileAndRun(projectPath)
60
69
}
61
70
71
+ testAsync(" Build project with compiler plug-in defined on platform modules" ) { _ =>
72
+ val BuildConfig .Result (build, projectPath, _) = BuildConfig .load(
73
+ Paths .get(" test/example-paradise-platform" ), Log .urgent).get
74
+ val buildPath = projectPath.resolve(" build" )
75
+ if (Files .exists(buildPath)) FileUtils .deleteDirectory(buildPath.toFile)
76
+ val packageConfig = PackageConfig (tmpfs = false , silent = false ,
77
+ ivyPath = None , cachePath = None )
78
+ cli.Generate .ui(Config (), projectPath, build, Command .Bloop (packageConfig),
79
+ Log .urgent)
80
+ compileAndRun(projectPath)
81
+ }
82
+
83
+ testAsync(" Build project with overridden compiler plug-in version" ) { _ =>
84
+ val projectPath = Paths .get(" test/example-paradise-versions" )
85
+ val BuildConfig .Result (build, _, _) =
86
+ BuildConfig .load(projectPath, Log .urgent).get
87
+ val buildPath = projectPath.resolve(" build" )
88
+ if (Files .exists(buildPath)) FileUtils .deleteDirectory(buildPath.toFile)
89
+ val packageConfig = PackageConfig (tmpfs = false , silent = false ,
90
+ ivyPath = None , cachePath = None )
91
+ cli.Generate .ui(Config (), projectPath, build, Command .Bloop (packageConfig),
92
+ Log .urgent)
93
+
94
+ val bloopPath = projectPath.resolve(" .bloop" )
95
+
96
+ val macrosJvm = readBloopJson(bloopPath.resolve(" macros-jvm.json" ))
97
+ val macrosJs = readBloopJson(bloopPath.resolve(" macros-js.json" ))
98
+ val exampleJvm = readBloopJson(bloopPath.resolve(" example-jvm.json" ))
99
+ val exampleJs = readBloopJson(bloopPath.resolve(" example-js.json" ))
100
+
101
+ def getFileName (path : String ): String = path.drop(path.lastIndexOf('/' ) + 1 )
102
+
103
+ assertEquals(
104
+ macrosJvm.project.scala.get.options.filter(_.contains(" paradise" ))
105
+ .map(getFileName),
106
+ List (" paradise_2.11.12-2.1.0.jar" ))
107
+ assertEquals(
108
+ macrosJs.project.scala.get.options.filter(_.contains(" paradise" ))
109
+ .map(getFileName),
110
+ List (" paradise_2.11.12-2.1.1.jar" ))
111
+ assertEquals(
112
+ exampleJvm.project.scala.get.options.filter(_.contains(" paradise" ))
113
+ .map(getFileName),
114
+ List (" paradise_2.11.12-2.1.0.jar" ))
115
+ assertEquals(
116
+ exampleJs.project.scala.get.options.filter(_.contains(" paradise" ))
117
+ .map(getFileName),
118
+ List (" paradise_2.11.12-2.1.1.jar" ))
119
+
120
+ compileAndRun(projectPath)
121
+ }
122
+
62
123
testAsync(" Build modules with different Scala versions" ) { _ =>
63
124
val BuildConfig .Result (build, projectPath, _) = BuildConfig .load(
64
125
Paths .get(" test/multiple-scala-versions" ), Log .urgent).get
@@ -120,12 +181,7 @@ object BloopIntegrationSpec extends TestSuite[Unit] {
120
181
testAsync(" Build project with custom command target" ) { _ =>
121
182
buildCustomTarget(" custom-command-target" ).map { _ =>
122
183
val path = Paths .get(s " test/custom-command-target/.bloop/demo.json " )
123
- val content = FileUtils .readFileToString(path.toFile, " UTF-8" )
124
-
125
- import io .circe .parser ._
126
- val result = decode[bloop.config.Config .File ](content)(
127
- ConfigEncoderDecoders .allDecoder
128
- ).right.get
184
+ val result = readBloopJson(path)
129
185
130
186
// Should not include "utils" dependency since it does not have any
131
187
// Scala sources and no Bloop module.
0 commit comments