title: What is the syntax for a gradle subproject task depending on a parent project's task?
body: <p>I need some help with a Gradle build file. I have some subprojects which depend on tasks in the top folder. I just need to take a <code>test</code> task and split it into two separate test tasks. Currently the file system structure looks like (tab indicates files inside a directory):</p>
  
  <pre><code>top-level-project-folder
      A.gradle
      B.gradle
      C-subproject-folder
          C.gradle
      D-subproject-folder
          D.gradle
  </code></pre>
  
  <p>Contents of A.gradle (before refactor):</p>
  
  <pre><code>subprojects {
      tasks.test.dependsOn {
          bTask
      }
  }
  apply from: 'B.gradle'
  </code></pre>
  
  <p>Contents of C.gradle (before refactor):</p>
  
  <pre><code>test {
      ...
  }
  </code></pre>
  
  <p>After the refactor, C.gradle needs to look like:</p>
  
  <pre><code>test {
      ...
  }
  
  task runDifferentTests(type : Test) {
      ...
  }
  </code></pre>
  
  <p>The tricky part is that <code>C.gradle</code>'s <code>test</code> task currently depends on <code>bTask</code>. However, after the refactor, <code>C.gradle</code>'s <code>test</code> task should <em>not</em> depend on <code>bTask</code>, but the new <code>runDifferentTests</code> task should depend on <code>bTask</code>. (Currently, <code>D.gradle</code>'s <code>test</code> task is marked as depending on <code>bTask</code>, but it does not actually depend on it -- I'd like to remove that dependency. The only task in the two subprojects which depends on <code>bTask</code> is the new <code>runDifferentTests</code> task.)</p>
  
  <p>I've tried some different things but can't seem to find a working solution.</p>