At the end, the solution I have found to obtain the list of lib paths
of dependents projects is the following.

List getProjectsDependents( Project prj ) {
    dPrjs = new ArrayList()

    
prj.tasks.buildDependents.taskDependencies.getDependencies(prj.tasks.buildDependents).each
{ o ->
      if( o.path.startsWith(":"+prj.name) == false ){
        dPrjs.add(o.getProject())
      }
    }
  return dPrjs
}

List getProjectsDependentsLibs( List prjs ) {
  libs = new ArrayList()
  prjs.each { prj ->
    libs.add( "$prj.projectDir/lib" )
  }
  return libs
}

subprojects {
    apply plugin: 'java'

    ...

    task list_dependents << { task ->
      getProjectsDependentsLibs(getProjectsDependents(task.project)).each
{ o -> println o }
    }
}


Is there a better solution?

Thanks

Walter


On 13 May 2010 15:31, Walter Di Carlo <[email protected]> wrote:
> Hi,
>
> I am trying to customize the uploadArchives task in order to copy the
> generated jar into the lib folder of the dependents project. So,
> having the follwoing structure
>
> prjA
>   lib
>   dist
> prjB
>   lib
>   dist
>
> where prjA depends on prjB. Then I would like to copy the generated
> jar in the prjB/dist into the prjA/lib.
>
> As first step I am trying to figure out ho to obtain the list of
> depentents project using the following task
>
> subprojects {
>    apply plugin: 'java'
>    ....
>    task list_dependents << { task ->
>             def t = task.project.tasks.buildDependents
>             def myset = t.taskDependencies.getDependencies(t)*.path as Set
>             myset.each { o -> println o }
>    }
> }
>
> The problem is the it returns only the current project. What am I
> missing? Note that I am using the gradle 0.9-preview
>
> Regards,
>
> Walter
>

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

    http://xircles.codehaus.org/manage_email


Reply via email to