title: Configure gradle distribution task
body: <p>I am using the <code>application</code> plugin and would like to do something like this:</p>
  
  <p><strong>build.gradle</strong></p>
  
  <pre><code>apply from: 'common.gradle'
  
  folder1Files = []
  folder1Files &lt;&lt; "file1.txt"
  folder1Files &lt;&lt; "file2.txt"
  </code></pre>
  
  <p><strong>common.gradle</strong></p>
  
  <pre><code>distributions {
    main {
      contents {
        into ("folder1") { from(folder1Files) }
      }
    }
  }
  </code></pre>
  
  <p>I understand that this can be done by simply adding the <code>apply from</code> after the variable definitions but I was wondering whether there is a more 'bullet proof'/correct way?</p>
  
  <p>In other words, how can I define variables for configuring the distribution task before it is configured?</p>