gradle-pitest-plugin
gradle-pitest-plugin copied to clipboard
pitest build cache not working if the absolute path changes
Steps to reproduce:
- Clone a project with pitest to a folder "A" and run pitest task
- Run pitest task again and the build cache kicks in and reports FROM-CACHE as expected
- Clone the same project to a folder "B" and run pitest task
- Since the absolute file paths have changed, pitest task is rerun run again with a different cache key
This causes CI builds to rerun pitest for every build when there are no code updates
Additional information: Gradle version - 7.5
Attaching sample project to run the pitest task sample_building_java_applications-kotlin-dsl.zip
Running from two different folders produces two different cache keys
Stored cache entry for task ':app:pitest' with cache key 4668219a852060cc33eb7756bcde035c
Stored cache entry for task ':app:pitest' with cache key 05465e68091575f0fe62c6e51188307c
From my cursory knowledge of gradle plugin development, I see no issues in the PitestTask.groovy file. All file properties are annotated with @PathSensitive(PathSensitivity.RELATIVE)
Task ':application:pitest' is not up-to-date because:
Value of input property 'additionalClasspathFilePath' has changed for task ':application:pitest'
Value of input property 'defaultFileForHistoryDataPath' has changed for task ':application:pitest'
I don't know a whole lot about gradle plugins, but it seems these two methods/properties are not in use? I managed to get things working by simply removing them.
@C-Otto Looking at the field level, there is:
//Workaround with @Internal for "Unable to store input properties for task" - https://github.com/gradle/gradle/issues/12351
@Internal
final RegularFileProperty additionalClasspathFile
And https://github.com/gradle/gradle/issues/12351 seems to be still open, so @SidB3 change in #315 seems to be more accurate.
Implemented in #315 and available in 1.9.0.