Open davidburstrom opened 2 years ago
It sounds sensible. Currently the plugin is applied only on subprojects with the Java plugin, but no test source in fact could lead to that behavior. Nevertheless, in a corner case, there could be only some test content attached from some other subprojects (e.g. with the acceptance tests).
Do you think that checking if additionalClasspath
has some entries would be sufficient? Or you have some better proposal?
Btw, it is slightly related to #292 (in terms of behavior).
The additionalClasspath
has entries from the main source set (which for all practical purposes definitely should have entries) as well as test runtime classpath elements, so that won't work.
I was thinking that it should be sufficient to check if project.objects.fileCollection().from(extensions.testSourceSets.get() as Set<SourceSet>)*.allSource)
is non-empty, but haven't verified that theory.
Yes, testRuntimeClasspath
extends the main classpath.
Maybe, but source sets were always somehow specific for me and it would have to be verified :-).
It is of course true that the test classpath can contain the test cases, imported from another project. I'm not sure if that is a sufficiently common case...
Using @SkipWhenEmpty @InputFiles
on a property populated accordingly should result in a NO-SOURCE
status. Not that it's critical that the status is the same as for a Test
task.
Gradle Test
solves it by having a testClassesDirs
property which is separate from the test runtime classpath.
Any plans of when this would be available.
So far I have to exclude certain modules from running the pitest task.
For a regular Gradle
test
task from the Java plugin, if there is no test source, it will just be skipped indicatingNO-SOURCE
. In contrast, Pitest tasks will fail withCoverage generation minion exited abnormally
. I propose that the Pitest tasks should behave similarly as thetest
task. As for backwards compatibility, this would cause e.g. CI builds that are currently failing to pass instead, but I have a hard time seeing that as a problem.The current workaround I use is pretty hard-coded (and deals with configuration caching, hence it looks a little weird):