[GRADLE-2270] Sync task does not remove not copied files if the UP-TO-DATE check is successful Created: 02/May/12 Updated: 07/Feb/17 Resolved: 07/Feb/17
Consider the example in the Gradle User Guide:
If you run this task and then manually copy some other file in $buildDir/libs, then run this task again, you'll see that the task is UP-TO-DATE and no action is taken. Instead, I would expect the manually copied file to be removed. This should actually be the difference between a Copy task and a Sync task.
The problem is in the UP-TO-DATE check, which should be made differently for the Sync task. In fact, if I remove one of the copied JARs and re-run the task, then the UP-TO-DATE check fails and the manually added file is correctly removed.
|Comment by Kim A. Betti [ 04/Apr/16 ]|
Does the sync task work at all? I'm trying it out with Gradle 2.12 and even when preceding tasks are not up-to-date it still fails to remove files not copied.
|Comment by Jendrik Johannes (Inactive) [ 16/Sep/16 ]|
The issue came up recently again. Here are some additional notes and a use case:
Workaround: create custom tasks that explicitly define the output directory as an input so it can detect changes:
2. Manually delete one file from buildDir/someOutput
3. Re-run the sync task and it says up to date. Per our understanding if anything in a or the output changes the task should re-run. Here is a coded example that will also recreate the issue.
|Comment by Benjamin Muschko [ 15/Nov/16 ]|
As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.
We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.
Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:
We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!
|Comment by Mauro Molinari [ 15/Nov/16 ]|
This is still an issue in recent Gradle.
|Comment by Eric Wendelin [ 07/Feb/17 ]|