Hi,

I would like to add a task that has a configuration dependency on all of its
declaring project's subprojects. Is this possible?

The reason I'm asking: I'm browsing through the user guide to find ways to
improve my build scripts. One thing that I thought would be nice to improve
upon is the way that archives are built. Right now, my root project contains
the following:

dependsOnChildren()

task('dists') << {
    ant {
        zip(destfile: ...) {
            subprojects.each {project ->
                subproject.configurations.distribution.resolve().each
{dependency ->
                    zipfileset(prefix: 'lib', file: dependency)
                }
            }
        }
    }
}

I'd like to change this to

task distribution(type: Zip, dependsOn: subprojects*.dists) {
    // same subproject.each {...}
}

but I may not call the resolve() method. I think that I am allowed to use it
after all subprojects have been configured - is that correct? And if it is,
how do I declare that I would like to add the task at that point? I've been
looking at project evaluation listeners, which felt like they solved a
related but different use case, and a build listener, which I couldn't get
to work.

Thanks in advance,
  Levi

Reply via email to