Skip to content
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

Use gradle model instead of string parsing for manipulating gradle files #3497

Closed
Dufgui opened this issue Aug 13, 2019 · 9 comments · Fixed by #3555
Closed

Use gradle model instead of string parsing for manipulating gradle files #3497

Dufgui opened this issue Aug 13, 2019 · 9 comments · Fixed by #3555
Assignees
Labels
area/gradle Gradle kind/enhancement New feature or request
Milestone

Comments

@Dufgui
Copy link
Contributor

Dufgui commented Aug 13, 2019

Description
Actually we use string parsing and manipulation to add extension, complete existing gradle file, or simply read gradle files. It's fragil, On maven side, we use an external model and parser.

Implementation ideas
I am just dig a little more to not use string and delegate parse of model to gradle lib.
I see how eclipse do it:
https://github.com/eclipse/buildship/blob/master/org.eclipse.buildship.kotlin/build.gradle
https://github.com/eclipse/buildship/blob/master/org.eclipse.buildship.kotlin/src/main/java/org/eclipse/buildship/kotlin/internal/GradleKotlinScriptTemplateProvider.java#L80

And with ProjectConnection we can load the groovy model too, but I don't know the limitation and we need all gradle core as dependency.

see #3475 (comment)

@Dufgui Dufgui added the kind/enhancement New feature or request label Aug 13, 2019
@Dufgui
Copy link
Contributor Author

Dufgui commented Aug 13, 2019

could you add gradle label. and maybe assign to me if nobody want it.

@Dufgui
Copy link
Contributor Author

Dufgui commented Aug 13, 2019

In fact I am thinking my self, it could be interesting to have an independent project wich manage all kind of model externaly (maven, gradle, ivy , sbt ...) out of quarkus.... but for now I will manage gradle first

@gwenneg gwenneg added the area/gradle Gradle label Aug 13, 2019
@gwenneg
Copy link
Member

gwenneg commented Aug 13, 2019

The Gradle Tooling API could help here, but it also has a lot of limitations. When I worked on the add extension feature, I tried to push the tooling API usage as much as I could, but it didn't help that much.

@Dufgui
Copy link
Contributor Author

Dufgui commented Aug 13, 2019

The gradle approch is based on script not on model.:
See https://github.com/gradle/gradle/blob/master/subprojects/core/src/main/java/org/gradle/groovy/scripts/internal/DefaultScriptCompilationHandler.java

I don't how you try to start but GradleConnector and projectConnection seems to be too limited for us.

So I think, we can choose one of this option :

@gwenneg
Copy link
Member

gwenneg commented Aug 13, 2019

There's also a model approach in Gradle using the Tooling API, this is what I used. We're already using some parts of it in quarkus-gradle-plugin.

One example of its limitations is the ability to list the dependencies of a Gradle build. The API can do that, but can't differentiate the direct dependencies from the transitive dependencies (which is the kind of info we'd want while adding a Quarkus extension).

@Dufgui
Copy link
Contributor Author

Dufgui commented Aug 13, 2019 via email

@Dufgui
Copy link
Contributor Author

Dufgui commented Aug 15, 2019

The more I think about it, the more I think we must not integrate gradle but just the AST of groovy and Kotlin.
Groovy:
http://docs.groovy-lang.org/next/html/gapi/org/codehaus/groovy/ast/builder/AstBuilder.html
For Kotlin I will search it.

Dufgui added a commit to Dufgui/quarkus that referenced this issue Aug 15, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Aug 16, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Aug 16, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Aug 16, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Aug 17, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Aug 17, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Aug 17, 2019
@Dufgui
Copy link
Contributor Author

Dufgui commented Aug 17, 2019

I test 2 approachs. On différent branches. I will push the gradle tooling api version.

But we have a small limitation: we cannot get dependencies from zipped project. It’s not used. So we can go for it I think

Dufgui added a commit to Dufgui/quarkus that referenced this issue Aug 17, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Aug 17, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Aug 17, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Aug 17, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Aug 18, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Aug 18, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Aug 18, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Aug 18, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Aug 18, 2019
@soberich
Copy link
Contributor

@Dufgui Could we try to use 5.6 straight away? It has more in common with upcoming 6.0.I am eager for better Gradle support as now it's really a room for improvement. Can't really run non simplistic Quarkus projects with Gradle now. Great work. Any other plans for Gradle? So we can form issues/PR out of those?

Dufgui added a commit to Dufgui/quarkus that referenced this issue Aug 29, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Aug 30, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Aug 30, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Aug 30, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Sep 1, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Sep 3, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Sep 11, 2019
aloubyansky pushed a commit to aloubyansky/quarkus that referenced this issue Sep 18, 2019
aloubyansky pushed a commit to aloubyansky/quarkus that referenced this issue Sep 18, 2019
Dufgui added a commit to Dufgui/quarkus that referenced this issue Sep 18, 2019
@aloubyansky aloubyansky added this to the 0.24.0 milestone Sep 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gradle Gradle kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants