@CacheableTask public abstract class ImageGrinderTask extends DefaultTask
See README.md for usage instructions.
Worker requires that all arguments to its worker runnables (ProcessFile
in this case) be Serializable. There’s no way to serialize our grinder(Action), so we had
to use SerializableRef to sneakily pass our task to the worker.
Tedious thing #2: .java to .class has a 1:1 mapping. But that is not true for these images - a pipeline might create two images from one source, and the number of outputs might even change based on the content of the input (e.g. skip hi-res versions of very large images).
That means that when the user removes or changes an image, we need to remember exactly which files it
created last time, or else we might end up with stale results lying around. So, this task has the
map field which is a multimap from source file to the dst files it created. When the task starts,
it reads this map from disk, and when the task finishes, it writes it to disk. Whenever an Img is
rendered, the filename that was written is saved to this map via the Img.registerDstFile(String)
method.
| Modifier and Type | Class and Description |
|---|---|
static class |
ImageGrinderTask.RenderSvg |
static interface |
ImageGrinderTask.RenderSvgParams |
Task.Namer| Modifier and Type | Field and Description |
|---|---|
boolean |
debug |
TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE| Constructor and Description |
|---|
ImageGrinderTask(WorkerExecutor workerExecutor) |
| Modifier and Type | Method and Description |
|---|---|
Serializable |
getBumpThisNumberWhenTheGrinderChanges() |
abstract DirectoryProperty |
getDstDir() |
abstract DirectoryProperty |
getSrcDir() |
void |
grinder(Action<Img<?>> grinder) |
void |
performAction(InputChanges inputChanges) |
void |
setBumpThisNumberWhenTheGrinderChanges(Serializable bumpThisNumberWhenTheGrinderChanges) |
appendParallelSafeAction, compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getAsDynamicObject, getConvention, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getIdentityPath, getImpliesSubProjects, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOnlyIf, getOutputs, getPath, getProject, getRequiredServices, getServices, getSharedResources, getShouldRunAfter, getStandardOutputCapture, getState, getTaskActions, getTaskDependencies, getTaskIdentity, getTemporaryDir, getTemporaryDirFactory, getTimeout, hasProperty, hasTaskActions, injectIntoNewInstance, isEnabled, isHasCustomActions, mustRunAfter, onlyIf, onlyIf, prependParallelSafeAction, property, replaceLogger, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setImpliesSubProjects, setMustRunAfter, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, toString, usesService@Inject public ImageGrinderTask(WorkerExecutor workerExecutor)
@Incremental @PathSensitive(value=RELATIVE) @InputDirectory public abstract DirectoryProperty getSrcDir()
@OutputDirectory public abstract DirectoryProperty getDstDir()
public void performAction(InputChanges inputChanges) throws Exception
Exceptionpublic Serializable getBumpThisNumberWhenTheGrinderChanges()
public void setBumpThisNumberWhenTheGrinderChanges(Serializable bumpThisNumberWhenTheGrinderChanges)