Quantcast
Channel: Gradle Forums - Latest posts
Viewing all articles
Browse latest Browse all 20478

Force rerun a task by another task

$
0
0

You need to break the chicken or egg problem. Use configurations to solve the problem.

project(':service') {
   configurations {
      allgenerated
   } 
   dependencies {
      allgenerated project(path: ':a', configuration: 'generated')
      allgenerated project(path: ':b', configuration: 'generated')
      allgenerated project(path: ':c', configuration: 'generated') 
   } 
} 
project(':a') {
   configurations {
      generated 
      allgenerated
   }
   dependencies {
      generated files({tasks.generate}) 
      allgenerated project(path: ':service', configuration: 'allgenerated')
   }
   task generate {
      outputs.dir "$buildDir/generated" 
      doLast {
         // this task just generates for project 'a' 
      } 
   }
   task doStuffWithAllGenerated {
      dependsOn configurations.allgenerated 
      doLast {
           // this task can "see" all the generated stuff 
           configurations.allgenerated.each {...}
       } 
   } 
}

Viewing all articles
Browse latest Browse all 20478

Latest Images

Trending Articles



Latest Images