szpak / gradle-pitest-plugin

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

Set main for JavaExec using mainClass property #289

Closed bondolo closed 3 years ago

bondolo commented 3 years ago

Setting main is deprecated in Gradle 7.X and will be removed in Gradle 8.0. This sets the main class using the mainClass property.

szpak commented 3 years ago

Thanks @bondolo! It looks good, but I'm thinking about backward compatibility. Our main CI is currently broken (#290) and I wonder, if all the tests (except "PitestPluginGeneralFunctionalSpec > enable PIT plugin when on classpath and pass plugin configuration to PIT" which is broken due to the Bintray shutdown - see https://github.com/hcoles/pitest-plugins/pull/4) work on your machine (including those testing compatibility with older Gradle versions)?

./gradlew check funcTest

bondolo commented 3 years ago

I had run the default tests with ./gradlew clean build which seemed to pass.

Running the suggested ./gradlew check funcTest produces some test failures:

  java.lang.NoSuchMethodError: info.solidsoft.gradle.pitest.PitestTask.getMainClass()Lorg/gradle/api/provider/Property;
                            at info.solidsoft.gradle.pitest.PitestTask.<init>(PitestTask.groovy:245)
                            at org.gradle.internal.instantiation.AsmBackedClassGenerator.newInstance(AsmBackedClassGenerator.java:179)
                            at org.gradle.internal.instantiation.AbstractClassGenerator$GeneratedClassImpl$GeneratedConstructorImpl.newInstance(AbstractClassGenerator.java:395)
                            at org.gradle.internal.instantiation.DependencyInjectingInstantiator.newInstance(DependencyInjectingInstantiator.java:49)
                            at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:72)
                            ... 140 more

At least one of the failures is caused by the disappearance of Bintray:

org.gradle.api.resources.ResourceException: Could not get resource 'https://dl.bintray.com/szpak/pitest-plugins/org/pitest/plugins/pitest-plugin-configuration-reporter-plugin/0.0.2/pitest-plugin-configuration-reporter-plugin-0.0.2.pom'

So it looks like more work will be needed to complete this fix.

szpak commented 3 years ago

I needed to lower Java version to 8 to reproduce the problem with Gradle 5.6. In the end, the new minimal supported Gradle version is 6.4 That's probably fine as it was released May 05, 2020 and people should be able to migrate to some later 6.x.

Nevertheless, having some time, I will take a look if - using some Groovy hacks - wouldn't be easy to support both the cases.