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

convention usage must be removed #343

Closed
Vampire opened this issue Jul 4, 2023 · 7 comments
Closed

convention usage must be removed #343

Vampire opened this issue Jul 4, 2023 · 7 comments
Labels
Milestone

Comments

@Vampire
Copy link
Contributor

Vampire commented Jul 4, 2023

If you use the plugin on Gradle 8.2 you get warnings, that Project.getConvention() is deprecated and will be removed in Gradle 9.
As the plugin anyway requires Gradle 6.4+ and the Java plugin convention was replaced by the Java plugin extension in 4.10 already, it should be a quite straightforward change without conditional execution necessary.

@szpak
Copy link
Owner

szpak commented Jul 4, 2023

Yes, the plugin has switched to properties long time ago and probably:

SourceSetContainer javaSourceSets = project.convention.getPlugin(JavaPluginConvention).sourceSets

generates that warning. I will have to switch to JavaPluginExtension. Thanks for pointing it out.

@Vampire
Copy link
Contributor Author

Vampire commented Jul 4, 2023

Yes, that's the place

@szpak
Copy link
Owner

szpak commented Jul 5, 2023

Unfortunately, the sourceSets were added to JavaPluginExtension in Gradle 7.1, but the plugin is 6.4 compatible :-/

https://github.com/gradle/gradle/blob/f84dd110ff78fa9001ccb6ecb8def886d5e3fc5a/subprojects/plugins/src/main/java/org/gradle/api/plugins/JavaPluginExtension.java#L211-L213

I had to use the conditional logic + dynamic features of Groovy to handle that. One the CD process is migrated from maven to maven-publish, it will be possible to drop support for Gradle <7.1.

@szpak szpak added this to the 1.14.0 milestone Jul 5, 2023
@Vampire
Copy link
Contributor Author

Vampire commented Jul 5, 2023

Sorry, bad advice by me.
Just use the extension of type SourceSetContainer with name sourceSets on the project.
That was there in 6.4 and is still in 8.2.

szpak added a commit that referenced this issue Jul 6, 2023
It is an extension itself and is compatible also with Gradle 6.4.
@szpak
Copy link
Owner

szpak commented Jul 6, 2023

Just use the extension of type SourceSetContainer with name sourceSets on the project.

Cool, I didn't know SourceSetContainer is an extension. Thanks!

@Vampire
Copy link
Contributor Author

Vampire commented Jul 6, 2023

That's why you can directly use top-level sourceSets { ... } in a build script if the JVM ecosystem plugin is applied. :-)

@szpak szpak added the gradle label Sep 28, 2023
@szpak szpak closed this as completed in f7407dc Sep 28, 2023
@szpak
Copy link
Owner

szpak commented Sep 28, 2023

Implemented in 1.15.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants