Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed the compile/logger test
Browse files Browse the repository at this point in the history
Not only does ProblemStringFormats format problems (compilation
messages) slightly differently, but it uses `xsbti.Position#pointer`
rather than `xsbti.Position#offset` as the column number.

Prior to v1.10.1 of Zinc, `sbt.internal.inc.javac.JavaPosition`, a
concrete implementation of `Position`, set `pointer` to `None`
unconditionally, meaning that `ProblemStringFormats` didn't have access
to the line number. To fix this, I upgraded our version of Zinc to
v1.10.1 from v1.10.0.
Jaden Peterson committed Aug 28, 2024
1 parent 7c1824d commit adc0b5b
Showing 4 changed files with 558 additions and 720 deletions.
1,262 changes: 550 additions & 712 deletions annex_install.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions rules/scala/workspace.bzl
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ filegroup(

scala_2_13_version = "2.13.14"
scala_3_version = "3.4.2"
zinc_version = "1.10.0"
zinc_version = "1.10.1"

def scala_artifacts():
return [
@@ -24,7 +24,7 @@ def scala_artifacts():
"org.jacoco:org.jacoco.core:0.7.5.201505241946",
"org.scala-sbt:test-interface:1.0",
"org.scala-sbt:compiler-interface:{}".format(zinc_version),
"org.scala-sbt:io_2.13:{}".format(zinc_version),
"org.scala-sbt:io_2.13:1.10.0",
"org.scala-sbt:util-interface:{}".format(zinc_version),
"org.scala-sbt:util-logging_2.13:{}".format(zinc_version),
"org.scala-sbt:zinc_2.13:{}".format(zinc_version),
6 changes: 3 additions & 3 deletions tests/compile/logger/Example.scala
Original file line number Diff line number Diff line change
@@ -12,9 +12,9 @@ object Example {
def main(args: Array[String]) {
val logger = new AnnexLogger(LogLevel.Info, Paths.get(""), System.err)
val reporter = new LoggedReporter(logger, "2.13.14")
val problem1 = problem("", new JavaPosition("Test Line", 100, "", 100), "Info Message 1", Severity.Info)
val problem2 = problem("", new JavaPosition("Test Line", 200, "", 200), "Warning Message 2", Severity.Warn)
val problem3 = problem("", new JavaPosition("Test Line", 300, "", 300), "Error Message 3", Severity.Error)
val problem1 = problem("", new JavaPosition("Test Line", 100, "", 99, ""), "Info Message 1", Severity.Info)
val problem2 = problem("", new JavaPosition("Test Line", 200, "", 199, ""), "Warning Message 2", Severity.Warn)
val problem3 = problem("", new JavaPosition("Test Line", 300, "", 299, ""), "Error Message 3", Severity.Error)
// Test logger
reporter.log(problem1)
reporter.log(problem2)
6 changes: 3 additions & 3 deletions tests/compile/logger/test
Original file line number Diff line number Diff line change
@@ -2,9 +2,9 @@
. "$(dirname "$0")"/../../common.sh

bazel run :lib > output 2>&1
cat output | grep -q $'\[\e\[32mInfo\e\[0m\] Test Line:100:100 Info Message 1'
cat output | grep -q $'\[\e\[33mWarn\e\[0m\] Test Line:200:200 Warning Message 2'
cat output | grep -q $'\[\e\[31mError\e\[0m\] Test Line:300:300 Error Message 3'
cat output | grep -q $'\[\e\[32mInfo\e\[0m\] Test Line:100:100: Info Message 1'
cat output | grep -q $'\[\e\[33mWarn\e\[0m\] Test Line:200:200: Warning Message 2'
cat output | grep -q $'\[\e\[31mError\e\[0m\] Test Line:300:300: Error Message 3'
cat output | grep -q $'\[\e\[32mInfo\e\[0m\] This is an info'
cat output | grep -q $'\[\e\[33mWarn\e\[0m\] This is a warning'
cat output | grep -q $'\[\e\[31mError\e\[0m\] This is an error'

0 comments on commit adc0b5b

Please sign in to comment.