Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: scalacenter/bloop
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.5.8
Choose a base ref
...
head repository: scalacenter/bloop
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.5.9
Choose a head ref

Commits on Jul 6, 2023

  1. Copy the full SHA
    476a080 View commit details
  2. Merge pull request #2103 from scalacenter/update/scalafmt-core-3.7.7

    build(deps): Update scalafmt-core from 3.7.6 to 3.7.7
    ckipp01 authored Jul 6, 2023
    Copy the full SHA
    57843c0 View commit details
  3. bugfix: Don't deduplicate all options when using Metals

    PReviously, we would use `.distinct` on all project scalac options which would remove values for different options if the happened to be the same. Now, we only deduplicate semanticdb options.
    
    Fixes scalameta/metals#5400
    tgodzik committed Jul 6, 2023
    Copy the full SHA
    f23a861 View commit details
  4. Merge pull request #2104 from tgodzik/fix-dedup

    bugfix: Don't deduplicate all options when using Metals
    tgodzik authored Jul 6, 2023
    Copy the full SHA
    b870185 View commit details
  5. improvement: Send debug logs to BSP client

    Previously, we would only print the logs when using Bloop from CLI
    tgodzik committed Jul 6, 2023
    Copy the full SHA
    a0b6313 View commit details

Commits on Jul 7, 2023

  1. Copy the full SHA
    837551a View commit details
  2. Merge pull request #2106 from scalacenter/update/sbt-scalajs-crosspro…

    …ject-1.3.2
    
    build(deps): Update sbt-scalajs-crossproject from 1.3.1 to 1.3.2
    ckipp01 authored Jul 7, 2023
    Copy the full SHA
    71b0409 View commit details
  3. Copy the full SHA
    eed9bf0 View commit details
  4. Merge pull request #2105 from tgodzik/print-verbose

    improvement: Send debug logs to BSP client
    tgodzik authored Jul 7, 2023
    Copy the full SHA
    6431f46 View commit details
  5. bugfix: Don't try to discover test frameworks if none exist

    Previously, even if node_modules wouldn't exist we would run test discovery, which requires the node_modules and the scripts it contains. Now, we show an error in such a case. This seems to have hanged the node process causing no tests to be discovered.
    
    I am not sure how to properly test it yet, but I need to dig into the JS part at some point since from earlier discussions with Sebastien the bridges might be problematic.
    tgodzik committed Jul 7, 2023
    Copy the full SHA
    4b3d2ec View commit details

Commits on Jul 10, 2023

  1. refactor(test): bump maxDuration in js tests

    This is consistently failing with messages like:
    
    ```
    [error] Test bloop.scalajs.ScalaJsToolchainSpec.canLinkScalaJsProject failed: java.util.concurrent.TimeoutException: Futures timed out after [45 seconds], took 46.973 sec
    ```
    
    My naive hope is that just bumping this might make this test less flaky.
    ckipp01 committed Jul 10, 2023
    Copy the full SHA
    34f8ca9 View commit details
  2. Merge pull request #1981 from ckipp01/bumpTIme

    refactor(test): bump maxDuration in js tests
    ckipp01 authored Jul 10, 2023
    Copy the full SHA
    0cef362 View commit details
  3. Merge pull request #2107 from tgodzik/dont-run

    bugfix: Don't try to discover test frameworks if none exist
    tgodzik authored Jul 10, 2023
    Copy the full SHA
    8ccc721 View commit details

