[forge-dev] Support for the Gradle build system as a plugin for Forge

Adam Wyłuda adamwyl92 at gmail.com
Sat Jun 15 20:33:48 EDT 2013

So, after studying JavaParser API, I've come to conclusion that creating
exact clone of this API for Groovy would be completely irrelevant for this
JavaParser only works on Java class/interface/enum/annotation structures,
there is no way to modify method logic other than manually editing its
source code (from Method.getBody() method, which returns plain String).
What we really need, is a util which works on imperative expressions, not
data structures, so it should be exactly opposite of JavaParser (in Gradle
build script there will be rarely any class declarations).

I think this issue can be dealt in two ways:
1) Create a full GroovyParser with all capabilities to synthesize any piece
of code (including class structures and method bodies) - that's what I was
thinking initially, surely nice to have, but it's very hard to even design
an API (with statements and expressions its API size will be about twice of
JavaParser), and implementing it. To do that we would need to either use
one of the existing parsers which are not easy to use (mostly IDE plugins,
which are not even available as a Maven dependencies, and they take quite a
lot of memory space) or write our own Groovy AST rewriter which may be easy
or hard depending on what output quality we expect from it - if we want to
keep comments and formatting it certainly won't be easy to do.
2) Use my simple parser ( https://github.com/adamwy/simple-gradle-manager )
or rewrite it, and start working on Gradle support from now, it's fast and
light solution (no dependencies other than Groovy library), and it's
sufficient to make all necessary modifications to the Gradle build script.
I could work on GroovyParser (which I promised to do) after Gradle support
in Forge is done, and we could think about creating a common API for
parsing Java, Groovy and maybe other languages with full support for
expressions inside method bodies. Having this abstraction layer addons
which need to synthesize code could work with any supported language
without caring in which language the class they modify is written.

What do you think is a better way? I planned to go with the first, but the
many issue related to this made me think that maybe we should take more
time to think and discuss how the Groovy (and probably Java) parser should
look and work like, and it will be better to do that later (it's not
necessary for Gradle addon, but a nice feature which we will probably need
in the future anyway).

2013/5/5 Adam Wyłuda <adamwyl92 at gmail.com>

> Hello JBoss community,
> This year I want to participate in an OS project and GSoC gives me great
> opportunity to do so.
> Here is my idea as GSoC 2013 proposal:
> http://www.google-melange.com/gsoc/proposal/review/google/gsoc2013/adamw/1
> I'd be very happy to hear your opinions (I hope it's not too late).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/forge-dev/attachments/20130616/f3ecfe42/attachment.html 

More information about the forge-dev mailing list