[GRADLE-2550] CopySpec eachFile does not visit child specs added with "with" Created: 13/Nov/12  Updated: 26/Mar/14  Resolved: 26/Mar/14

Status: Resolved
Project: Gradle
Affects Version/s: 1.2
Fix Version/s: 2.0-rc-1

Type: Bug
Reporter: Michael Meisel Assignee: Perryn Fowler
Resolution: Fixed Votes: 1


 Description   

When using "with" to add a child CopySpec to a Copy task, the eachFile visitor does not visit the files in the child spec. Here is a simple example:

build.gradle
task one(type: Copy) {
    from 'src'
    into 'target'
}

task two(type: Copy) {
    with one
    into 'newtarget'
    eachFile { println("two: $it.name") }
}

Where the `src` directory has some arbitrary files in it. I would expect to see the output lines beginning with `two`, but instead I get:

$ gradle two
:two

BUILD SUCCESSFUL


 Comments   
Comment by Michael Meisel [ 15/Jan/13 ]

In addition to eachFile, this bug also seems to affect the exclude method. The exclude patterns set on the parent spec (task two in this example) do not propagate to the child spec (task one).

Comment by Michael Meisel [ 15/Jan/13 ]

I should also mention that this bug still exists in 1.3.

Generated at Wed Jun 30 12:25:00 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.