-
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
antlr plugin should respect include files #13005
Comments
Adds a new `@Input` property `Set<Pattern> includeFilesPatterns` to `AntlrTask` to contain the regex patterns to match the include-files (applied on the project-relative-path of each input file). If `includeFilesPatterns` is not empty, "incremental grammar builds" are disabled, as there is no way to know which include file is used in which grammar. Include-files are not passed to the antlr tool. fixes gradle#13005 Signed-off-by: Robert Stupp <snazy@snazy.de>
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 to let know so we can reopen the issue. Please try to provide steps to reproduce, a quick explanation of your use case or a high-quality pull request. |
For antlr source grammar files that include other files, the antlr-plugin will consider those "include fragments" as "full grammar files" and tries to build those via antlr.
For example:
File
Cql.g
(e.g. this line)includes the files
Parser.g
andLexer.g
.Excluding the Lexer.g+Parser.g files is not an option, because that would completely ignore any changes to those files and the grammar wouldn't be built.
The only workaround that I could find so far is to implement a custom task that extends
org.gradle.api.plugins.antlr.AntlrTask
, then disable all tasks of typeAntlrTask
and just use the task with the custom class. Theexecute()
method is a little bit different (compared to the "original one" here):I.e. it basically trades the support for include files with incremental builds for antlr grammar, as there's no information for incremental grammar-builds about which include file is used in which grammar source file. I think, it's a fair tradeoff, at least for my use case.
I'm proposing to extend the
AntlrTask
with a new propertyincludeFiles
as a set of regular expressions. If that set is not empty, skip the incremental grammar-builds. Also don't pass the include files (i.e. source files matching any of the regular expressions) to the antlr-tool.The text was updated successfully, but these errors were encountered: