org.gradle.api.file
Interface CopyProcessingSpec

All Known Subinterfaces:
CopyAction, CopySpec
All Known Implementing Classes:
Copy

public interface CopyProcessingSpec


Method Summary
 CopyProcessingSpec filter(java.lang.Class<java.io.FilterReader> filterType)
          Adds a content filter to be used during the copy.
 CopyProcessingSpec filter(groovy.lang.Closure closure)
          Adds a content filter based on the provided closure.
 CopyProcessingSpec filter(java.util.Map<java.lang.String,java.lang.Object> map, java.lang.Class<java.io.FilterReader> filterType)
          Adds a content filter to be used during the copy.
 CopyProcessingSpec into(java.lang.Object destPath)
          Specifies the destination directory for a copy.
 CopyProcessingSpec remapTarget(groovy.lang.Closure closure)
          Maps a source file to a different relative location under the target directory.
 CopyProcessingSpec rename(java.lang.String sourceRegEx, java.lang.String replaceWith)
          Renames files based on a regular expression.
 

Method Detail

into

CopyProcessingSpec into(java.lang.Object destPath)
Specifies the destination directory for a copy. The path is evaluated relative to the project directory.

Parameters:
destPath - Path to the destination directory for a Copy
Returns:
this

remapTarget

CopyProcessingSpec remapTarget(groovy.lang.Closure closure)
Maps a source file to a different relative location under the target directory. The closure will be called with a single parameter, the File object for the default location of the copy. This File will have the same relative path from the destination directory that the source file has from its source directory. The closure should return a File object with a new target destination.

Parameters:
closure - remap closure
Returns:
this

rename

CopyProcessingSpec rename(java.lang.String sourceRegEx,
                          java.lang.String replaceWith)
Renames files based on a regular expression. Uses java.util.regex type of regular expressions. Note that the replace string should use the '$1' syntax to refer to capture groups in the source regular expression. Files that do not match the source regular expression will be copied with the original name.

Example:

 rename '(.*)_OEM_BLUE_(.*)', '$1$2'
 
would map the file 'style_OEM_BLUE_.css' to 'style.css'

Parameters:
sourceRegEx - Source regular expression
replaceWith - Replacement string (use $ syntax for capture groups)
Returns:
this

filter

CopyProcessingSpec filter(java.util.Map<java.lang.String,java.lang.Object> map,
                          java.lang.Class<java.io.FilterReader> filterType)
Adds a content filter to be used during the copy. Multiple calls to filter, add additional filters to the filter chain. Each filter should implement java.io.FilterReader. Include org.apache.tools.ant.filters.* for access to all the standard ANT filters.

Filter parameters may be specified using groovy map syntax.

Examples:

    filter(HeadFilter, lines:25, skip:2)
    filter(ReplaceTokens, tokens:[copyright:'2009', version:'2.3.1'])
 

Parameters:
map - map of filter parameters
filterType - Class of filter to add
Returns:
this

filter

CopyProcessingSpec filter(java.lang.Class<java.io.FilterReader> filterType)
Adds a content filter to be used during the copy. Multiple calls to filter, add additional filters to the filter chain. Each filter should implement java.io.FilterReader. Include org.apache.tools.ant.filters.* for access to all the standard ANT filters.

Examples:

    filter(StripJavaComments)
    filter(com.mycompany.project.CustomFilter)
 

Parameters:
filterType - Class of filter to add
Returns:
this

filter

CopyProcessingSpec filter(groovy.lang.Closure closure)
Adds a content filter based on the provided closure. The Closure will be called with each line (stripped of line endings) and should return a String to replace the line.

Parameters:
closure - to implement line based filtering
Returns:
this