public class CmdLineTask extends DefaultTask
A task for running a series of actions, including shell commands.
task mirrorRepo(type: com.diffplug.gradle.CmdLineTask) {
// initialize the repository
cmd("svnadmin create ${name}")
// setup its script
copy(SCRIPT, "${name}/hooks/${SCRIPT}")
// initialize the sync
cmd("svnsync initialize file:///${project.file(name).absolutePath} ${url}")
// follow throw on the sync
cmd("svnsync synchronize file:///${project.file(name).absolutePath} ${url}")
}
Task.Namer
TASK_ACTION, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
Constructor and Description |
---|
CmdLineTask() |
Modifier and Type | Method and Description |
---|---|
void |
cmd(Object directory,
String cmd)
Sets the working directory to the given dir, then executes the given command.
|
void |
cmd(String cmd)
Executes the given command.
|
void |
copy(Object src,
Object dst)
Removes the given file or directory.
|
void |
mv(Object src,
Object dst)
Removes the given file or directory.
|
void |
performActions() |
void |
rm(Object fileOrDir)
Removes the given file or directory.
|
void |
run(Throwing.Runnable action)
Removes the given file or directory.
|
addValidator, appendParallelSafeAction, compareTo, configure, deleteAllActions, dependsOn, dependsOnTaskDidWork, doFirst, doFirst, doLast, doLast, execute, finalizedBy, getActions, getAnt, getAsDynamicObject, getConvention, getDependsOn, getDescription, getDidWork, getEnabled, getExecuter, getExtensions, getFinalizedBy, getGroup, getImpliesSubProjects, getInputs, getLogger, getLogging, getMustRunAfter, getName, getOnlyIf, getOutputs, getPath, getProject, getServices, getShouldRunAfter, getStandardOutputCapture, getState, getTaskActions, getTaskDependencies, getTemporaryDir, getTemporaryDirFactory, getValidators, hasProperty, injectIntoNewInstance, isEnabled, isHasCustomActions, leftShift, mustRunAfter, onlyIf, onlyIf, prependParallelSafeAction, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setExecuter, setFinalizedBy, setGroup, setImpliesSubProjects, setMustRunAfter, setName, setOnlyIf, setOnlyIf, setProject, setProperty, setShouldRunAfter, shouldRunAfter, toString
public void cmd(String cmd)
Executes the given command.
public void cmd(Object directory, String cmd)
Sets the working directory to the given dir, then executes the given command.
public void rm(Object fileOrDir)
Removes the given file or directory.
public void run(Throwing.Runnable action)
Removes the given file or directory.