Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 2 additions & 29 deletions frontend/src/main/scala/bloop/logging/BspServerLogger.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import scala.collection.JavaConverters._
import ch.epfl.scala.bsp
import ch.epfl.scala.bsp.BuildTargetIdentifier
import ch.epfl.scala.bsp.DiagnosticSeverity
import ch.epfl.scala.bsp.Uri
import ch.epfl.scala.bsp.endpoints.Build

import bloop.bsp.BloopLanguageClient
Expand Down Expand Up @@ -349,16 +348,13 @@ final class BspServerLogger private (
val errors = event.problems.count(_.severity == Severity.Error)
val warnings = event.problems.count(_.severity == Severity.Warn)
val encoded = writeToArray(
BspServerLogger.BloopCompileReport(
bsp.CompileReport(
bsp.BuildTargetIdentifier(event.projectUri),
originId,
errors,
warnings,
None,
Some(event.isNoOp),
Some(event.isLastCycle),
event.clientDir.map(path => bsp.Uri(path.toBspUri)),
event.analysisOut.map(path => bsp.Uri(path.toBspUri))
Some(event.isNoOp)
)
)

Expand Down Expand Up @@ -390,27 +386,4 @@ object BspServerLogger {
new BspServerLogger(name, state.logger, client, taskIdCounter, ansiCodesSupported, None)
}

/**
* A modified version of `bsp.CompileReport` with optional bloop fields.
*
* We should consider upstreaming many of these fields as they are usually
* very useful for clients.
*/
final case class BloopCompileReport(
target: BuildTargetIdentifier,
originId: Option[String],
errors: Int,
warnings: Int,
time: Option[Long],
// ++ bloop ++
isNoOp: Option[Boolean],
isLastCycle: Option[Boolean],
clientDir: Option[Uri],
analysisOut: Option[Uri]
)

object BloopCompileReport {
implicit val codec: JsonValueCodec[BloopCompileReport] =
JsonCodecMaker.makeWithRequiredCollectionFields
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import bloop.logging.CompilationEvent

import monix.execution.atomic.AtomicInt
import xsbti.VirtualFile
import bloop.UniqueCompileInputs
import bloop.util.HashedSource

final class BspProjectReporter(
Expand Down
18 changes: 9 additions & 9 deletions frontend/src/test/scala/bloop/DeduplicationSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ object DeduplicationSpec extends bloop.bsp.BspBaseSuite {
| -> Msg: Compiling user (2 Scala sources)
| -> Data kind: compile-task
|#1: task finish 1
| -> errors 0, warnings 0
| -> errors 0, warnings 0, noop false
| -> Msg: Compiled 'user'
| -> Data kind: compile-report
""".stripMargin
Expand Down Expand Up @@ -230,7 +230,7 @@ object DeduplicationSpec extends bloop.bsp.BspBaseSuite {
| -> Msg: Compiling user (2 Scala sources)
| -> Data kind: compile-task
|#1: task finish 1
| -> errors 0, warnings 0
| -> errors 0, warnings 0, noop false
| -> Msg: Compiled 'user'
| -> Data kind: compile-report
""".stripMargin
Expand Down Expand Up @@ -323,7 +323,7 @@ object DeduplicationSpec extends bloop.bsp.BspBaseSuite {
| -> Msg: Compiling user (1 Scala source)
| -> Data kind: compile-task
|#2: task finish 2
| -> errors 0, warnings 0
| -> errors 0, warnings 0, noop false
| -> Msg: Compiled 'user'
| -> Data kind: compile-report
""".stripMargin
Expand Down Expand Up @@ -409,7 +409,7 @@ object DeduplicationSpec extends bloop.bsp.BspBaseSuite {
| -> Msg: Compiling user (2 Scala sources)
| -> Data kind: compile-task
|#1: task finish 1
| -> errors 0, warnings 0
| -> errors 0, warnings 0, noop false
| -> Msg: Compiled 'user'
| -> Data kind: compile-report
""".stripMargin
Expand Down Expand Up @@ -563,7 +563,7 @@ object DeduplicationSpec extends bloop.bsp.BspBaseSuite {
| -> List(Diagnostic(Range(Position(2,28),Position(2,28)),Some(Error),Some(_),Some(_),type mismatch; found : Int required: String,None,None,Some({"actions":[]})))
| -> reset = true
|#1: task finish 1
| -> errors 1, warnings 0
| -> errors 1, warnings 0, noop false
| -> Msg: Compiled 'b'
| -> Data kind: compile-report
""".stripMargin
Expand Down Expand Up @@ -644,7 +644,7 @@ object DeduplicationSpec extends bloop.bsp.BspBaseSuite {
| -> List(Diagnostic(Range(Position(2,28),Position(2,28)),Some(Error),Some(_),Some(_),type mismatch; found : Int required: String,None,None,Some({"actions":[]})))
| -> reset = true
|#2: task finish 2
| -> errors 1, warnings 0
| -> errors 1, warnings 0, noop false
| -> Msg: Compiled 'b'
| -> Data kind: compile-report
""".stripMargin
Expand Down Expand Up @@ -744,7 +744,7 @@ object DeduplicationSpec extends bloop.bsp.BspBaseSuite {
| -> List()
| -> reset = true
|#3: task finish 3
| -> errors 0, warnings 0
| -> errors 0, warnings 0, noop false
| -> Msg: Compiled 'b'
| -> Data kind: compile-report
""".stripMargin
Expand Down Expand Up @@ -891,7 +891,7 @@ object DeduplicationSpec extends bloop.bsp.BspBaseSuite {
| -> Msg: Compiling b (6 Scala sources)
| -> Data kind: compile-task
|#1: task finish 1
| -> errors 0, warnings 0
| -> errors 0, warnings 0, noop false
| -> Msg: Compiled 'b'
| -> Data kind: compile-report
""".stripMargin
Expand Down Expand Up @@ -1093,7 +1093,7 @@ object DeduplicationSpec extends bloop.bsp.BspBaseSuite {
| -> Msg: Compiling user (32 Scala sources)
| -> Data kind: compile-task
|#1: task finish 2
| -> errors 0, warnings 0
| -> errors 0, warnings 0, noop false
| -> Msg: Compiled 'user'
| -> Data kind: compile-report
""".stripMargin
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/test/scala/bloop/bsp/BspClientTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,9 @@ trait BspClientTest {
(builder: StringBuilder) => {
builder.synchronized {
builder.++=(s"#${compileIteration()}: task finish ${taskFinish.taskId.id}\n")
builder.++=(s" -> errors ${report.errors}, warnings ${report.warnings}\n")
builder.++=(
s" -> errors ${report.errors}, warnings ${report.warnings}, noop ${report.noOp.getOrElse(false)}\n"
)
report.originId.foreach(originId => builder.++=(s" -> origin = $originId\n"))
taskFinish.message.foreach(msg => builder.++=(s" -> Msg: ${msg}\n"))
taskFinish.dataKind.foreach(msg => builder.++=(s" -> Data kind: ${msg}\n"))
Expand Down
Loading
Loading