|
|||||||||
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/languages') { rename 'EN_US_(*.)', '$1' } into 'build/target/config' exclude '**/*.bak', '**/CVS/' }
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(Project project,
java.lang.String name)
|
Method Summary | |
---|---|
CopySpec |
exclude(java.lang.String... excludes)
Adds an ANT style exclude pattern to the copy specification. |
CopySpec |
filter(java.lang.Class<java.io.FilterReader> filterType)
Adds a content filter to be used during the copy. |
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.Iterable<java.lang.Object> sourcePaths)
Specifies sources for a copy. |
CopySpec |
from(java.lang.Iterable<java.lang.Object> sourcePaths,
groovy.lang.Closure c)
Specifies sources for a copy and creates a child CopySpec which is configured with the Closure. |
CopySpec |
from(java.lang.Object... sourcePaths)
Specifies sources for a copy. |
CopySpec |
from(java.lang.Object sourcePath,
groovy.lang.Closure c)
Specifies the source for a copy and creates a child CopySpec. |
java.io.File |
getDestinationDir()
|
java.util.List<? extends CopySpec> |
getLeafSyncSpecs()
|
CopySpec |
getRootSyncSpec()
|
java.util.List |
getSrcDirs()
|
static void |
globalExclude(java.lang.String... excludes)
Set the exclude patterns used by all Copy tasks. |
CopySpec |
include(java.lang.String... includes)
Adds an ANT style include pattern to the copy specification. |
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 |
setDestinationDir(java.io.File destinationDir)
|
void |
setSrcDirs(java.util.List srcDirs)
|
Methods inherited from class org.gradle.api.internal.ConventionTask |
---|
conv, conventionMapping, conventionMapping, conventionProperty, getConventionAwareHelper, getConventionMapping, setConventionAwareHelper, setConventionMapping |
Methods inherited from class org.gradle.api.DefaultTask |
---|
configure, doFirst, doLast, leftShift, methodMissing, propertyMissing, setProperty |
Methods inherited from class org.gradle.api.internal.AbstractTask |
---|
captureStandardOutput, compareTo, defineProperty, deleteAllActions, dependsOn, dependsOnTaskDidWork, disableStandardOutputCapture, doFirst, doLast, equals, execute, getActions, getAdditionalProperties, getAnt, getConvention, getDependsOn, getDescription, getDidWork, getDynamicObjectHelper, getEnabled, getExecuted, getLogger, getName, getPath, getProject, getSkipProperties, getStandardOutputCapture, getTaskDependencies, hashCode, hasProperty, isDidWork, isEnabled, isExecuted, onlyIf, onlyIf, property, setActions, setAdditionalProperties, setDependsOn, setDescription, setDidWork, setEnabled, setExecuted, setName, setProject, setSkipProperties, setStandardOutputCapture, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.gradle.api.tasks.copy.CopyAction |
---|
execute, getDidWork |
Methods inherited from interface groovy.lang.GroovyObject |
---|
getMetaClass, getProperty, invokeMethod, setMetaClass |
Constructor Detail |
---|
public Copy(Project project, java.lang.String name)
Method Detail |
---|
public static void globalExclude(java.lang.String... excludes)
Copy.globalExclude( '**/.svn/' )Note that there are no global excludes by default. Unlike CopySpec.exclude, this does not add a new exclude pattern, it sets (or resets) the exclude patterns. You can't use sequential calls to this method to add multiple global exclude patterns.
excludes
- exclude patterns to usepublic java.util.List getSrcDirs()
public void setSrcDirs(java.util.List srcDirs)
public java.io.File getDestinationDir()
public void setDestinationDir(java.io.File destinationDir)
public void setCaseSensitive(boolean caseSensitive)
setCaseSensitive
in interface CopyAction
caseSensitive
- public java.util.List<? extends CopySpec> getLeafSyncSpecs()
getLeafSyncSpecs
in interface CopyAction
public CopySpec getRootSyncSpec()
getRootSyncSpec
in interface CopyAction
public CopySpec from(java.lang.Object... sourcePaths)
Project.file()
.
Relative paths will be evaluated relative to the project directory.
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 CopySpec
sourcePath
- Path to source for the copyc
- closure for configuring the child CopySpecpublic CopySpec from(java.lang.Iterable<java.lang.Object> sourcePaths)
Project.file()
.
from
in interface CopySpec
sourcePaths
- Paths to source directories for the copypublic CopySpec from(java.lang.Iterable<java.lang.Object> sourcePaths, groovy.lang.Closure c)
Project.file()
.
from
in interface CopySpec
sourcePaths
- Paths to source directories for the copyc
- Closure for configuring the child CopySpecpublic CopySpec into(java.lang.Object destDir)
into
in interface CopySpec
destDir
- Destination directorypublic CopySpec include(java.lang.String... includes)
all files ending with 'jsp' (including subdirectories) **/*.jsp all files beginning with 'template_' in the level1/level2 directory level1/level2/template_* all files (including subdirectories) beneath src/main/webapp src/main/webapp/ all files beneath any CVS directory (including subdirectories) under src/main/java src/main/java/**/CVS/**If this method is not called, then all files beneath the source directory will be included. If this method is called, then a file must match at least one of the include patterns to be copied.
include
in interface CopySpec
includes
- a vararg list of include patternspublic CopySpec exclude(java.lang.String... excludes)
include
for a description of the
syntax for patterns.
If this method is not called, then no files will be excluded.
If this method is called, then files must not match any exclude pattern
to be copied.
exclude
in interface CopySpec
excludes
- a vararg list of exclude patternspublic CopySpec remapTarget(groovy.lang.Closure closure)
remapTarget
in interface CopySpec
closure
- remap closurepublic 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 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 CopySpec
map
- map of filter parametersfilterType
- Class of filter to addpublic CopySpec filter(java.lang.Class<java.io.FilterReader> filterType)
Examples:
filter(StripJavaComments) filter(com.mycompany.project.CustomFilter)
filter
in interface CopySpec
filterType
- Class of filter to add
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |