HI, I’m trying to migrate an ant script to a gradle one. The ant script generates a set of classes from antlr source files. This is a two step process: in first phase the script generates low level parser (expansion of labels, expression evaluation, and low level lexer), in the second phase two grammars are generated using grammars generated in first step.
I canconvert this ant to gradle without problems, using ant task within gradle, but I’m wondering if it could be done with the antlr plugin.
My first attempt was to put all files in the same dir, but the build failed with the (in)famous:
Execution failed for task 'generateGrammarSource'.
> java.lang.NullPointerException (no error message)
I think that antlr plugin should provide a better message in this case… is it possible? 2) I imagine that I could put the two sets of grammars in two separate sourcesets, but then, using the plugin, how can I pass the first set of grammars as parameter to the second one?
It’s impossible to answer 1) without seeing your Gradle build script.
It would definitely be possible to do 2), though it would require you looking through the Antlr plugin and seeing how things are wired together, then creating some extra tasks and wiring them in. If you can provide a small project with two sets of grammars in a similar kind of arrangement I could put together a sample for you.
Regarding problem 2, further investigations showed me that the problem lies within the antlr gradle task, which is closely modeled over the antlr ant task.
The antlr ant task doesn’t allow to pass supergrammars, (the value="-o ./ -glib ./MappingLexer.g" in the second ant task) ant this may be the reason why the gradle build crashes.
Is it possible to rebuild the antlr gradle task?
I wait your instruction on how to send the file. Thanks, Luca