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

pitest version seems to be ignored in build.gradle.kts #244

Open
christophsturm opened this issue Dec 10, 2020 · 6 comments
Open

pitest version seems to be ignored in build.gradle.kts #244

christophsturm opened this issue Dec 10, 2020 · 6 comments

Comments

@christophsturm
Copy link
Contributor

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:

classPathElements=[/Users/christoph/.gradle/caches/modules-2/files-2.1/org.pitest/pitest/1.5.2/9a05e244abe423b3d0e6c9247d50fe02f63f01e0/pitest-1.5.2.jar,....
@christophsturm
Copy link
Contributor Author

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

@szpak
Copy link
Owner

szpak commented Dec 12, 2020

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:

  • there is "something wrong" with the way you configure the plugin in kts (I don't use Kotlin-based configuration and I don't know what could be wrong)
  • there is "something wrong" with the way I use the extension to resolve PIT dependencies - in the register closure/action (even though it works for Groovy) - can I do it later/more lazy?
  • something else :-)

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?

@christophsturm
Copy link
Contributor Author

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

@christophsturm
Copy link
Contributor Author

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.

@szpak
Copy link
Owner

szpak commented Jan 6, 2021

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.

@ThomGeG
Copy link

ThomGeG commented Jul 18, 2022

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"))

dependencies.add(project.dependencies.create("org.pitest:pitest-command-line:${extension.pitestVersion.get()}"))

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 #313

@szpak szpak changed the title pitest version seems to be ignored pitest version seems to be ignored in build.gradle.kts (Kotlin configuration) Jul 19, 2022
@szpak szpak changed the title pitest version seems to be ignored in build.gradle.kts (Kotlin configuration) pitest version seems to be ignored in build.gradle.kts Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants