|
|||||||||
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 CopyAction
public 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 CopySourceSpec
from
in interface CopySpec
sourcePaths
- Paths to source directories for the copypublic CopySpec from(java.lang.Object sourcePath, groovy.lang.Closure c)
Project.file()
.
from
in interface CopySourceSpec
from
in interface CopySpec
sourcePath
- Path to source for the copyc
- closure for configuring the child CopySourceSpecpublic CopySpec into(java.lang.Object destDir)
into
in interface CopyProcessingSpec
into
in interface CopySpec
destDir
- Path to the destination directory for a Copy
public CopySpec include(java.lang.String... includes)
include
in interface CopySpec
include
in interface PatternFilterable
includes
- a vararg list of include patternsPattern Format
public CopySpec include(java.lang.Iterable<java.lang.String> includes)
include
in interface CopySpec
include
in interface PatternFilterable
includes
- a Iterable providing more include patternsPattern Format
public CopySpec exclude(java.lang.String... excludes)
exclude
in interface CopySpec
exclude
in interface PatternFilterable
excludes
- a vararg list of exclude patternsPattern Format
public CopySpec exclude(java.lang.Iterable<java.lang.String> excludes)
exclude
in interface CopySpec
exclude
in interface PatternFilterable
excludes
- a Iterable providing new exclude patternsPattern Format
public CopySpec setIncludes(java.lang.Iterable<java.lang.String> includes)
PatternFilterable.include(Iterable)
this replaces any previously defined includes.
setIncludes
in interface CopySpec
setIncludes
in interface PatternFilterable
includes
- an Iterable providing new include patternsPattern Format
public java.util.Set<java.lang.String> getIncludes()
getIncludes
in interface PatternFilterable
public CopySpec setExcludes(java.lang.Iterable<java.lang.String> excludes)
PatternFilterable.exclude(Iterable)
this replaces any previously defined excludes.
setExcludes
in interface CopySpec
setExcludes
in interface PatternFilterable
excludes
- an Iterable providing new exclude patternsPattern Format
public java.util.Set<java.lang.String> getExcludes()
getExcludes
in interface PatternFilterable
public CopySpec remapTarget(groovy.lang.Closure closure)
remapTarget
in interface CopyProcessingSpec
remapTarget
in interface CopySpec
closure
- 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 CopyProcessingSpec
rename
in interface CopySpec
sourceRegEx
- 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 CopyProcessingSpec
filter
in interface CopySpec
map
- 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 CopyProcessingSpec
filter
in interface CopySpec
filterType
- Class of filter to add
public CopySpec filter(groovy.lang.Closure closure)
filter
in interface CopyProcessingSpec
filter
in interface CopySpec
closure
- to implement line based filtering
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |