Skip to content

Commit b154233

Browse files
dilipbiswaldongjoon-hyun
authored andcommitted
[SPARK-27016][SQL][BUILD][FOLLOW-UP] Treat all antlr warnings as errors while generating the parser.
## What changes were proposed in this pull request? Use the sbt maven plugin option`antlr4TreatWarningsAsErrors` to make sure the warnings are treated as errors while generating the parser. In the absence of it, we may inadvertently introduce problems while making grammar changes. Please refer to PR-23897 to know more about the context. We made a change in [pr-23925](#23925) which handled only the maven build. In this PR, we handle the sbt build. I had submitted [PR-23](ihji/sbt-antlr4#23) to enhance the sbt-antlr plugin to make is possible to pass the error on warning option. ## How was this patch tested? Force an warning in the grammar file to check if the build fails. Then remove the warning to verify the build succeeds. Closes #24060 from dilipbiswal/sbt_build_antlr. Authored-by: Dilip Biswal <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent b8dd84b commit b154233

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

project/SparkBuild.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,8 @@ object Catalyst {
569569
antlr4Version in Antlr4 := SbtPomKeys.effectivePom.value.getProperties.get("antlr4.version").asInstanceOf[String],
570570
antlr4PackageName in Antlr4 := Some("org.apache.spark.sql.catalyst.parser"),
571571
antlr4GenListener in Antlr4 := true,
572-
antlr4GenVisitor in Antlr4 := true
572+
antlr4GenVisitor in Antlr4 := true,
573+
antlr4TreatWarningsAsErrors in Antlr4 := true
573574
)
574575
}
575576

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ libraryDependencies += "org.ow2.asm" % "asm" % "7.0"
3333
libraryDependencies += "org.ow2.asm" % "asm-commons" % "7.0"
3434

3535
// sbt 1.0.0 support: https://github.com/ihji/sbt-antlr4/issues/14
36-
addSbtPlugin("com.simplytyped" % "sbt-antlr4" % "0.7.12")
36+
addSbtPlugin("com.simplytyped" % "sbt-antlr4" % "0.7.13")
3737

3838
// Spark uses a custom fork of the sbt-pom-reader plugin which contains a patch to fix issues
3939
// related to test-jar dependencies (https://github.com/sbt/sbt-pom-reader/pull/14). The source for

0 commit comments

Comments
 (0)