Steve Appling wrote:
CopySpec.remapTarget is gone and we were actually using it. The
replacement rename method that takes a closure isn't equivalent. It
only takes a string file name as a parameter (and as the return), so I
can't do things like flatten a directory tree during a copy. The
previous remapTarget method (admittedly a poor name) took and returned
File objects so you could tell the directory the source files were in
(and control the directory of the target). We were also using the
fact that you could previously return a null to not copy the file. I
would like these abilities back in some form.
They will be back. I moved remapTarget() out of the way to make it
easier to change the archive tasks to use CopySpec. Once that is done, I
am planning on adding remapping back in some form.
I'd like to separate how you specify whether a file should be included
in the result and how you specify the target path for a file.
To include and exclude files, we have
PatternFilterable.include(Spec<FileTreeElement>) and include(Closure),
plus the equivalent exclude() methods. FileTreeElement provides a bunch
of meta info about the source file. So you can do something like:
include { FileTreeElement e ->
e.file.text.contains("environment=${targetEnvironment}") }
To specify the target path, we would add a general mapTo() method. You
would provide a mapping from FileTreeElement to the destination relative
path for the file. The path would be interpreted relative to the root of
the destination (whether that is a directory or a zip file or whatever).
Something like:
mapTo { FileTreeElement e ->
return e.path.replaceAll('-TARGET.zip', "-${version}.zip")
}
We might also replace what is currently rename() with a mapPath()
method, where you provide a mapping from String relative path to String
relative path:
mapName { it.replaceAll('-TARGET.zip', "-${version}.zip") }
--
Adam Murdoch
Gradle Developer
http://www.gradle.org
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email