Groovy Documentation

org.gradle.api.file
Interface CopyProcessingSpec


interface CopyProcessingSpec

Method Summary
CopyProcessingSpec filter(Map map, java.lang.Class filterType)

Adds a content filter to be used during the copy.

CopyProcessingSpec filter(java.lang.Class filterType)

Adds a content filter to be used during the copy.

CopyProcessingSpec filter(Closure closure)

Adds a content filter based on the provided closure.

CopyProcessingSpec into(java.lang.Object destPath)

Specifies the destination directory for a copy.

CopyProcessingSpec remapTarget(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

filter

public CopyProcessingSpec filter(Map map, java.lang.Class 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'])
 
param:
map map of filter parameters
param:
filterType Class of filter to add
return:
this


filter

public CopyProcessingSpec filter(java.lang.Class 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)
 
param:
filterType Class of filter to add
return:
this


filter

public CopyProcessingSpec filter(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.
param:
closure to implement line based filtering
return:
this


into

public CopyProcessingSpec into(java.lang.Object destPath)
Specifies the destination directory for a copy. The path is evaluated relative to the project directory.
param:
destPath Path to the destination directory for a Copy
return:
this


remapTarget

public CopyProcessingSpec remapTarget(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.
param:
closure remap closure
return:
this


rename

public 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'
param:
sourceRegEx Source regular expression
param:
replaceWith Replacement string (use $ syntax for capture groups)
return:
this


 

Groovy Documentation