I have a function astDump that fills an output file with results computed from an input file. I want to run this on a source tree. The only solution I have found so far is the one below:
task pmdAstDump(type: Copy) {
from('src/main/java') {
include('**/*.java')
}
into('/tmp/junk')
rename '(.*)\\.java', '$1.ast'
eachFile { FileCopyDetails fcd ->
// println "${fcd.file} => ${file('build/ast/'+fcd.getRelativePath()).absolutePath}"
astDump(fcd.file, new File(file('build/ast/'+fcd.getRelativePath()).absolutePath))
}
}
Unfortunately the CopyTask copies files. I work around this by copying them to /tmp/junk for now. It would solve my problem if I could stop this. But the solution above is awkward anyway. Any better way is welcome.