Thanks Adam,

I added the line

subprojects.each {subproject -> evaluationDependsOn(subproject.name)}

which works like a charm. +1 on the evaluationDependsOnChildren().

On Sun, Aug 23, 2009 at 4:13 AM, Adam Murdoch <[email protected]> wrote:

>  Hi,
>
> I think if you replace dependsOnChildren() with evaluationDependsOn() or
> dependsOnChildren(true) things will work as you want them to.
>
> Have a look at:
>
> http://gradle.org/0.7/docs/userguide/multi_project_builds.html#sub:configuration_time_dependencies
> http://gradle.org/0.7/docs/javadoc/org/gradle/api/Project.html
>
> It looks like we don't have an evaluationDependsOnChildren() method. That
> might be nice for us to add.
>
>
>
> Levi Hoogenberg wrote:
>
> 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