Adam Murdoch <mailto:adam.murd...@gradleware.com>
13 February 2014 8:06 am



It’s just a bug, I would think. The pattern should be relative to the source path, not the destination path. An interesting question is what to do with those files whose name is transformed in some way (eg using rename()) - is the pattern applied before or after transformation?
I can see cases where either would be the most convenient for the user. However, I think using the original name is probably the easiest to reason about and will yield the best predictability.

Raised http://issues.gradle.org//browse/GRADLE-3022


--
Adam Murdoch
Gradle Co-founder
http://www.gradle.org
VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting
http://www.gradleware.com



Luke Daley <mailto:l...@ldaley.com>
11 February 2014 10:04 am
Hi,

Would you expect the following to pass?

        given:
        file("a/b.txt") << "\$foo"

        when:
        buildScript """
            task c(type: Copy) {
                from("a") {
                    filesMatching("b.txt") {
                        expand foo: "bar"
                    }
                    into "nested"
                }
                into "out"
            }
        """

        then:
        succeeds "c"

        and:
        file("out/nested/b.txt").text == "bar"


It doesn't. It turns out that filesMatching matches the relative destination path, so it needs to be filesMatching("nested/b.txt"). I find this a little surprising.

It seems like it would be more predictable to use the relative path to the file from the nearest 'from' statement. What's the rationale for the current behaviour?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to