-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Gradle 4.0.1][AntlrTask]Failed to generate grammar source when g4 files is placed at packages #2565
Comments
@breskeby is this something that's configurable or look familiar? |
I think this is a known limitation in the antlr4 support in gradle. @danielsun1106 can you try to add the package declaration to the grammar header via
and check if that workaround is working for you? |
👆🏽 that was me |
@gradlewaregitbot I gave it a try, but still failed. |
Unfortunately, I only got a workaround for Windows. There it works if you explicitly address the lexer and the parser in the command line arguments: generateGrammarSource { The generated sources will be created beyond It works with Java classes for the repo I am working on: But it fails under Linux (tested with Ubuntu with gradle 2, 3 and 4.01 and 4.02). |
As antlr/antlr4#638 is closed, would changes according to antlr/antlr4#2065 (comment) solve this issue? |
Here is the workaround used by apache/groovy https://github.com/apache/groovy/blob/master/subprojects/parser-antlr4/build.gradle#L34 |
Thanks, works; with ANTLR 4.7.1
|
Solution mentioned by @danielsun1106 works great! Thanks! |
This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you're interested in how we try to keep the backlog in a healthy state, please read our blog post on how we refine our backlog. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution. |
This issue has been automatically closed due to inactivity. If you can reproduce this on a recent version of Gradle or if you have a good use case for this feature, please feel free to reopen the issue with steps to reproduce, a quick explanation of your use case or a high-quality pull request. |
When g4 files is placed at packages(e.g. package
parrot
whose path issrc\main\antlr\parrot
), generating grammar source fails because of tokens file not found.( The tokens file is generated tobuild\generated-src\antlr\main\parrot
, but antlr4 will try to find the tokens file atbuild\generated-src\antlr\main\
)Expected Behavior
Generate grammar source successfully.
Current Behavior
Fails to generate grammar source.
Context
Fails to generate grammar source.
Steps to Reproduce (for bugs)
gradlew generateGrammarSource
Your Environment
Gradle 4.0.1
The text was updated successfully, but these errors were encountered: