On 3 Jan 2012, at 18:59, Szczepan Faber wrote:

1. why not using configurations.runtime.files( spec ) to get the external
artifacts?

I missed that, that should do.

2. the taskGraph/subprojects iteration I cannot comment without testing
first. There might be a better way.

If the above mechanism is lazy, the taskGraph stuff should be unnecessary because we shouldn't be triggering a resolve.


Cheers!

On Tue, Jan 3, 2012 at 7:17 PM, Luke Daley <[email protected]>wrote:

Say you wanted to create a zip of all external (i.e. not project
dependencies) runtime dependencies, how would you do it?

This is pretty awkward. This is the best I can come up with:

task zipDeps(type: Zip) { task ->
gradle.taskGraph.whenReady { taskGraph ->
    if (taskGraph.hasTask(':zipDeps')) {
        def projectNames = rootProject.subprojects*.name
        def artifacts = new HashSet()
        subprojects.each { subproject ->
subproject.configurations.runtime.resolvedConfiguration.resolvedArtifacts.each { artifact ->
                def dependency = artifact.moduleVersion.id
                if (!projectNames.contains(dependency.name)) {
                    artifacts << artifact.file
                }
            }
        }

        task.from artifacts
    }
}
}

Am I missing something?

Luke Daley
Principal Engineer, Gradleware
http://gradleware.com




--
Szczepan Faber
Principal engineer@gradleware
Lead@mockito


--
Luke Daley
Principal Engineer, Gradleware
http://gradleware.com
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to