Configuring tasks late in Gradle build lifecycle -


i have multiproject build. of projects in build produce test results. 1 project produces installer, , want project's artifacts include test results other projects. attempted (in project produces installer):

// empty test task, can make gathering of test results here depend on tests' having // been run in other projects in build task test << { }  def dependenttestresultsdir = new file( builddir, 'dependenttestresults' )  task gatherdependenttestresults( type: zip, dependson: test ) {      project.parent.subprojects.each { subproject ->          // find projects in build have testresults configuration         if( subproject.configurations.find { it.name == 'testresults' } ) {              // extract test results (which in zip file) directory             def tmpdir = new file( dependenttestresultsdir, subproject.name )             subproject.copy {                 ziptree( subproject.configurations['testresults'].artifacts.files.singlefile )                 tmpdir             }         }     }      // define output of task contents of tree     dependenttestresultsdir } 

the problem @ point when task configured, test tasks in other projects haven't run, artifacts don't exist, , messages during build this:

the specified zip file zip 'c:\[path project]\build\distributions\[artifact].zip' not exist , silently ignored. behaviour has been deprecated , scheduled removed in gradle 2.0 

so need involve configuration of task being delayed until test artifacts have been produced. idiomatic way achieve this?

i seem need address questions of nature quite gradle. think i'm missing conceptually.

in instance, should able make action adding << in

task gatherdependenttestresults( type: zip, dependson: test ) << {     // task code here } 

Comments