szpak / gradle-pitest-plugin

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

Add enabled property on the pitest task #304

Closed marcingrzejszczak closed 2 years ago

marcingrzejszczak commented 2 years ago

Currently there's no way to conditionally disable the task

szpak commented 2 years ago

Marcin, first of all, I would like to thank you for taking your time to voice your suspicion. However, let me allow to explain you one important thing.

It is a PIT plugin for Gradle, not for Maven. You do not an extra property in the plugin to be configured in your XML to just "conditionally disable the task". In Gradle, you can do that just with:

tasks.named('pitest').configure {
    onlyIf { /*your condition expressed in real Groovy, not in an XML substitute */ }
}

And you can do that for any task in your project.

Please let me know, if it satisfies your needs. If not, I will be happy to try to help you with your case.

marcingrzejszczak commented 2 years ago

I tried doing pitest.onlyIf but it didn't work so I guess I misused the beauty of Gradle ;) If that snippet works then we can close the issue (you could document this in the docs BTW)