I don't know if it's the best way but this is what I've done to zip an entire project tree's source files (including build.gradle, etc.):

task sourceZip(type: Zip) {
    classifier = 'sources'

    from( '.' ) {
        include 'build.gradle'
        include 'settings.gradle'
    }

    subprojects.each {subproject ->

        // Include project specific files that
        // aren't source.
        from( subproject.projectDir.name ) {
            include 'build.gradle'
            into subproject.projectDir.name
        }

        // Include the source files.
        from( subproject.sourceSets.main.java ) {
            into subproject.projectDir.name
        }
        from( subproject.sourceSets.main.resources ) {
            into subproject.projectDir.name
        }
    }
}

Not an exact answer but maybe it gives you some other ideas to try. The tricky part was that I still wanted all of the sub-project sources in sub-project directories, thus the broken out from() { into } stuff.

-Paul

On 10/15/2010 10:53 AM, Etienne Studer wrote:
Hi

I'm trying to create a zip task in order to zip the sources of all my source 
sets. How do I achieve this? The following things don't work:

// without tests
task zip(type: Zip) {
     classifier = 'src'
     from project.sourceSets.main.java.srcDirs
}

// with tests
task zip(type: Zip) {
     classifier = 'src'
     from project.sourceSets
}

Thanks for any help, Etienne


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

     http://xircles.codehaus.org/manage_email




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

   http://xircles.codehaus.org/manage_email


Reply via email to