-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Skip Updating CopyComplete Marker When Not Necessary #6698
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
Conversation
Forgind
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is right. First, I imagine things that don't technically move anything around but create links still should have it marked as if something were copied. More importantly, the copy step itself sometimes throws an exception if the file doesn't need to be copied, so CopiedAtLeastOneFile should be set after that.
b847c3e to
8e6fa76
Compare
Forgind
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Co-authored-by: Forgind <[email protected]>
ladipro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could also be done by having an ITaskItem[] that contains all files that were actually copied.
Why doesn't CopiedFiles work here?
Lines 136 to 140 in 65e44d9
| /// <summary> | |
| /// The subset of files that were successfully copied. | |
| /// </summary> | |
| [Output] | |
| public ITaskItem[] CopiedFiles { get; private set; } |
src/Tasks/Copy.cs
Outdated
| } | ||
|
|
||
| // Files were successfully copied or linked. Those are equivalent here. | ||
| CopiedAtLeastOneFile = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super-nit: This line is not indented properly.
Found an answer in the issue! Wondering if the name of the new parameter shouldn't be more explicit in encoding the difference between it and non-empty |
|
@ladipro Any suggestions? I considered |
|
Maybe What exactly is the difference between non-empty |
|
CopiedFiles is nonempty if either it copies files (in which case this is true) or it notices it doesn't have to copy files because it's up-to-date, in which case this would be false. |
|
Thank you, how about |
ladipro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
|
ChangedFileContents? UpdatedAtLeastOneFile feels to me like it's specifically overwriting, whereas this could be making a new file where there wasn't one before. |
|
|
|
It isn't a huge deal—better would've been to change CopiedFiles, but that isn't an option. I know I've also been annoyed sometimes when there was too much haggling over names 🙂 Whatever you decide, I'm fine with @benvillalobos |
Yeah it gets particularly haggle-some when its public and therefore shouldn't be changed once it's in. |
3ed746e to
f1e3b47
Compare
Fixes #dotnet#6576 ### Context dotnet#6576 revealed that the `.copycomplete` file marker is updated even when the `Copy` task in `_GetCopyFilesMarkedLocal` doesn't _actually_ copy anything. This can mess with incremental builds. ### Changes Made This change adds an output parameter, `CopiedAtLeastOneFile` to the `Copy` task that the `Touch` task is now conditioned off of. ### Testing Tested local builds ### Notes This could also be done by having an ITaskItem[] that contains all files that were actually copied. Then the touch task could check if that item were empty. I opted for the straightforward route since the ITaskItem[] solution isn't needed yet, and this implementation can easily be changed when we do need that. Co-authored-by: Forgind <[email protected]>
Fixes #6576
Context
#6576 revealed that the
.copycompletefile marker is updated even when theCopytask in_GetCopyFilesMarkedLocaldoesn't actually copy anything. This can mess with incremental builds.Changes Made
This change adds an output parameter,
CopiedAtLeastOneFileto theCopytask that theTouchtask is now conditioned off of.Testing
Tested local builds
Notes
This could also be done by having an ITaskItem[] that contains all files that were actually copied. Then the touch task could check if that item were empty. I opted for the straightforward route since the ITaskItem[] solution isn't needed yet, and this implementation can easily be changed when we do need that.