Skip to content

Commit 2514163

Browse files
seancxmaogatorsmile
authored andcommitted
[SPARK-26799][BUILD] Make ANTLR v4 version consistent between Maven and SBT
## What changes were proposed in this pull request? Currently ANTLR v4 versions used by Maven and SBT are slightly different. Maven uses `4.7.1` while SBT uses `4.7`. * Maven(`pom.xml`): `<antlr4.version>4.7.1</antlr4.version>` * SBT(`project/SparkBuild.scala`): `antlr4Version in Antlr4 := "4.7"` We should make Maven and SBT use a single version. Furthermore we'd better specify antlr4 version in one place to avoid mismatch between Maven and SBT in the future. This PR lets SBT use antlr4 version specified in Maven POM file, rather than specify its own antlr4 version. This is in the same as how `hadoop.version` is specified in `project/SparkBuild.scala` ## How was this patch tested? Test locally. After run `sbt compile`, Java files generated by ANTLR are located at: ``` sql/catalyst/target/scala-2.12/src_managed/main/antlr4/org/apache/spark/sql/catalyst/parser/*.java ``` These Java files have a comment at the head. We can see now SBT uses ANTLR `4.7.1`. ``` // Generated from .../spark/sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 by ANTLR 4.7.1 ``` Closes apache#23713 from seancxmao/antlr4-version-consistent. Authored-by: seancxmao <[email protected]> Signed-off-by: gatorsmile <[email protected]>
1 parent f4a17e9 commit 2514163

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

project/SparkBuild.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ object OldDeps {
568568

569569
object Catalyst {
570570
lazy val settings = antlr4Settings ++ Seq(
571-
antlr4Version in Antlr4 := "4.7",
571+
antlr4Version in Antlr4 := SbtPomKeys.effectivePom.value.getProperties.get("antlr4.version").asInstanceOf[String],
572572
antlr4PackageName in Antlr4 := Some("org.apache.spark.sql.catalyst.parser"),
573573
antlr4GenListener in Antlr4 := true,
574574
antlr4GenVisitor in Antlr4 := true

0 commit comments

Comments
 (0)