melix / antlr4-gradle-plugin

Antlr4 plugin for Gradle
Apache License 2.0
41 stars 13 forks source link

package names and paths #7

Open robertboxall opened 10 years ago

robertboxall commented 10 years ago

I'm trying to convert a project that uses a maven plugin for antlr4 over to gradle. This code is working (thanks) but I have couple of questions / problems.

I have code in

src/main/antlr4/

the code is along the lines of:

src/main/antlr4/org/acme/project/x/file.g4 src/main/antlr4/org/acme/project/y/filey.g4

when using plugin all files go here:

./build/generated-src/

Any way to have these include a package name and path with these files

Ideally this

src/main/java/org/acme/project/x/filex.java src/main/java/org/acme/project/y/filey.java

Also can you show example of how to set source / output or one of the other configuration examples in the gradle.build file. I'm not able to set a different path for some reason.

AndrewReitz commented 10 years ago

I was able to get a package generated by adding

antlr4 {
  extraArgs=['-package', 'org.acme.project']
}

Then to get the output to the folder you want add output=project.file("path/to/out/put")