[GRADLE-1643] copy task does not copy empty dirs when no files present Created: 25/Jun/11 Updated: 18/Nov/16 Resolved: 18/Nov/16 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | 1.0-milestone-3 |
Fix Version/s: | None |
Type: | Bug | ||
Reporter: | Szczepan Faber | Assignee: | Pepper Lebeck-Jobe |
Resolution: | Duplicate | Votes: | 3 |
Attachments: | copyDirs.tgz |
Description |
Copy task does not act when there are zero files present in inputs even though there are empty folders present in the inputs. This works differently than vanilla copy spec script block. May that be a design choice? See the attached example. Reported initially at zendesk: A CopySpec with only directories in its source appears to do nothing, even though includeEmptyDirectories is supposed to be true as of gradle 1.0-m2. The key difference for behavior is whether any file is present. If, in the attached example, I touch "source/file", the copy works as expected. Possible workaround: Use plain task and the copy script block. |
Comments |
Comment by Peter Niederwieser [ 13/Jul/11 ] |
My guess is that it wasn't an intentional design choice; maybe it's just a consequence of having a @SkipWhenEmpty annotation on AbstractCopyTask.getSource. |
Comment by Matthew J. McCullough [ 21/Jul/11 ] |
This similar type of behavior (not tracking empty directories) is a constant source of pain with Git and is a common complaint by students. Given that 4 years of student agony in the Git space, I'd suggest we "honor" empty directories. Directories can be thought of as being just as important as files in some builds. |
Comment by Adam Murdoch [ 24/Jul/11 ] |
@matthew, the copy task does track empty directories. There is a bug (hence this issue) where if the input to the copy task contains only directories and no files at all, the task does nothing. But, if there is at least one input file (as is usually the case), then the copy task will copy the empty directories. @peter, you're exactly right. We could fix this issue by removing the annotation. |
Comment by Szczepan Faber [ 25/Jul/11 ] |
Just removing the annotation has some side effects we should avoid I think:
Right? |
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 Pepper Lebeck-Jobe [ 18/Nov/16 ] |
Please subscribe to https://github.com/gradle/gradle/issues/894 to follow the future of this bug report. |
Comment by Eric Wendelin [ 18/Nov/16 ] |