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 build cache not working if the absolute path changes #314

Closed
SidB3 opened this issue Aug 3, 2022 · 4 comments
Closed

pitest build cache not working if the absolute path changes #314

SidB3 opened this issue Aug 3, 2022 · 4 comments
Milestone

Comments

@SidB3
Copy link
Contributor

SidB3 commented Aug 3, 2022

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)

@SidB3 SidB3 changed the title pitest task is rerun with same task inputs if the absolute file path of the project changes pitest build cache not working if the absolute path changes Aug 3, 2022
@C-Otto
Copy link
Contributor

C-Otto commented Aug 3, 2022

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'

@C-Otto
Copy link
Contributor

C-Otto commented Aug 3, 2022

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.

@szpak
Copy link
Owner

szpak commented Aug 8, 2022

@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 gradle/gradle#12351 seems to be still open, so @SidB3 change in #315 seems to be more accurate.

@szpak szpak added this to the 1.7.5 milestone Aug 19, 2022
@szpak
Copy link
Owner

szpak commented Aug 19, 2022

Implemented in #315 and available in 1.9.0.

@szpak szpak closed this as completed Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants