title: Is there any way to skip the assemble task and its dependencies in Android?
body: <p>I am attempting to build a cache of APKs locally. The idea is that when you run any <code>assemble</code> type task, it will check locally for a previously built APK and move it into the build output folder.</p>
  <p>I have made my own custom task that does this APK cache check. The signature is below:</p>
  <pre><code>tasks.register('apkCacheCheck') {
    // checks for some criteria here
  }
  </code></pre>
  <p>I have also made the <code>assembleDebug</code> task dependent on it:</p>
  <pre><code>
  tasks.whenTaskAdded{ task -&gt;
      if (task.name == &quot;assembleDebug&quot;) {
          task.dependsOn &quot;apkCacheCheck&quot;
          task.enabled = foo // some output of apkCacheCheck
      }
  }
  </code></pre>
  <p><strong>Problem:</strong>
  When running <code>assembleDebug</code> to build an Android app, it will go up the graph and execute all its dependent tasks. However, I wanted to write a check that prevents the app from building anything until the check is finished. This way, we can save time by installing the cached APK rather than re-building it from scratch.</p>
  <p><strong>Questions:</strong></p>
  <ul>
  <li>Is there a way to stop all of the build tasks if said condition is met?</li>
  <li>Is this a valid use case of Gradle or should I be looking towards running this as a Bash script?</li>
  </ul>