aboutsummaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authorHerman van Hovell <hvanhovell@questtec.nl>2016-03-31 09:25:09 -0700
committerReynold Xin <rxin@databricks.com>2016-03-31 09:25:09 -0700
commita9b93e07391faede77dde4c0b3c21c9b3f97f8eb (patch)
treeebcdf8cef08c6c14efadd5186097c7ceb8fc1738 /project
parent26445c2e472bad137fd350e4089dd0ff43a42039 (diff)
downloadspark-a9b93e07391faede77dde4c0b3c21c9b3f97f8eb.tar.gz
spark-a9b93e07391faede77dde4c0b3c21c9b3f97f8eb.tar.bz2
spark-a9b93e07391faede77dde4c0b3c21c9b3f97f8eb.zip
[SPARK-14211][SQL] Remove ANTLR3 based parser
### What changes were proposed in this pull request? This PR removes the ANTLR3 based parser, and moves the new ANTLR4 based parser into the `org.apache.spark.sql.catalyst.parser package`. ### How was this patch tested? Existing unit tests. cc rxin andrewor14 yhuai Author: Herman van Hovell <hvanhovell@questtec.nl> Closes #12071 from hvanhovell/SPARK-14211.
Diffstat (limited to 'project')
-rw-r--r--project/SparkBuild.scala54
-rw-r--r--project/plugins.sbt3
2 files changed, 2 insertions, 55 deletions
diff --git a/project/SparkBuild.scala b/project/SparkBuild.scala
index 39a9e16f7e..5d62b688b9 100644
--- a/project/SparkBuild.scala
+++ b/project/SparkBuild.scala
@@ -403,59 +403,9 @@ object OldDeps {
object Catalyst {
lazy val settings = antlr4Settings ++ Seq(
- antlr4PackageName in Antlr4 := Some("org.apache.spark.sql.catalyst.parser.ng"),
+ antlr4PackageName in Antlr4 := Some("org.apache.spark.sql.catalyst.parser"),
antlr4GenListener in Antlr4 := true,
- antlr4GenVisitor in Antlr4 := true,
- // ANTLR code-generation step.
- //
- // This has been heavily inspired by com.github.stefri.sbt-antlr (0.5.3). It fixes a number of
- // build errors in the current plugin.
- // Create Parser from ANTLR grammar files.
- sourceGenerators in Compile += Def.task {
- val log = streams.value.log
-
- val grammarFileNames = Seq(
- "SparkSqlLexer.g",
- "SparkSqlParser.g")
- val sourceDir = (sourceDirectory in Compile).value / "antlr3"
- val targetDir = (sourceManaged in Compile).value / "antlr3"
-
- // Create default ANTLR Tool.
- val antlr = new org.antlr.Tool
-
- // Setup input and output directories.
- antlr.setInputDirectory(sourceDir.getPath)
- antlr.setOutputDirectory(targetDir.getPath)
- antlr.setForceRelativeOutput(true)
- antlr.setMake(true)
-
- // Add grammar files.
- grammarFileNames.flatMap(gFileName => (sourceDir ** gFileName).get).foreach { gFilePath =>
- val relGFilePath = (gFilePath relativeTo sourceDir).get.getPath
- log.info("ANTLR: Grammar file '%s' detected.".format(relGFilePath))
- antlr.addGrammarFile(relGFilePath)
- // We will set library directory multiple times here. However, only the
- // last one has effect. Because the grammar files are located under the same directory,
- // We assume there is only one library directory.
- antlr.setLibDirectory(gFilePath.getParent)
- }
-
- // Generate the parser.
- antlr.process()
- val errorState = org.antlr.tool.ErrorManager.getErrorState
- if (errorState.errors > 0) {
- sys.error("ANTLR: Caught %d build errors.".format(errorState.errors))
- } else if (errorState.warnings > 0) {
- sys.error("ANTLR: Caught %d build warnings.".format(errorState.warnings))
- }
-
- // Return all generated java files.
- (targetDir ** "*.java").get.toSeq
- }.taskValue,
- // Include ANTLR tokens files.
- resourceGenerators in Compile += Def.task {
- ((sourceManaged in Compile).value ** "*.tokens").get.toSeq
- }.taskValue
+ antlr4GenVisitor in Antlr4 := true
)
}
diff --git a/project/plugins.sbt b/project/plugins.sbt
index d9ed7962bf..4929ba3c4d 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -22,9 +22,6 @@ libraryDependencies += "org.ow2.asm" % "asm" % "5.0.3"
libraryDependencies += "org.ow2.asm" % "asm-commons" % "5.0.3"
-libraryDependencies += "org.antlr" % "antlr" % "3.5.2"
-
-
// TODO I am not sure we want such a dep.
resolvers += "simplytyped" at "http://simplytyped.github.io/repo/releases"