title: Gradle doFirst() Execution Order
body: <p>How is the order of the doFirst method determined in a gradle build script?  I have the following sample script that contains two doFirst methods.  I understand that they are additive, as they both execute, but the order that this occurs looks backward:</p>
  
  <pre><code>task initialize
  task depTask(dependsOn: initialize)
  
  initialize {
      doFirst {
          println 'processing doFirst in initialization (configuration)'
      }
  
      println 'processing initialize (configuration)'
  }
  
  depTask {
      println 'processing depTask (configuration)'
  }
  
  depTask &lt;&lt; {
      println 'executing depTask (execution)'
  }
  
  initialize &lt;&lt; {
      println 'executing initialize (execution)'
  }
  
  initialize.doFirst {
      println 'executing doFirst on initialize (execution)'
  }
  </code></pre>
  
  <p>The output from this script is:</p>
  
  <pre><code>processing initialize (configuration)
  processing depTask (configuration)
  executing doFirst on initialize (execution)
  processing doFirst in initialization (configuration)
  executing initialize (execution)
  executing depTask (execution)
  </code></pre>
  
  <p>The first "doFirst" function is defined in the initialize task.  The second is defined outside of the configuration block.  Why doesn't the first instance execute before the second one?  The order of execution looks backward.  I would have expected the first one, inside the configuration definition, to execute first.  Any help understanding this would be appreciated.</p>