Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

SQream/calcite-parser-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Motivation:

Apache Calcite has an in-built Sql Parser. This plugin helps to keep the template files and configuration to a different project. Thus,allowing to have cleaner build structure and project dependencies.

Configurations:

  1. codegenDirectory : Set a directory where fmpp template files and configurations are placed.
    The recommended directory structure is just like in Calcite

    codegen/
    templates/
    includes/
    config.fmpp
    default_config.fmpp
  2. outputTemplateDirectory : Directory where template file is generated.

  3. outputDirectory : Directory where java sources files are generated.

  4. packageName : Package for generated java files.

  5. outputJar : Required java jar file for generated sources.

Usage:

  1. compileParserSource : Compile java sources from $outputDirectory and project build's javaSource into $outputJar

  2. generateParserSource : Create java sources from templates in $outputTemplateDirectory from $outputDirectory

  3. generateParserTemplate : Create templates files from $codegenDirectory into $outputTemplateDirectory.

Each task aggregates dependent task.

Example:

    import scala.reflect.io.{Directory, File}
    val project=project
            .in(file("example"))
            .enablePlugins(ParserGeneratorPlugin)
            .settings(
                codegenDirectory := Directory(baseDirectory.value / "src/main/codegen"),
                outputTemplateDirectory := Directory(target.value / "fmpp"),
                outputDirectory := Directory(target.value / "javacc"),
                packageName := "my.package",
                outputJar := File(target.value / "generated" / "my_example.jar"),
                javacOptions ++= Seq(
                    "-classpath",
                    (Compile / dependencyClasspath).value.map(file => file.data.getAbsolutePath).mkString(":")
            )
  )

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •