Open christophsturm opened 3 years ago
to reproduce you can use an opensource project of mine, and set pitest version to 1.6.1 here: https://github.com/christophsturm/r2dbcfun/blob/main/build.gradle.kts#L154
Hmm, strange. I have the regression tests for that and they pass. I even extended assertion to verify that pitest-${pitVersion}.jar
is displayed during execution and it works. To be sure, I manually checked GPP 1.5.2 with some project with build.gradle in Groovy and requested non-existing PIT version. As expected it failed:
> Could not resolve all files for configuration ':pitest'.
> Could not find org.pitest:pitest-command-line:1.99.0.
With debugger, I see that your values are not set at all when I bind them to the task (in configureTaskDefault()
), however, there are accessible later on, then the task is executed. Unfortunately, to configured plugin dependencies I have to know those values earlier. For some reasons it works fine with Groovy-based configuration.
The options I see:
If you have more extensive Kotlin-based configuration knowledge maybe you can suggest something. Alternatively, maybe you could consult the Gradle forum to get a hint?
strange thing is that with the build file from functest it works.
in my own project can put anything into pitestVersion, and when i run gradle dependencies it still shows 1.5.2
I think I found the reason. it only happens with the kotest pitest plugin. probably it has a dependency on pitest and that is stronger than the pitest version that the Gradle plugin creates.
Thanks for digging that topic! That, indeed, might be the reason.
Nevertheless, it's quite interesting as kotest (in master) seems to declare pitest 1.4.11 dependency. 1.5.2 seems to be taken from my plugin - as a default value. Only an ability to override it from the configuration seems to be problematic. Maybe kotest gets that value (version) at the beginning, but I haven't found any evidence in code.
You might want to report it to the kotest developers. Maybe there will have a better idea how to solve your case.
I've also had much of the same problem in a non-Kotlin project of mine (can't easily share because it's closed source) that otherwise doesn't have pitest anywhere in the graph.
I managed work around the plugin not picking up the specified version by just mimicking what the code would otherwise be trying to do with it:
project.configurations.pitest.dependencies.add(project.dependencies.create("org.pitest:pitest-command-line:1.9.2"))
Rather hacky, but it's getting the job done for the time being if anybody else needed a quick-fix.
EDIT: Not an issue for me anymore with the latest version of the plugin. Presumably it's been fixed by https://github.com/szpak/gradle-pitest-plugin/pull/313
I tried to use the 1.5.2 plugin with the new pitest version (
pitestVersion.set("1.6.1")
) but looking at the reports it still said "pitest 1.5.2". when running in verbose mode I can see that the 1.5.2 jar files are added to the classpath: