Skip to content

Commit 4cb92ac

Browse files
authored
Use artifacts from main scope in tests (#430)
1 parent 2bd6603 commit 4cb92ac

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

modules/build/src/main/scala/scala/build/bsp/BspImpl.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ final class BspImpl(
7575
pprint.stderr.log(sourcesMain)
7676

7777
val options0Main = sourcesMain.buildOptions
78-
val options0Test = sourcesTest.buildOptions
78+
val options0Test = sourcesTest.buildOptions.orElse(options0Main)
7979

8080
val generatedSourcesMain = sourcesMain.generateSources(inputs.generatedSrcRoot(Scope.Main))
8181
val generatedSourcesTest = sourcesTest.generateSources(inputs.generatedSrcRoot(Scope.Test))

modules/integration/src/test/scala/scala/cli/integration/BspTestDefinitions.scala

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,8 @@ abstract class BspTestDefinitions(val scalaVersionOpt: Option[String])
772772
val inputs = TestInputs(
773773
Seq(
774774
os.rel / "Messages.scala" ->
775-
"""object Messages {
775+
"""// using lib "com.lihaoyi::os-lib:0.7.8"
776+
|object Messages {
776777
| def msg = "Hello"
777778
|}
778779
|""".stripMargin,
@@ -826,12 +827,18 @@ abstract class BspTestDefinitions(val scalaVersionOpt: Option[String])
826827
uri.drop(idx + 1)
827828
}
828829

829-
if (actualScalaVersion.startsWith("2.13"))
830+
if (actualScalaVersion.startsWith("2.13")) {
830831
expect(foundDepSources.exists(_.startsWith("utest_2.13-0.7.10")))
831-
else if (actualScalaVersion.startsWith("2.12"))
832+
expect(foundDepSources.exists(_.startsWith("os-lib_2.13-0.7.8")))
833+
}
834+
else if (actualScalaVersion.startsWith("2.12")) {
832835
expect(foundDepSources.exists(_.startsWith("utest_2.12-0.7.10")))
833-
else
836+
expect(foundDepSources.exists(_.startsWith("os-lib_2.12-0.7.8")))
837+
}
838+
else {
834839
expect(foundDepSources.exists(_.startsWith("utest_3-0.7.10")))
840+
expect(foundDepSources.exists(_.startsWith("os-lib_3-0.7.8")))
841+
}
835842

836843
expect(foundDepSources.exists(_.startsWith("test-interface-1.0")))
837844
expect(foundDepSources.forall(_.endsWith("-sources.jar")))

0 commit comments

Comments
 (0)