Groovy Documentation

org.gradle.api.file
[Java] Interface CopyProcessingSpec

org.gradle.api.file.ContentFilterable
  org.gradle.api.file.CopyProcessingSpec
All Superinterfaces:
ContentFilterable

public interface CopyProcessingSpec
extends ContentFilterable

Specifies the destination of a copy.


Method Summary
CopyProcessingSpec eachFile(Action action)

Adds an action to be applied to each file as it about to be copied into its destination.

CopyProcessingSpec eachFile(groovy.lang.Closure closure)

Adds an action to be applied to each file as it about to be copied into its destination.

int getDirMode()

Returns the Unix permissions to use for the target directories.

int getFileMode()

Returns the Unix permissions to use for the target files.

CopyProcessingSpec into(java.lang.Object destPath)

Specifies the destination directory for a copy.

CopyProcessingSpec rename(groovy.lang.Closure closure)

Renames 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.

CopyProcessingSpec rename(java.util.regex.Pattern sourceRegEx, java.lang.String replaceWith)

Renames files based on a regular expression.

CopyProcessingSpec setDirMode(int mode)

Sets the Unix permissions to use for the target directories.

CopyProcessingSpec setFileMode(int mode)

Sets the Unix permissions to use for the target files.

 
Methods inherited from interface ContentFilterable
expand, filter, filter, filter
 

Method Detail

eachFile

public CopyProcessingSpec eachFile(Action action)
Adds an action to be applied to each file as it about to be copied into its destination. The action can change the destination path of the file, filter the contents of the file, or exclude the file from the result entirely. Actions are executed in the order added, and are inherited from the parent spec.
Parameters:
action - The action to execute.
Returns:
this


eachFile

public CopyProcessingSpec eachFile(groovy.lang.Closure closure)
Adds an action to be applied to each file as it about to be copied into its destination. The given closure is called with a FileCopyDetails as its parameter. Actions are executed in the order added, and are inherited from the parent spec.
Parameters:
closure - The action to execute.
Returns:
this


getDirMode

public int getDirMode()
Returns the Unix permissions to use for the target directories. It is dependent on the copy action implementation whether these permissions will actually be applied.
Returns:
The directory permissions.


getFileMode

public int getFileMode()
Returns the Unix permissions to use for the target files. It is dependent on the copy action implementation whether these permissions will actually be applied.
Returns:
The file permissions.


into

public CopyProcessingSpec into(java.lang.Object destPath)
Specifies the destination directory for a copy. The destination is evaluated as for Project.file.
Parameters:
destPath - Path to the destination directory for a Copy
Returns:
this


rename

public CopyProcessingSpec rename(groovy.lang.Closure closure)
Renames a source file to a different relative location under the target directory. The closure will be called with a single parameter, the name of the file. The closure should return a String object with a new target name. The closure may return null, in which case the original name will be used.
Parameters:
closure - rename closure
Returns:
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'
Parameters:
sourceRegEx - Source regular expression
replaceWith - Replacement string (use \$ syntax for capture groups)
Returns:
this


rename

public CopyProcessingSpec rename(java.util.regex.Pattern sourceRegEx, java.lang.String replaceWith)
Renames files based on a regular expression. See rename(String, String).
Parameters:
sourceRegEx - Source regular expression
replaceWith - Replacement string (use \$ syntax for capture groups)
Returns:
this


setDirMode

public CopyProcessingSpec setDirMode(int mode)
Sets the Unix permissions to use for the target directories. It is dependent on the copy action implementation whether these permissions will actually be applied.
Parameters:
mode - The directory permissions.
Returns:
this


setFileMode

public CopyProcessingSpec setFileMode(int mode)
Sets the Unix permissions to use for the target files. It is dependent on the copy action implementation whether these permissions will actually be applied.
Parameters:
mode - The file permissions.
Returns:
this


 

Groovy Documentation