szpak / gradle-pitest-plugin

Gradle plugin for PIT Mutation Testing
http://gradle-pitest-plugin.solidsoft.info/
214 stars 58 forks source link

convention usage must be removed #343

Closed Vampire closed 1 year ago

Vampire commented 1 year ago

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 commented 1 year ago

Yes, the plugin has switched to properties long time ago and probably: https://github.com/szpak/gradle-pitest-plugin/blob/c97fe8a7575674681badf5489712973effecd6a0/src/main/groovy/info/solidsoft/gradle/pitest/PitestPlugin.groovy#L110

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

Vampire commented 1 year ago

Yes, that's the place

szpak commented 1 year ago

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.

Vampire commented 1 year ago

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 commented 1 year ago

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

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

Vampire commented 1 year ago

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

szpak commented 1 year ago

Implemented in 1.15.0.