Skip to content

Commit 758b31c

Browse files
authored
Merge pull request #1622 from adpi2/skip-parsing-javadoc-logs
[1.x] Skip parsing Javadoc info logs
2 parents 7b70075 + 176a353 commit 758b31c

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

internal/zinc-compile-core/src/main/scala/sbt/internal/inc/javac/JavaErrorParser.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,14 @@ class JavaErrorParser(relativeDir: File = new File(new File(".").getAbsolutePath
272272

273273
val nonProblem: Parser[Unit] = {
274274
val skipLine =
275-
("Loading source file" | "Constructing Javadoc information") ~ """[^\r\n]*(\r\n|\n)?""".r
275+
(
276+
"Loading source file" |
277+
"Constructing Javadoc information" |
278+
"Building index for all the packages and classes" |
279+
"Standard Doclet version" |
280+
"Building tree for all the packages and classes" |
281+
"Generating"
282+
) ~ """[^\r\n]*(\r\n|\n)?""".r
276283
rep(skipLine) ^^ (_ => ())
277284
}
278285

internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavacProcessLoggerSpec.scala

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class JavaProcessLoggerSpec extends UnitSpec {
2222
"The javac process logger" should "parse regular semantic errors" in logSemanticErrors()
2323
it should "parse semantic errors passed in one by one" in logSeparateSemanticErrors()
2424
it should "log errors that could not be parsed" in logUnparsableErrors()
25+
it should "ignore javadoc info logs" in ignoreJavadocInfoLogs()
2526

2627
def logSemanticErrors(): Unit = {
2728
val reporter = new CollectingReporter()
@@ -88,4 +89,26 @@ class JavaProcessLoggerSpec extends UnitSpec {
8889
errorLogger.messages(Level.Warn)(1).contains("javadoc exited with exit code -1") shouldBe true
8990
()
9091
}
92+
93+
def ignoreJavadocInfoLogs(): Unit = {
94+
val reporter = new CollectingReporter()
95+
val errorLogger = new CollectingLogger()
96+
val javacLogger = new JavacLogger(errorLogger, reporter, cwd = new File("."))
97+
98+
val javadocLogs =
99+
"""|Loading source file /foo/bar/MyClass.java...
100+
|Constructing Javadoc information...
101+
|Building index for all the packages and classes...
102+
|Standard Doclet version 21.0.4+7-LTS
103+
|Building tree for all the packages and classes...
104+
|Generating /foo/bar/MyClass.html...
105+
|""".stripMargin
106+
107+
javacLogger.err(javadocLogs)
108+
javacLogger.flush("javadoc", 0)
109+
110+
reporter.problems shouldBe empty
111+
errorLogger.messages shouldBe empty
112+
()
113+
}
91114
}

0 commit comments

Comments
 (0)