Skip to content

Commit

Permalink
Fix tests and root cause of commons sense options passing not working
Browse files Browse the repository at this point in the history
  • Loading branch information
MaciejG604 committed Aug 20, 2024
1 parent dca08a1 commit ea0acc0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
6 changes: 5 additions & 1 deletion modules/build/src/main/scala/scala/build/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,10 @@ object Build {
else Nil
}

val moduleDeps = inputs.moduleDependencies ++ {
if (scope == Scope.Test) Seq(inputs.scopeProjectName(Scope.Main)) else Nil
}

value(validate(logger, options))

val fullClassPath = artifacts.compileClassPath ++
Expand Down Expand Up @@ -1036,7 +1040,7 @@ object Build {
scope = scope,
javaHomeOpt = Option(options.javaHomeLocation().value),
javacOptions = javacOptions,
moduleDependencies = inputs.moduleDependencies
moduleDependencies = moduleDeps
)
project
}
Expand Down
17 changes: 16 additions & 1 deletion modules/build/src/main/scala/scala/build/bsp/BspImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,22 @@ final class BspImpl(
executor
)

preBuild.thenCompose {
preBuild.thenCompose { x =>
Thread.sleep(1000)
x.foreach{ r =>
r.prebuildModules.foreach{ m =>
pprint.err.log(m.mainScope.project.projectName)
m.mainScope.sources.paths.foreach(path => pprint.err.log(os.read(path._1)))
m.mainScope.project.classPath.foreach(p => pprint.err.log(p.toString))
}
r.prebuildModules.foreach { m =>
pprint.err.log(m.testScope.project.projectName)
m.testScope.sources.paths.foreach(path => pprint.err.log(os.read(path._1)))
m.testScope.project.classPath.foreach(p => pprint.err.log(p.toString))
}
}
CompletableFuture.supplyAsync(() => x, executor)
}.thenCompose {
case Left((ex, projectName)) =>
val taskId = new b.TaskId(UUID.randomUUID().toString)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package scala.cli.integration

import ch.epfl.scala.bsp4j.{BuildTargetEvent, JvmTestEnvironmentParams, SourcesParams}
import ch.epfl.scala.bsp4j.{BuildTargetEvent, JvmTestEnvironmentParams}
import ch.epfl.scala.bsp4j as b
import com.eed3si9n.expecty.Expecty.expect
import com.google.gson.{Gson, JsonElement}

import java.net.URI
import java.nio.file.Paths
import java.util.concurrent.{ExecutorService, ScheduledExecutorService}

import scala.annotation.tailrec
import scala.async.Async.{async, await}
import scala.cli.integration.compose.ComposeBspTestDefinitions
Expand Down Expand Up @@ -778,7 +779,7 @@ abstract class BspTestDefinitions extends ScalaCliSuite with TestScalaVersionArg
}
}

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

0 comments on commit ea0acc0

Please sign in to comment.