Sample needed please on parallel build


(jim northrop) #1

can anyone provide a sample of how i could use parallel threads or tasks to build groovydocs concurrently with javadocs ? this sounds like it might be possible but cannot get the hang of how we might do it


(Peter Niederwieser) #2

Currently, Gradle will only execute tasks from different projects in parallel. You can enable parallel execution with the ‘–parallel’ command-line option.


(jim northrop) #3

silly me - i thought something like this might do the trick (after fixing settings.gradle and gradle.properties for multi work):

repositories {
    mavenCentral()
    //add repositories for optional dependencies
    mavenRepo urls: ["http://repository.jboss.org/maven2/"]}
  dependencies {
    compile localGroovy()
    compile "org.codehaus.gpars:gpars:1.0.0"
}
  task doItFaster<<
      ///dependsOn: [groovydoc])
 { tsk->
 println "doItFaster()="+tsk;
 GParsPool.withPool { pool->
  println "doItFaster()=pool="+pool;
  groovydoc().asynch();
  javadocs().asynch();
   javadocJar().asynch();
 }
}

though possibly not :{


(Peter Niederwieser) #4

You can use GPars within your task, but a task can’t call other tasks. Bad things can happen if you do.