|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.api.internal.ConventionTask
org.gradle.api.tasks.Copy
public class Copy
Task for copying files. This task can also rename and filter files as it copies.
The task implements CopySpec for specifying
what to copy.
Examples:
task(mydoc, type:Copy) {
from 'src/main/doc'
into 'build/target/doc'
}
task(initconfig, type:Copy) {
from('src/main/config') {
include '**/*.properties'
include '**/*.xml'
filter(ReplaceTokens, tokens:[version:'2.3.1'])
}
from('src/main/config') {
exclude '**/*.properties', '**/*.xml'
}
from('src/main/languages') {
rename 'EN_US_(*.)', '$1'
}
into 'build/target/config'
exclude '**/*.bak'
}
| Field Summary |
|---|
| Fields inherited from interface org.gradle.api.Task |
|---|
AUTOSKIP_PROPERTY_PREFIX, TASK_ACTION, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_NAME, TASK_OVERWRITE, TASK_TYPE |
| Constructor Summary | |
|---|---|
Copy()
|
|
| Method Summary | |
|---|---|
CopySpec |
exclude(java.lang.Iterable<java.lang.String> excludes)
Adds an ANT style exclude pattern. |
CopySpec |
exclude(java.lang.String... excludes)
Adds an ANT style exclude pattern. |
CopySpec |
filter(java.lang.Class<java.io.FilterReader> filterType)
Adds a content filter to be used during the copy. |
CopySpec |
filter(groovy.lang.Closure closure)
Adds a content filter based on the provided closure. |
CopySpec |
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. |
CopySpec |
from(java.lang.Object... sourcePaths)
Specifies source files or directories for a copy. |
CopySpec |
from(java.lang.Object sourcePath,
groovy.lang.Closure c)
Specifies the source for a copy and creates a child CopySourceSpec. |
org.gradle.api.internal.file.CopyActionImpl |
getCopyAction()
|
java.io.File |
getDestinationDir()
|
java.util.Set<java.lang.String> |
getExcludes()
Get the set of exclude patterns. |
java.util.Set<java.lang.String> |
getIncludes()
Get the set of include patterns. |
java.util.List<? extends CopySpec> |
getLeafSyncSpecs()
|
java.lang.Object |
getSrcDirs()
|
CopySpec |
include(java.lang.Iterable<java.lang.String> includes)
Adds an ANT style include pattern. |
CopySpec |
include(java.lang.String... includes)
Adds an ANT style include pattern. |
CopySpec |
into(java.lang.Object destDir)
Specifies the destination directory for a copy. |
CopySpec |
remapTarget(groovy.lang.Closure closure)
Maps a source file to a different relative location under the target directory. |
CopySpec |
rename(java.lang.String sourceRegEx,
java.lang.String replaceWith)
Renames files based on a regular expression. |
void |
setCaseSensitive(boolean caseSensitive)
Set case sensitivity for comparisons. |
void |
setCopyAction(org.gradle.api.internal.file.CopyActionImpl copyAction)
|
void |
setDestinationDir(java.io.File destinationDir)
|
CopySpec |
setExcludes(java.lang.Iterable<java.lang.String> excludes)
Set the allowable exclude patterns. |
CopySpec |
setIncludes(java.lang.Iterable<java.lang.String> includes)
Set the allowable include patterns. |
void |
setSrcDirs(java.lang.Object srcDirs)
|
| Methods inherited from class org.gradle.api.internal.ConventionTask |
|---|
conventionMapping, getConventionMapping, setConventionMapping |
| Methods inherited from class org.gradle.api.DefaultTask |
|---|
configure, doFirst, doLast, leftShift |
| Methods inherited from class org.gradle.api.internal.AbstractTask |
|---|
captureStandardOutput, compareTo, defineProperty, deleteAllActions, dependsOn, dependsOnTaskDidWork, disableStandardOutputCapture, doFirst, doLast, equals, execute, getActions, getAdditionalProperties, getAnt, getAsDynamicObject, getConvention, getDependsOn, getDescription, getDidWork, getDynamicObjectHelper, getEnabled, getExecuted, getLogger, getName, getOutput, getPath, getProject, getStandardOutputCapture, getTaskDependencies, hashCode, hasProperty, injectIntoNextInstance, isDidWork, isEnabled, isExecuted, onlyIf, onlyIf, property, setActions, setAdditionalProperties, setConvention, setDependsOn, setDescription, setDidWork, setEnabled, setExecuted, setName, setOutputHandler, setProject, setProperty, setStandardOutputCapture, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.gradle.api.file.CopyAction |
|---|
execute |
| Methods inherited from interface org.gradle.api.tasks.WorkResult |
|---|
getDidWork |
| Methods inherited from interface groovy.lang.GroovyObject |
|---|
getMetaClass, getProperty, invokeMethod, setMetaClass, setProperty |
| Constructor Detail |
|---|
public Copy()
| Method Detail |
|---|
public org.gradle.api.internal.file.CopyActionImpl getCopyAction()
public void setCopyAction(org.gradle.api.internal.file.CopyActionImpl copyAction)
public java.lang.Object getSrcDirs()
public void setSrcDirs(java.lang.Object srcDirs)
public java.io.File getDestinationDir()
public void setDestinationDir(java.io.File destinationDir)
public void setCaseSensitive(boolean caseSensitive)
setCaseSensitive in interface CopyActionpublic java.util.List<? extends CopySpec> getLeafSyncSpecs()
public CopySpec from(java.lang.Object... sourcePaths)
Project.file() .
Relative paths will be evaluated relative to the project directory.
from in interface CopySourceSpecfrom in interface CopySpecsourcePaths - Paths to source directories for the copy
public CopySpec from(java.lang.Object sourcePath,
groovy.lang.Closure c)
Project.file() .
from in interface CopySourceSpecfrom in interface CopySpecsourcePath - Path to source for the copyc - closure for configuring the child CopySourceSpecpublic CopySpec into(java.lang.Object destDir)
into in interface CopyProcessingSpecinto in interface CopySpecdestDir - Path to the destination directory for a Copy
public CopySpec include(java.lang.String... includes)
include in interface CopySpecinclude in interface PatternFilterableincludes - a vararg list of include patternsPattern Formatpublic CopySpec include(java.lang.Iterable<java.lang.String> includes)
include in interface CopySpecinclude in interface PatternFilterableincludes - a Iterable providing more include patternsPattern Formatpublic CopySpec exclude(java.lang.String... excludes)
exclude in interface CopySpecexclude in interface PatternFilterableexcludes - a vararg list of exclude patternsPattern Formatpublic CopySpec exclude(java.lang.Iterable<java.lang.String> excludes)
exclude in interface CopySpecexclude in interface PatternFilterableexcludes - a Iterable providing new exclude patternsPattern Formatpublic CopySpec setIncludes(java.lang.Iterable<java.lang.String> includes)
PatternFilterable.include(Iterable)
this replaces any previously defined includes.
setIncludes in interface CopySpecsetIncludes in interface PatternFilterableincludes - an Iterable providing new include patternsPattern Formatpublic java.util.Set<java.lang.String> getIncludes()
getIncludes in interface PatternFilterablepublic CopySpec setExcludes(java.lang.Iterable<java.lang.String> excludes)
PatternFilterable.exclude(Iterable)
this replaces any previously defined excludes.
setExcludes in interface CopySpecsetExcludes in interface PatternFilterableexcludes - an Iterable providing new exclude patternsPattern Formatpublic java.util.Set<java.lang.String> getExcludes()
getExcludes in interface PatternFilterablepublic CopySpec remapTarget(groovy.lang.Closure closure)
remapTarget in interface CopyProcessingSpecremapTarget in interface CopySpecclosure - remap closure
public CopySpec rename(java.lang.String sourceRegEx,
java.lang.String replaceWith)
Example:
rename '(.*)_OEM_BLUE_(.*)', '$1$2'would map the file 'style_OEM_BLUE_.css' to 'style.css'
rename in interface CopyProcessingSpecrename in interface CopySpecsourceRegEx - Source regular expressionreplaceWith - Replacement string (use $ syntax for capture groups)
public CopySpec filter(java.util.Map<java.lang.String,java.lang.Object> map,
java.lang.Class<java.io.FilterReader> filterType)
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'])
filter in interface CopyProcessingSpecfilter in interface CopySpecmap - map of filter parametersfilterType - Class of filter to add
public CopySpec filter(java.lang.Class<java.io.FilterReader> filterType)
Examples:
filter(StripJavaComments)
filter(com.mycompany.project.CustomFilter)
filter in interface CopyProcessingSpecfilter in interface CopySpecfilterType - Class of filter to add
public CopySpec filter(groovy.lang.Closure closure)
filter in interface CopyProcessingSpecfilter in interface CopySpecclosure - to implement line based filtering
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||