Seems like the remapTarget isn't inherited correctly from the root CopySpec. It
will work, however if you put it inside the from.
I did try this one :)
task('flatten', type: Copy) {
from('src') {
into 'dest'
include '**/*.html'
remapTarget { File defaultTarget ->
return new File(file('dest'), defaultTarget.name)
}
}
}
Chris Hane wrote:
Thanks. However, it didn't work. I am trying something like:
task('gwtCopy', type: Copy) {
println "copying"
from('src') {
include '**/*.html'
}
// from 'src/com/project/help/C3.html'
into 'build/gradle/help/bo'
remapTarget { File defaultTarget ->
return new File('build/gradle/help/bo', defaultTarget.name)
}
}
And I still get the directories in the output. It's almost like
remapTarget is not executed. I am using 0.8.
If I do the comment out from 'src/com/project/help/C3.html', it works
without the remapTarget. I figure that is because I specified the whole
path name.
Chris.....
Steve Appling wrote:
Wtih 0.8, you can use the remapTarget closure.
I haven't tried this, but something like:
copy {
from 'com/project'
into targetDirectory
remapTarget { File defaultTarget ->
return new File(targetDirectory, defaultTarget.name)
}
}
Note that remapTarget has been removed in the current main branch, but
Adam says there will be a replacement.
Chris Hane wrote:
I'm trying to copy a deep directory structure and flatten it as I do
it. I'm sure this is a simple function, I just can't seem to get it
today. Could some help point me in the right direction.
Current structure moving from
- com
- project
- screen1
- help
myhelp1.html
yourfile2.html
- screen2
- help
help3.html
I want to copy the html files from the help directories and flatten
to 1 directory so that the result is:
- help
myhelp1.html
yourfile2.html
help3.html
Thanks,
Chris....
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
--
Steve Appling
Automated Logic Research Team
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email