[GRADLE-3323] Antlr plugin should preserve package structure Created: 21/Jul/15 Updated: 18/Aug/15 Resolved: 18/Aug/15 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | 2.2 |
Fix Version/s: | 2.7-rc-1 |
Type: | Bug | ||
Reporter: | René Gröschke (Inactive) | Assignee: | René Gröschke (Inactive) |
Resolution: | Fixed | Votes: | 1 |
Description |
Henry S: @header { package com.example.foo.antlr; }I realize it might be difficult for the Antlr plugin to be aware of that package information, but an alternate solution would be to mirror the source folder structure like resources do: Thus this .g file: Should have generated code placed under a similar package structure: (I should mention that simply specifying the outputDirectory does not work in the case of multiple .g files with different packages) Steve Ebersole: I second this. And what's worse is that this seems to be a regression. I believe that this used to work in versions of Gradle prior to 2.3/2.4 when the Antlr plugin was significantly changed. For additional information... putting the grammar file in the proper "package directory structure".. the plugin does find the grammar files, but it flattens the output back out into a root directory rather than honoring the "package directory structure". Interestingly (not sure how) compiling the generated sources works out ok. Using Henry's example.. Foo.g declares package com.example.foo.antlr; Ultimately the issue is in IDEs. If you import the Hibernate project into your IDE it (properly) shows ${buildDir}/generated-src/antlr/main as a source directory, however it shows it being incorrect since the sources are not in their proper directories according to their package statements. I find it fascinating that the compiled classes end up in the proper directory. I am almost positive javac is not doing that. [1] http://github.com/hibernate/hibernate-orm |
Comments |
Comment by René Gröschke (Inactive) [ 21/Jul/15 ] |
This is a regression at it worked with prior gradle versions for antlr2. I have a simple fix for this available |