title: Gradle Zip Task: Add Dynamically Generated File
body: <p>I have a gradle build script in which I'm using the 'Zip' task to generate a zip archive directly from a source directory.</p>
  
  <p>In addition to copying over all the files inside the source directory structure into the zip archive, I'm looking for a way to include a dynamically generated file that's not in the source directory.</p>
  
  <p>Do you guys know how I can do this?</p>
  
  <p>Here's pseudo code of what I want to do:</p>
  
  <pre><code>task('archive', type: Zip) {
    ...
    from 'source'
    newFile('dynamically-generated.txt', 'dynamic file content')
  }
  </code></pre>
  
  <p>And here are the source and destination structures:</p>
  
  <pre><code>[i71178@bddev01-shell01 ~]$ tree source/
  source/
  ├── file1.txt
  ├── file2.txt
  └── file3.txt
  
  0 directories, 3 files
  [i71178@bddev01-shell01 ~]$ unzip -l destination.zip
  Archive:  destination.zip
    Length      Date    Time    Name
  
  ---------  ---------- -----   ----
          0  02-26-2016 16:56   source/
          0  02-26-2016 16:56   source/file2.txt
          0  02-26-2016 16:56   source/dynamically-generated.txt
          0  02-26-2016 16:56   source/file1.txt
          0  02-26-2016 16:56   source/file3.txt
  ---------                     -------
          0                     5 files
  </code></pre>