title: Dynamically created task of type Copy is always UP-TO-DATE
body: <p>I've prepared a very simple script, that illustrates the problem I see using Gradle 1.7 (need to stick with it because of some plugins not yet supporting newer versions).</p>
  <p>I'm trying to dynamically create tasks each of which corresponds to a file in the project directory. This works fine, but the tasks I create never get executed as soon as I assign them type 'Copy'.</p>
  <p>Here is my problem <code>build.gradle</code>:</p>
  <pre><code>file('templates').listFiles().each { File f -&gt;
  
      // THIS LINE DOES NOT WORK
      task &quot;myDist-${f.name}&quot; (type: Copy) {
  
      // NEXT LINE WORKS
      //task &quot;myDist-${f.name}&quot; {
          doLast {
              println &quot;MYDIST-&quot; + f.name
          }
      }
  }
  
  task distAll(dependsOn: tasks.matching { Task task -&gt; task.name.startsWith(&quot;myDist&quot;)}) {
      println &quot;MYDISTALL&quot;
  }
  
  defaultTasks 'distAll'
  </code></pre>
  <p>in this way my tasks do not get executed when I call default task calling simply <code>gradle</code>:</p>
  <pre><code>MYDISTALL
  :myDist-template1 UP-TO-DATE
  :myDist-template2 UP-TO-DATE
  :distAll UP-TO-DATE
  
  BUILD SUCCESSFUL
  </code></pre>
  <p>If I remove type <code>Copy</code> from my dynamic task (uncommenting the line above), my tasks get executed:</p>
  <pre><code>MYDISTALL
  :myDist-template1
  MYDIST-template1
  :myDist-template2
  MYDIST-template2
  :distAll
  
  BUILD SUCCESSFUL
  </code></pre>
  <p>(You'll need to create a folder name <code>templates</code> in the same directory where <code>build.gradle</code> is located and put couple of empty files into there in order to run the test)</p>
  <p>According to the debug output:</p>
  <blockquote>
  <p>Skipping task ':myDist-template1' as it has no source files.</p>
  <p>Skipping task ':myDist-template2' as it has no source files.</p>
  </blockquote>
  <p>So how can I specify source files and make my <code>Copy</code> tasks execute?
  I've tried adding</p>
  <pre><code>from( '/absolute/path/to/existing/file' ) {
      into 'myfolder'
  }
  </code></pre>
  <p>to the task body, I've tried assigning task's <code>inputs.source file('/my/existing/file')</code> with no success.
  Could you please advise on how to modify my simple script leaving dynamic task creation and keeping my dynamic tasks of type <code>Copy</code>?</p>
  <p>Thank you!</p>
  <p>Edit:
  All right, this way the task gets called:</p>
  <pre><code>file('templates').listFiles().each { File f -&gt;
      task &quot;myDist-${f.name}&quot; (type: Copy) {
          from f
          into 'dist'
          doLast {
              println &quot;MYDIST-&quot; + f.name
          }
      }
  }
  </code></pre>
  <p>but it looks I must always specify <code>from</code>/<code>into</code>. It doesn't suffice to do that in the doLast{} body.</p>