Created
May 29, 2013 15:34
-
-
Save ysb33r/5671225 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create the task | |
// The declare the task and adds a body that will be executed everytime the tasks is executed | |
// Variables pushed in as configuration can be referenced here | |
// | |
// This simple tasks will write a text file containing a list of files | |
// in a source set. It will also only update the output file, if at least one | |
// source file has changed. | |
task myTask << { | |
outputs.file.singleFile.withWriter { out -> | |
inputs.sourceFiles.each { | |
out << "${it.name}" | |
} | |
} | |
} | |
// Configure the task. This allows for variables to be set within the | |
// tasks. It also allows for the task body to be included from a common gradle file, | |
// but configured on a per-project basis. | |
myTask { | |
// I want to add some input files | |
inputs.source fileTree ( "${projectDir}/src/datafiles" ) { | |
include '*.xls' | |
} | |
// I also want to declare a single output file | |
outputs.file "${buildDir}/example.txt" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment