Rene Groeschke wrote:
Hi there,
I've just added a new zip Task to my project. This task should create a zip with all third-party libs in the lib folder of that zip. actually my task looks like the following:

task createBinZip(type: Zip) {
    classifier = 'bin'
files(configurations.groovy) fileSet(dir: 'build'){
           include "**/*.jar"
       }

        fileSet(dir: 'build/classes'){
        include "**/*.sh"
    }
}

In the snippet above I add all files in the configuration groovy to my zip. but how can I put all these third party libs to a special folder in that zip for example called "libs".

You can't easily do this yet. You need to copy them somewhere and then use a zipfileset to include them in the 'libs' folder of the archive.

We plan to make this better in 0.7, so you could do something like:

task createBinZip(type: Zip) {
   libs {
       from(configurations.groovy)
       from('build') {
           include '**/*.jar'
       }
   }
   from(someDir) {
       ...
   }
}

And can anybody explain, what's the difference between:

files(configurations.groovy) and just
configurations.groovy ?


'files(configurations.groovy)' adds the 'groovy' configuration as a file collection to be included in the archive, and 'configurations.groovy' is simply a property reference to the 'groovy' configuration, which does nothing with it. The second statement won't actually include the configuration in the archive.

We could probably do some DSL magic so that you can include a file collection simply by referencing it in the archive's configure closure, so that the 2 statements above do the same thing. I'm not sure it's worth it - it could be just as effective, I think, to simply choose a better name for the files() method.

In Section 15.12. of the gradle docs I've found the following sentence: "For example, the Configuration objects of a project implement FileCollection . You can also obtain a FileCollection using the method Project.files()"

So instead of writing "files(configurations.groovy)" shouldn't it be enough to write "configurations.groovy" in my zip task? What is the meaning of "FileCollection Project.files(FileCollection fc)" ?


This would return a FileCollection which contains the same files as the supplied collection.


Adam


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

   http://xircles.codehaus.org/manage_email


Reply via email to