On 17/07/10 12:05 AM, Levi Hoogenberg wrote:
Hello,

I've just upgradled my build file to 0.9-preview-3 and I ran into some problems with the copy spec's from method. I've got a working build again, but it would be nice if someone could answer the following questions:

   1. Should

      from(someDir).include('**/*.java')

      have the same effect as

      from(someDir) {
          include '**/*.java'
      }

      ? (For me it doesn't, so I'm sticking to the second form ATM.)


They won't necessarily do the same thing. Calling from(someDir) adds someDir to the set of source for the copy spec and returns the spec. Calling from(someDir) { ... } creates a child copy spec and configures it using the provided closure.

So, for example:

from 'a'
from('b').include('**/*.java')

this includes '**/*.java' from 'a' and 'b'

from 'a'
from('b') { include '**/*.java' }

this includes everything from 'a', and only '**/*.java' from 'b'

Looking at the first example, I wonder if from() should always create and return a child copy spec, because the code certainly looks like you want everything from 'a' and only '**/*.java' from 'b'. But then, what should something like this do:

from('a').from('b').include('**/*.java')

Not sure. I think I prefer having every form of from() create a child spec.

   1. When building an archive, should it be possible to use
      from(someDir) without any configuration? This works for my
      source zip files, but not for my project's distribution (in the
      latter case, nothing gets added to the zip file until I add
      include '**').


Include '**' should be the default, so the task should work without have to specify any includes. Do you have some more detail about how the archive task is configured?


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz

Reply via email to