javacc / javaccPlugin

A JavaCC plugin for Gradle
MIT License
33 stars 16 forks source link

parameterize which JavaCompileTasks to add generated files to #2

Closed garfieldnate closed 10 years ago

garfieldnate commented 10 years ago

I'm having trouble getting my project to compile when the JavaCC grammar references other classes. I have a minimal breaking example on SO. This can be fixed by changing the output folder to be the same as the rest of the source:

compileJavacc.outputDirectory = new File(
  rootDir.getAbsolutePath() + File.separator +
  "src" + File.separator + "main")

The plugin adds the generated source files to all JavaCompileTasks in the project, and only one of those tasks contains the source files needed for the generated code required by the generated code. I don't know why there are two compile tasks (just started with gradle), but there is one that ends up with ONLY the generated files, and that always kills the build.

It would be more convenient if there were a way to specify which compile tasks the generated source files should be added to. The workaround above works, but generated files are kept with the non-generated files.

johnmartel commented 10 years ago

Hi,

Thanks for your message. I am currently out in the woods with no access to a computer. I'll have a look at your example over the weekend and provide a comprehensive answer at this time.

Meanwhile, all the best.

John

Sent from my iPhone

On 2014-06-18, at 08:56, garfieldnate notifications@github.com wrote:

I'm having trouble getting my project to compile when the JavaCC grammar references other classes. I have a minimal breaking example on SO. This can be fixed by changing the output folder to be the same as the rest of the source:

compileJavacc.outputDirectory = new File( rootDir.getAbsolutePath() + File.separator + "src" + File.separator + "main") The plugin adds the generated source files to all JavaCompileTasks in the project, and only one of those tasks contains the source files needed for the generated code required by the generated code. I don't know why there are two compile tasks (just started with gradle), but there is one that ends up with ONLY the generated files, and that always kills the build.

It would be more convenient if there were a way to specify which compile tasks the generated source files should be added to. The workaround above works, but generated files are kept with the non-generated files.

— Reply to this email directly or view it on GitHub.

johnmartel commented 10 years ago

See my comment on StackOverflow