title: Call one Gradle Task from another with arguments
body: <p>I have a gradle task which calls a script and passed the command line arguments to the script using <code>-PARGS</code>. </p>
  
  <pre><code>task taskAll(type: Exec, dependsOn: taskinit) {
      environment['PROJECT_ROOT'] = "${projectDir}"
      workingDir rootProject.projectDir.path
      description = 'Main task'
  
      executable rootProject.projectDir.path + "/execute.me"
      if (project.hasProperty('ARGS')) {
          args(ARGS.split(','))
      }
  }
  </code></pre>
  
  <p>I call this gradle task with any of the below options</p>
  
  <pre><code>./gradlew taskAll
  ./gradlew taskAll -PARGS="arg1"
  ./gradlew taskAll -PARGS="arg2"
  </code></pre>
  
  <p>However, am looking to see if I split taskAll into multiple tasks, say</p>
  
  <pre><code>./gradlew taskA    #Calls task taskAll with arg1
  ./gradlew taskB    #Calls task taskAll with arg2
  </code></pre>
  
  <p>I understand that I will have to replicate the taskAll to create <code>taskA</code>, <code>taskB</code> and remove the "if" condition and hardcode args in each of these.</p>
  
  <p>However, I wonder if it is possible to have a cleaner implementation by having MainTask which only calls the executable, and then have <code>TaskA</code>, <code>TaskB</code>, <code>TaskC</code> call <code>MainTask</code> and pass the arguments <code>arg1</code>, <code>arg2</code> and <code>arg3</code>. </p>