Commits on Jul 11, 2023

  1. Copy the full SHA
    9d7105e View commit details
  2. Copy the full SHA
    63b76aa View commit details
  3. Merge pull request #2110 from scalacenter/update/scalafmt-core-3.7.8

    build(deps): Update scalafmt-core from 3.7.7 to 3.7.8
    ckipp01 authored Jul 11, 2023
    Copy the full SHA
    a8b0412 View commit details
  4. chore(deps): bump semver from 5.7.1 to 5.7.2 in /website

    Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2.
    - [Release notes](https://github.com/npm/node-semver/releases)
    - [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md)
    - [Commits](npm/node-semver@v5.7.1...v5.7.2)
    
    ---
    updated-dependencies:
    - dependency-name: semver
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jul 11, 2023
    Copy the full SHA
    e3a7311 View commit details
  5. Merge pull request #2111 from scalacenter/dependabot/npm_and_yarn/web…

    …site/semver-5.7.2
    
    chore(deps): bump semver from 5.7.1 to 5.7.2 in /website
    tgodzik authored Jul 11, 2023
    Copy the full SHA
    0398ca2 View commit details
  6. Merge pull request #2109 from scalacenter/update/sbt-1.9.2

    build(deps): Update sbt, test-agent from 1.9.1 to 1.9.2
    tgodzik authored Jul 11, 2023
    Copy the full SHA
    baf7eac View commit details

Commits on Jul 12, 2023

  1. bugfix: Handle NoClassDefFoundError coming from the compiler

    It seems due to some incremental compilation errors (possibly), an exception can be thrown from inlining and if we don't handle it, we will never finish the compilation:
    
    ```
    java.lang.NoClassDefFoundError: besom/internal/Context
        at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
        at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402)
        at java.base/java.lang.Class.getMethodsRecursive(Class.java:3543)
        at java.base/java.lang.Class.getMethod0(Class.java:3529)
        at java.base/java.lang.Class.getMethod(Class.java:2225)
        at dotty.tools.dotc.quoted.Interpreter.getMethod(Interpreter.scala:221)
        at dotty.tools.dotc.quoted.Interpreter.interpretedStaticMethodCall(Interpreter.scala:173)
        at dotty.tools.dotc.quoted.Interpreter.interpretTree(Interpreter.scala:76)
        at dotty.tools.dotc.transform.Splicer$SpliceInterpreter.interpretTree(Splicer.scala:247)
        at dotty.tools.dotc.quoted.Interpreter.interpretTree$$anonfun$2(Interpreter.scala:95)
        at dotty.tools.dotc.transform.Splicer$.$anonfun$2(Splicer.scala:60)
        at scala.Option.fold(Option.scala:263)
        at dotty.tools.dotc.transform.Splicer$.splice(Splicer.scala:60)
        at dotty.tools.dotc.inlines.Inliner.dotty$tools$dotc$inlines$Inliner$$expandMacro(Inliner.scala:1042)
        at dotty.tools.dotc.inlines.Inliner$InlineTyper.typedApply(Inliner.scala:818)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2928)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2991)
        at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:126)
        at dotty.tools.dotc.inlines.Inliner$InlineTyper.typedUnadapted(Inliner.scala:904)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3058)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3062)
        at dotty.tools.dotc.typer.ReTyper.typedTyped(ReTyper.scala:64)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2933)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2991)
        at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:126)
        at dotty.tools.dotc.inlines.Inliner$InlineTyper.typedUnadapted(Inliner.scala:904)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3058)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3055)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3062)
        at dotty.tools.dotc.inlines.Inliner.inlined(Inliner.scala:671)
        at dotty.tools.dotc.inlines.Inlines$InlineCall.expand(Inlines.scala:444)
        at dotty.tools.dotc.inlines.Inlines$.inlineCall(Inlines.scala:151)
        at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:99)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1478)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:73)
        at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:93)
        at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.loop$2(tpd.scala:1228)
        at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformStats(tpd.scala:1228)
        at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformStats(tpd.scala:1230)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:64)
        at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:115)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1483)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:73)
        at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:93)
        at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.loop$2(tpd.scala:1228)
        at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformStats(tpd.scala:1228)
        at dotty.tools.dotc.ast.tpd$TreeMapWithPreciseStatContexts.transformStats(tpd.scala:1230)
        at dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1491)
        at dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:73)
        at dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:105)
        at dotty.tools.dotc.transform.Inlining$$anon$2.transform(Inlining.scala:62)
        at dotty.tools.dotc.transform.MacroTransform.run(MacroTransform.scala:18)
        at dotty.tools.dotc.transform.Inlining.run(Inlining.scala:34)
        at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:324)
        at scala.collection.immutable.List.map(List.scala:250)
        at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:328)
        at dotty.tools.dotc.transform.Inlining.runOn(Inlining.scala:38)
        at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:247)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321)
        at dotty.tools.dotc.Run.runPhases$1(Run.scala:263)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:271)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:280)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:280)
        at dotty.tools.dotc.Run.compileSources(Run.scala:195)
        at dotty.tools.dotc.Run.compile(Run.scala:179)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
        at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88)
        at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
        at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
        at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.compileSources$1(BloopHighLevelCompiler.scala:133)
        at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$7(BloopHighLevelCompiler.scala:155)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$1(BloopHighLevelCompiler.scala:71)
        at bloop.tracing.BraveTracer.traceInternal(BraveTracer.scala:67)
        at bloop.tracing.BraveTracer.trace(BraveTracer.scala:41)
        at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.timed$1(BloopHighLevelCompiler.scala:70)
        at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$6(BloopHighLevelCompiler.scala:155)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at monix.eval.internal.TaskRunLoop$.startFull(TaskRunLoop.scala:81)
        at monix.eval.internal.TaskRestartCallback.syncOnSuccess(TaskRestartCallback.scala:101)
        at monix.eval.internal.TaskRestartCallback.onSuccess(TaskRestartCallback.scala:74)
        at monix.eval.internal.TaskExecuteOn$AsyncRegister$$anon$1.run(TaskExecuteOn.scala:71)
        at monix.execution.internal.InterceptRunnable.run(InterceptRunnable.scala:27)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
    Caused by: java.lang.ClassNotFoundException: besom.internal.Context
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:440)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
        ... 89 more
    ```
    tgodzik committed Jul 12, 2023
    Copy the full SHA
    7fb8124 View commit details
  2. improvement: Don't fail during copying

    This might cause the compiler to never work again until restart. It seems that the reason might be that one of the files is locked, but this is highly difficult to reproduce.
    
    Connected to #1989
    tgodzik committed Jul 12, 2023
    Copy the full SHA
    d2ee258 View commit details

Commits on Jul 13, 2023

  1. Copy the full SHA
    72c3d2b View commit details
  2. Merge pull request #2116 from scalacenter/update/scalafmt-core-3.7.9

    build(deps): Update scalafmt-core from 3.7.8 to 3.7.9
    ckipp01 authored Jul 13, 2023
    Copy the full SHA
    a86a9d9 View commit details
  3. Merge pull request #2115 from tgodzik/dont-fail-while-copying

    improvement: Don't fail during copying
    tgodzik authored Jul 13, 2023
    Copy the full SHA
    67c68be View commit details
  4. Merge pull request #2114 from tgodzik/handle-no-class-def

    bugfix: Handle NoClassDefFoundError coming from the compiler
    tgodzik authored Jul 13, 2023
    Copy the full SHA
    fb7ebf5 View commit details

Commits on Jul 17, 2023

  1. Copy the full SHA
    f3b7092 View commit details
  2. Merge pull request #2117 from scalacenter/update/scalafmt-core-3.7.10

    build(deps): Update scalafmt-core from 3.7.9 to 3.7.10
    ckipp01 authored Jul 17, 2023
    Copy the full SHA
    0344ffc View commit details
  3. Copy the full SHA
    260a460 View commit details
  4. Merge pull request #2119 from tgodzik/update-scalafmt

    chore: Update scalafmt bostrap
    tgodzik authored Jul 17, 2023
    Copy the full SHA
    786e1c9 View commit details
  5. chore: Add release notes and fix release process

    Not sure if it possible that mv semantics changed, but locally this needs the additional directory in the path.
    
    The failure is here https://github.com/scalacenter/bloop/actions/runs/5466710338/jobs/9953460172
    tgodzik committed Jul 17, 2023
    Copy the full SHA
    5ece56f View commit details
  6. Merge pull request #2120 from tgodzik/release-notes-1.5.9

    chore: Add release notes and fix release process
    tgodzik authored Jul 17, 2023
    Copy the full SHA
    2fe11bf View commit details
Showing with 198 additions and 57 deletions.
  1. +1 −1 .scalafmt.conf
  2. +4 −2 backend/src/main/scala/bloop/BloopClassFileManager.scala
  3. +2 −1 backend/src/main/scala/bloop/Compiler.scala
  4. +11 −2 backend/src/main/scala/bloop/io/ParallelOps.scala
  5. +4 −0 backend/src/main/scala/sbt/internal/inc/bloop/internal/BloopHighLevelCompiler.scala
  6. BIN bin/scalafmt
  7. +26 −19 bridges/scalajs-1/src/main/scala/bloop/scalajs/JsBridge.scala
  8. +5 −1 bridges/scalajs-1/src/main/scala/bloop/scalajs/jsenv/NodeJsEnv.scala
  9. +1 −1 bridges/scalajs-1/src/test/scala/bloop/scalajs/ScalaJsToolchainSpec.scala
  10. +3 −3 frontend/src/main/scala/bloop/data/Project.scala
  11. +2 −1 frontend/src/main/scala/bloop/engine/tasks/CompileTask.scala
  12. +23 −2 frontend/src/main/scala/bloop/logging/BspServerLogger.scala
  13. +1 −1 frontend/src/test/resources/compiler-plugin-allowlist/project/build.properties
  14. +1 −1 frontend/src/test/resources/cross-test-build-scala-native-0.4/project/build.properties
  15. +1 −1 frontend/src/test/resources/cross-test-build-scalajs-0.6/project/build.properties
  16. +1 −1 frontend/src/test/resources/cross-test-build-scalajs-1.0/project/build.properties
  17. +1 −1 frontend/src/test/resources/cross-test-build-scalajs-1.x/project/build.properties
  18. +1 −1 frontend/src/test/resources/cross-test-build-scalajs-1.x/project/plugins.sbt
  19. +1 −1 frontend/src/test/resources/custom-test-framework/project/build.properties
  20. +1 −1 frontend/src/test/resources/no-test-frameworks/project/project/build.properties
  21. +1 −1 frontend/src/test/resources/scala-seed-project/project/build.properties
  22. +1 −1 frontend/src/test/resources/simple-build/project/build.properties
  23. +3 −1 frontend/src/test/scala/bloop/bsp/BspCompileSpec.scala
  24. +3 −1 frontend/src/test/scala/bloop/bsp/BspConnectionSpec.scala
  25. +35 −1 frontend/src/test/scala/bloop/bsp/BspMetalsClientSpec.scala
  26. +5 −2 frontend/src/test/scala/bloop/testing/BloopHelpers.scala
  27. +48 −0 notes/v1.5.9.md
  28. +6 −3 project/BuildPlugin.scala
  29. +1 −1 project/Dependencies.scala
  30. +1 −1 project/build.properties
  31. +1 −1 project/build.sbt
  32. +3 −3 website/yarn.lock
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.7.6"
version = "3.7.10"
runner.dialect = scala213
maxColumn = 100
docstrings.style = Asterisk
6 changes: 4 additions & 2 deletions backend/src/main/scala/bloop/BloopClassFileManager.scala
Original file line number Diff line number Diff line change
@@ -221,7 +221,8 @@ final class BloopClassFileManager(
newClassesDir,
clientExternalClassesDir.underlying,
inputs.ioScheduler,
enableCancellation = false
enableCancellation = false,
inputs.logger
)
.map { walked =>
readOnlyCopyDenylist.++=(walked.target)
@@ -279,7 +280,8 @@ final class BloopClassFileManager(
Paths.get(readOnlyClassesDirPath),
clientExternalClassesDir.underlying,
inputs.ioScheduler,
enableCancellation = false
enableCancellation = false,
inputs.logger
)
.map(_ => ())
}
3 changes: 2 additions & 1 deletion backend/src/main/scala/bloop/Compiler.scala
Original file line number Diff line number Diff line change
@@ -434,7 +434,8 @@ object Compiler {
readOnlyClassesDir,
clientClassesDir.underlying,
compileInputs.ioScheduler,
enableCancellation = false
enableCancellation = false,
compileInputs.logger
)

lastCopy.map { _ =>
13 changes: 11 additions & 2 deletions backend/src/main/scala/bloop/io/ParallelOps.scala
Original file line number Diff line number Diff line change
@@ -22,6 +22,8 @@ import monix.execution.cancelables.CompositeCancelable
import monix.reactive.Consumer
import monix.reactive.MulticastStrategy
import monix.reactive.Observable
import bloop.logging.Logger
import scala.util.control.NonFatal

object ParallelOps {

@@ -67,7 +69,8 @@ object ParallelOps {
origin: Path,
target: Path,
scheduler: Scheduler,
enableCancellation: Boolean
enableCancellation: Boolean,
logger: Logger
): Task[FileWalk] = Task.defer {
val isCancelled = AtomicBoolean(false)

@@ -152,7 +155,7 @@ object ParallelOps {

val copyFileSequentially = Consumer.foreachTask[((Path, BasicFileAttributes), Path)] {
case ((originFile, originAttrs), targetFile) =>
def copy(replaceExisting: Boolean): Unit = {
def copy(replaceExisting: Boolean): Unit = try {
if (replaceExisting) {
Files.copy(
originFile,
@@ -168,6 +171,12 @@ object ParallelOps {
)
}
()
} catch {
case NonFatal(t) =>
logger.report(
s"Unexpected error when copying $originFile to $targetFile, you might need to restart the build server.",
t
)
}

// It's important that this task is not forked for performance reasons
Original file line number Diff line number Diff line change
@@ -137,6 +137,10 @@ final class BloopHighLevelCompiler(
val msg = "Encountered a StackOverflowError coming from the compiler. You might need to restart your Bloop build server"
logger.error(s"${msg}:\n${t.getStackTrace().mkString("\n")}")
throw new CompileFailed(new Array(0), msg, new Array(0), t)
case t: NoClassDefFoundError =>
val msg = "Encountered a NoClassDefFoundError coming from the compiler. You might need to clean compile your workspace"
logger.error(s"${msg}:\n${t.getStackTrace().mkString("\n")}")
throw new CompileFailed(new Array(0), msg, new Array(0), t)
case NonFatal(t) =>
// If scala compilation happens, complete the java promise so that it doesn't block
JavaCompleted.tryFailure(t)
Binary file modified bin/scalafmt
Binary file not shown.
45 changes: 26 additions & 19 deletions bridges/scalajs-1/src/main/scala/bloop/scalajs/JsBridge.scala
Original file line number Diff line number Diff line change
@@ -147,25 +147,32 @@ object JsBridge {
env: Map[String, String]
): (List[sbt.testing.Framework], () => Unit) = {
implicit val debugFilter: DebugFilter = DebugFilter.Test
val nodeModules = baseDirectory.resolve("node_modules").toString
logger.debug("Node.js module path: " + nodeModules)
val fullEnv = Map("NODE_PATH" -> nodeModules) ++ env
val config =
NodeJSConfig().withExecutable(nodePath).withCwd(Some(baseDirectory)).withEnv(fullEnv)
val nodeEnv =
if (!jsConfig.jsdom.contains(true)) new NodeJSEnv(logger, config)
else new JsDomNodeJsEnv(logger, config)

// The order of the scripts mandates the load order in the JavaScript runtime
val input = jsConfig.kind match {
case ModuleKindJS.NoModule => Input.Script(jsPath)
case ModuleKindJS.CommonJSModule => Input.CommonJSModule(jsPath)
case ModuleKindJS.ESModule => Input.ESModule(jsPath)
}
val nodeModules = baseDirectory.resolve("node_modules")
if (nodeModules.toFile().exists()) {
logger.debug("Node.js module path: " + nodeModules.toString())
val fullEnv = Map("NODE_PATH" -> nodeModules.toString()) ++ env
val config =
NodeJSConfig().withExecutable(nodePath).withCwd(Some(baseDirectory)).withEnv(fullEnv)
val nodeEnv =
if (!jsConfig.jsdom.contains(true)) new NodeJSEnv(logger, config)
else new JsDomNodeJsEnv(logger, config)

// The order of the scripts mandates the load order in the JavaScript runtime
val input = jsConfig.kind match {
case ModuleKindJS.NoModule => Input.Script(jsPath)
case ModuleKindJS.CommonJSModule => Input.CommonJSModule(jsPath)
case ModuleKindJS.ESModule => Input.ESModule(jsPath)
}

val testConfig = TestAdapter.Config().withLogger(new Logger(logger))
val adapter = new TestAdapter(nodeEnv, Seq(input), testConfig)
val result = adapter.loadFrameworks(frameworkNames).flatMap(_.toList)
(result, () => adapter.close())
val testConfig = TestAdapter.Config().withLogger(new Logger(logger))
val adapter = new TestAdapter(nodeEnv, Seq(input), testConfig)
val result = adapter.loadFrameworks(frameworkNames).flatMap(_.toList)
(result, () => adapter.close())
} else {
logger.error(
s"Cannot discover test frameworks, missing node_modules in test project, expected them at $nodeModules"
)
(Nil, () => ())
}
}
}
Original file line number Diff line number Diff line change
@@ -124,6 +124,7 @@ final class NodeJSEnv(logger: Logger, config: NodeJSConfig) extends JSEnv {
}

private def internalStart(input: Seq[Input], runConfig: RunConfig): JSRun = {
runConfig.logger.debug("Using input file: " + (input.mkString(",")))
NodeJSEnv.internalStart(logger, config, env)(NodeJSEnv.write(input), runConfig)
}

@@ -290,7 +291,10 @@ object NodeJSEnv {
import scala.concurrent.ExecutionContext.Implicits.global

private val isClosed = AtomicBoolean(false)
override def future: Future[Unit] = cancellable.map(_ => ())
override def future: Future[Unit] = cancellable.map { results =>
logger.debug(s"Finished with results: ${results}")
()
}
override def close(): Unit = {
// Make sure we only destroy the process once, the test adapter can call this several times!
if (!isClosed.getAndSet(true)) {
Original file line number Diff line number Diff line change
@@ -69,7 +69,7 @@ class ScalaJsToolchainSpec {
logger.getMessages.assertContain("Hello, world!", atLevel = "info")
}

private final val maxDuration = Duration.apply(45, TimeUnit.SECONDS)
private final val maxDuration = Duration.apply(60, TimeUnit.SECONDS)
private implicit class RichLogs(logs: List[(String, String)]) {
def assertContain(needle: String, atLevel: String): Unit = {
def failMessage: String =
6 changes: 3 additions & 3 deletions frontend/src/main/scala/bloop/data/Project.scala
Original file line number Diff line number Diff line change
@@ -454,10 +454,10 @@ object Project {
// engine so that semanticdb files are replicated in those directories
val hasSemanticDB = hasScalaSemanticDBEnabledInCompilerOptions(options)
val pluginOption = if (hasSemanticDB) Nil else List(s"-Xplugin:$pluginPath")
val baseOptions = s"-P:semanticdb:sourceroot:$workspaceDir" :: options.filterNot(
isScalaSemanticdbSourceRoot
val baseOptions = s"-P:semanticdb:sourceroot:$workspaceDir" :: options.filterNot(opt =>
isScalaSemanticdbSourceRoot(opt) || baseSemanticdbOptions.contains(opt)
)
(baseOptions ++ baseSemanticdbOptions ++ pluginOption).distinct
baseOptions ++ baseSemanticdbOptions ++ pluginOption
}

def enableDottySemanticdb(options: List[String]) = {
3 changes: 2 additions & 1 deletion frontend/src/main/scala/bloop/engine/tasks/CompileTask.scala
Original file line number Diff line number Diff line change
@@ -363,7 +363,8 @@ object CompileTask {
products.readOnlyClassesDir,
products.newClassesDir,
ExecutionContext.ioScheduler,
enableCancellation = false
enableCancellation = false,
logger
)
}

25 changes: 23 additions & 2 deletions frontend/src/main/scala/bloop/logging/BspServerLogger.scala
Original file line number Diff line number Diff line change
@@ -53,11 +53,32 @@ final class BspServerLogger private (

override def ansiCodesSupported: Boolean = ansiSupported || underlying.ansiCodesSupported()

override private[logging] def printDebug(msg: String): Unit = underlying.printDebug(msg)
override private[logging] def printDebug(msg: String): Unit = {
if (isVerbose)
client.notify(
Build.logMessage,
bsp.LogMessageParams(bsp.MessageType.Log, None, originId, msg)
)
underlying.printDebug(msg)

}
override def debug(msg: String)(implicit ctx: DebugFilter): Unit =
if (debugFilter.isEnabledFor(ctx)) printDebug(msg)

override def trace(t: Throwable): Unit = underlying.trace(t)
override def trace(t: Throwable): Unit = {
if (isVerbose) {
def msg(t: Throwable): String = {
val base = t.getMessage() + "\n" + t.getStackTrace().mkString("\n\t")
if (t.getCause() == null) base
else base + "\nCaused by: " + msg(t.getCause())
}
client.notify(
Build.logMessage,
bsp.LogMessageParams(bsp.MessageType.Log, None, originId, msg(t))
)
}
underlying.trace(t)
}

override def error(msg: String): Unit = {
client.notify(
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sbt.version=1.9.1
sbt.version=1.9.2

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sbt.version=1.9.1
sbt.version=1.9.2

Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.1
sbt.version=1.9.2
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.1
sbt.version=1.9.2
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.1
sbt.version=1.9.2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.1")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.1")

val pluginVersion = sys.props.getOrElse(
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.1
sbt.version=1.9.2
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.1
sbt.version=1.9.2
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.1
sbt.version=1.9.2
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.1
sbt.version=1.9.2
4 changes: 3 additions & 1 deletion frontend/src/test/scala/bloop/bsp/BspCompileSpec.scala
Original file line number Diff line number Diff line change
@@ -36,7 +36,9 @@ class BspCompileSpec(
assertExitStatus(state, ExitStatus.Ok)
}
}
val contentLogs = logger.debugs.flatMap(_.split("\n")).filter(_.startsWith(" --> content:"))
val contentLogs = logger.debugs
.flatMap(_.split("\n"))
.filter(msg => msg.startsWith(" --> content:") && !msg.contains("logMessage"))
val allButInitializeRequest = contentLogs.filterNot(_.contains("""build/initialize""""))
// Filter out the initialize request that contains platform-specific details
assertNoDiff(
4 changes: 3 additions & 1 deletion frontend/src/test/scala/bloop/bsp/BspConnectionSpec.scala
Original file line number Diff line number Diff line change
@@ -90,7 +90,9 @@ class BspConnectionSpec(
def checkConnectionIsInitialized(logger: RecordingLogger): Unit = {
val contentLogs = logger.debugs.flatMap(_.split("\n")).filter(_.startsWith(" --> content:"))
// Filter out the initialize request that contains platform-specific details
val allButInitializeRequest = contentLogs.filterNot(_.contains("""build/initialize""""))
val allButInitializeRequest = contentLogs.filterNot(msg =>
msg.contains("""build/initialize"""") || msg.contains("logMessage")
)
assertNoDiff(
allButInitializeRequest.mkString(lineSeparator),
s"""|
36 changes: 35 additions & 1 deletion frontend/src/test/scala/bloop/bsp/BspMetalsClientSpec.scala
Original file line number Diff line number Diff line change
@@ -167,7 +167,14 @@ class BspMetalsClientSpec(
)

val scalacOptions = state.scalaOptions(`A`)._2.items.head.options
assert(scalacOptions == correctSourceRootOption :: defaultScalacOptions.drop(1))
val expectedScalacOptions = correctSourceRootOption :: List(
"-Xplugin:path-to-plugin/semanticdb-scalac_2.12.18-4.7.8.jar",
"-Yrangepos",
"-P:semanticdb:failures:warning",
"-P:semanticdb:synthetics:on",
"-Xplugin-require:semanticdb"
)
assert(scalacOptions == expectedScalacOptions)
}
}
}
@@ -469,6 +476,33 @@ class BspMetalsClientSpec(
}
}

test("save-compile-semanticDB-many-options") {
TestUtil.withinWorkspace { workspace =>
val `A` = TestProject(
workspace,
"A",
dummyFooScalaAndBarJavaSources,
scalacOptions = List("-release", "8", "-Ybackend-parallelism", "8")
)
val projects = List(`A`)
TestProject.populateWorkspace(workspace, projects)
val logger = new RecordingLogger(ansiCodesSupported = false)
val extraParams = BloopExtraBuildParams(
ownsBuildFiles = None,
clientClassesRootDir = None,
semanticdbVersion = Some(semanticdbVersion),
supportedScalaVersions = Some(List(testedScalaVersion)),
javaSemanticdbVersion = Some(javaSemanticdbVersion)
)
loadBspState(workspace, projects, logger, "Metals", bloopExtraParams = extraParams) { state =>
val compiledState = state.compile(`A`).toTestState
assert(compiledState.status == ExitStatus.Ok)
assertSemanticdbFileFor("Foo.scala", compiledState)
assertSemanticdbFileFor("Bar.java", compiledState)
}
}
}

test("compile is successful with semanticDB and javac processorpath") {
TestUtil.withinWorkspace { workspace =>
val logger = new RecordingLogger(ansiCodesSupported = false)
7 changes: 5 additions & 2 deletions frontend/src/test/scala/bloop/testing/BloopHelpers.scala
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ import bloop.util.TestUtil

import monix.execution.CancelableFuture
import monix.execution.Scheduler
import bloop.logging.NoopLogger

trait BloopHelpers {
def loadState(
@@ -87,7 +88,8 @@ trait BloopHelpers {
baseDir,
workspace.underlying,
ExecutionContext.ioScheduler,
enableCancellation = false
enableCancellation = false,
logger
)

val loadFromNewWorkspace = copyToNewWorkspace.flatMap { _ =>
@@ -305,7 +307,8 @@ trait BloopHelpers {
classesDir,
newClassesDir,
ExecutionContext.ioScheduler,
enableCancellation = false
enableCancellation = false,
NoopLogger
)

backupDir.map { _ =>
Loading