Skip to content

Commit 0d8d01f

Browse files
committed
Fix tests and root cause of commons sense options passing not working
1 parent fa62f9a commit 0d8d01f

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

modules/build/src/main/scala/scala/build/Build.scala

+5-1
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,10 @@ object Build {
10041004
else Nil
10051005
}
10061006

1007+
val moduleDeps = inputs.moduleDependencies ++ {
1008+
if (scope == Scope.Test) Seq(inputs.scopeProjectName(Scope.Main)) else Nil
1009+
}
1010+
10071011
value(validate(logger, options))
10081012

10091013
val fullClassPath = artifacts.compileClassPath ++
@@ -1036,7 +1040,7 @@ object Build {
10361040
scope = scope,
10371041
javaHomeOpt = Option(options.javaHomeLocation().value),
10381042
javacOptions = javacOptions,
1039-
moduleDependencies = inputs.moduleDependencies
1043+
moduleDependencies = moduleDeps
10401044
)
10411045
project
10421046
}

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

+16-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,22 @@ final class BspImpl(
333333
executor
334334
)
335335

336-
preBuild.thenCompose {
336+
preBuild.thenCompose { x =>
337+
Thread.sleep(1000)
338+
x.foreach{ r =>
339+
r.prebuildModules.foreach{ m =>
340+
pprint.err.log(m.mainScope.project.projectName)
341+
m.mainScope.sources.paths.foreach(path => pprint.err.log(os.read(path._1)))
342+
m.mainScope.project.classPath.foreach(p => pprint.err.log(p.toString))
343+
}
344+
r.prebuildModules.foreach { m =>
345+
pprint.err.log(m.testScope.project.projectName)
346+
m.testScope.sources.paths.foreach(path => pprint.err.log(os.read(path._1)))
347+
m.testScope.project.classPath.foreach(p => pprint.err.log(p.toString))
348+
}
349+
}
350+
CompletableFuture.supplyAsync(() => x, executor)
351+
}.thenCompose {
337352
case Left((ex, projectName)) =>
338353
val taskId = new b.TaskId(UUID.randomUUID().toString)
339354

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package scala.cli.integration
22

3-
import ch.epfl.scala.bsp4j.{BuildTargetEvent, JvmTestEnvironmentParams, SourcesParams}
3+
import ch.epfl.scala.bsp4j.{BuildTargetEvent, JvmTestEnvironmentParams}
44
import ch.epfl.scala.bsp4j as b
55
import com.eed3si9n.expecty.Expecty.expect
66
import com.google.gson.{Gson, JsonElement}
77

88
import java.net.URI
99
import java.nio.file.Paths
1010
import java.util.concurrent.{ExecutorService, ScheduledExecutorService}
11+
1112
import scala.annotation.tailrec
1213
import scala.async.Async.{async, await}
1314
import scala.cli.integration.compose.ComposeBspTestDefinitions
@@ -778,7 +779,7 @@ abstract class BspTestDefinitions extends ScalaCliSuite with TestScalaVersionArg
778779
}
779780
}
780781

781-
test("tes scope uses artifacts from main scope") {
782+
test("test workspace update after adding file to main scope") {
782783
val inputs = TestInputs(
783784
os.rel / "Messages.scala" ->
784785
"""//> using dep "com.lihaoyi::os-lib:0.7.8"

0 commit comments

Comments
 (0)