eerohele / saxon-gradle

A Gradle plugin for running XSLT transformations with Saxon
MIT License
16 stars 6 forks source link

The tasks inputFiles property has absolute path sensivity #29

Open dgeissl opened 3 years ago

dgeissl commented 3 years ago

https://github.com/eerohele/saxon-gradle/blob/master/src/main/groovy/com/github/eerohele/SaxonXsltTask.groovy#L744

just needs a @PathSensitive(PathSensitivity.RELATIVE) to be able to reuse gradle caching when building the project from different folders of the file system.

eerohele commented 3 years ago

I think I understand the issue, but can you give me an example that reproduces it?

dgeissl commented 2 years ago

Sorry for the long wait. Unfortunately I don't have time to follow the topic anymore. It's basically this way.

You take a gradle project on your local machine, enable the local build cache and execute the saxon task doing some transformation. Subsequent task executions should already be cached even if you do a gradle clean in between or deleted the target file or folder. The output file should not be created by the task but rather be restored from the build cache.

What the PathSensivity option does is, that the same cache restore can apply if you just rename the folder your current project lies in. Without PathSensivity.RELATIVE the absolute path of the file will be taken as input parameter and the result will not be restored but the task will be executed in order to get the same result again. With that option the file name will only be cached with the path inside the projects file structure and thus one will have a match in the build cache.

This is an optimization that will be more important when using remote build caches like companies often do, cause the developers usually all have their own local folder structure and the project will never be in the same place, thus negating the opportunity to participate in the remote caching.