title: Execute Anonymous Gradle Task
body: <p>How can I execute anonymous Gradle task?</p>
  
  <p>I want to add a hook on a certain task and execute another task with <code>variant.mergedFlavor.packageName</code>.</p>
  
  <pre><code>android.applicationVariants.all { variant -&gt;
      tasks.getByName("prepare${variant.name}Dependencies").finalizedBy({
          doFirst {
             println variant.mergedFlavor.packageName
          }
      })
  }
  </code></pre>
  
  <p>What I want to achieve is that <code>prepare${variant.name}Dependencies</code> task would be finalized by task 
  <code>download${variant.name}RawData</code> task.</p>
  
  <p>What would be the correct way to do that?</p>