title: How to set properties for a dependent gradle task
body: <p>I want to set up a "generic" task which will build app bundles for a number of platforms (it uses javafxpackager). The mechanics of the task apply to creating all platform bundles, but the difference is in the various property used by the task.</p>
  
  <p>I had thought that I would create separate higher level tasks for each platform in which the platform specific properties would be set, and then call/execute/(substitute the correct gradle lingo here) the generic task. E.g.,</p>
  
  <pre><code>task buildMacBundle(dependsOn: ['macBundleConfig', 'buildAppBundle']) &lt;&lt; {
    // set Mac-specific properties (project.ext properties?)
    // call/invoke/execute or whatever the mechanism is called, buildAppBundle task
      buildAppBundle.mustRunAfter macBundleConfig
      println "building a Mac app bundle"
  }
  
  task macBundleConfig &lt;&lt; {
      println "executing macBundleConfig"
      ext {
          nativeType = "dmg"
          bundleAppName = 'My App'
      }
      delete ("${buildDir.name}/dist/${bundleAppName}.dmg")
  }
  
  
  task buildWindowsBundle &lt;&lt; {
    // omitted for brevity, but just like buildMacBundle except for property values
  }
  
  task buildAppBundle &lt;&lt; {
  
      println "nativeType: ${project.ext.nativeType}" // it stumbles here!
  
      def cmd = [
          "${javapackager}",
          "-deploy",
          "-native", "${project.ext.nativeType}",
          "-name",
          "${project.bundleAppName}",
          "-outdir",
          "${buildDir.name}${File.separator}dist",
          "-outfile",
          "MyApp",
          "-srcdir",
          "${buildDir.name}${File.separator}${libsDir.name}",
          "-appclass",
          "org.pf.app.MyApp"
      ]
  
      println cmd.join(" ")
  
      def javapackager = exec {
          workingDir "${project.projectDir.absolutePath}"
          commandLine cmd
      }
  }
  </code></pre>
  
  <p>But when I run "buildMacBundle", I get </p>
  
  <pre><code>* What went wrong:
  Execution failed for task ':buildAppBundle'.
  &gt; cannot get property 'nativeType' on extra properties extension as it does not exist
  </code></pre>
  
  <p>How do I define the properties in the specific task which then invokes the generic task?</p>