You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add ability to easily set reproducible lastModified values on Copy tasks' output files.
Expected Behavior
The FileCopyDetails object passed to Actions registered using CopySpec.eachFile() should allow the implementer to specify a lastModified value for the destination file, and when specified that value should be set on the destination file. E.g:
void setLastModified(long time);
Current Behavior
While the FileCopyDetails already includes first class support for setting destination file attributes like setMode(int mode) and the archive tasks have first class support for reproducible lastModified values with the preserveFileTimestamps option, there is currently no mechanism providing first class support to easily set reproducible lastModified values on Copy tasks' output files.
And yes, as pointed out in #1252, with trouble one can hack a solution together that assigns lastModified values to the outputs, but it would be so much better if the Gradle DSL provided simple first class support for doing this simple thing.
Context
To increase our build's total build avoidance, I've been trying to make our tasks' inputs and outputs more reproducible, to thus get more up-to-date avoidance and cache hit based avoidance.
In this process I've run into a couple of compiler/code generator tool limitations whereby:
all the input files need to be colocated in a single source directory
the input files' lastModified dates are recorded in the output files
We've been using a copy task to assemble the single source directory for the compiler, but this has introduced the unfortunate side effect that the relocated input files' lastModified dates reflect the time of the copy and as a consequence the output files differ depending on when that (uncached) copy was performed. This unnecessary difference then cascades down the task dependency chain preventing cache hits and the related build avoidance.
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you're interested in how we try to keep the backlog in a healthy state, please read our blog post on how we refine our backlog. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.
This issue has been automatically closed due to inactivity. If you can reproduce this on a recent version of Gradle or if you have a good use case for this feature, please feel free to reopen the issue with steps to reproduce, a quick explanation of your use case or a high-quality pull request.
Add ability to easily set reproducible lastModified values on Copy tasks' output files.
Expected Behavior
The FileCopyDetails object passed to Actions registered using CopySpec.eachFile() should allow the implementer to specify a lastModified value for the destination file, and when specified that value should be set on the destination file. E.g:
Current Behavior
While the
FileCopyDetails
already includes first class support for setting destination file attributes likesetMode(int mode)
and the archive tasks have first class support for reproducible lastModified values with thepreserveFileTimestamps
option, there is currently no mechanism providing first class support to easily set reproducible lastModified values on Copy tasks' output files.And yes, as pointed out in #1252, with trouble one can hack a solution together that assigns lastModified values to the outputs, but it would be so much better if the Gradle DSL provided simple first class support for doing this simple thing.
Context
To increase our build's total build avoidance, I've been trying to make our tasks' inputs and outputs more reproducible, to thus get more up-to-date avoidance and cache hit based avoidance.
In this process I've run into a couple of compiler/code generator tool limitations whereby:
We've been using a copy task to assemble the single source directory for the compiler, but this has introduced the unfortunate side effect that the relocated input files' lastModified dates reflect the time of the copy and as a consequence the output files differ depending on when that (uncached) copy was performed. This unnecessary difference then cascades down the task dependency chain preventing cache hits and the related build avoidance.
The text was updated successfully, but these errors were encountered: