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

Add FileCopyDetails.setLastModified() - to set the destination lastModified value for a copied file #9164

Open
steffenyount opened this issue Apr 18, 2019 · 3 comments
Labels
a:feature A new functionality in:file-tasks copy sync zip tar rename delete

Comments

@steffenyount
Copy link

steffenyount commented Apr 18, 2019

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:

  1. all the input files need to be colocated in a single source directory
  2. 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.

@steffenyount steffenyount added the a:feature A new functionality label Apr 18, 2019
@stale
Copy link

stale bot commented Aug 30, 2020

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.

@stale stale bot added the stale label Aug 30, 2020
@stale
Copy link

stale bot commented Sep 20, 2020

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.

@stale stale bot closed this as completed Sep 20, 2020
@ghale ghale reopened this Mar 16, 2021
@stale stale bot removed the stale label Mar 16, 2021
@ljacomet ljacomet added in:file-tasks copy sync zip tar rename delete and removed in:core DO NOT USE labels Nov 29, 2021
@aalmiray
Copy link
Contributor

I'm interested in this feature. Stale bot stay away for one more year.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:feature A new functionality in:file-tasks copy sync zip tar rename delete
Projects
None yet
Development

No branches or pull requests

5 participants