|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
com.threerings.cast.bundle.tools.ComponentBundlerTask
public class ComponentBundlerTask
Ant task for creating component bundles. This task must be configured with a number of parameters:
target=[path to bundle file, which will be created]
mapfile=[path to the component map file which maintains a mapping from
component id to component class/name, it will be created the
first time and updated as new components are mapped]
It should also contain one or more nested <fileset> elements that
enumerate the action tileset images that should be included in the
component bundle.
| Nested Class Summary | |
|---|---|
protected static class |
ComponentBundlerTask.HashMapIDBroker
|
| Field Summary | |
|---|---|
protected File |
_actionDef
The path to our action tilesets definition file. |
protected ArrayList<FileSet> |
_filesets
A list of filesets that contain tile images. |
protected boolean |
_keepRawPngs
Whether we should keep raw pngs rather than reencoding them in the bundle. |
protected File |
_mapfile
The path to our component map file. |
protected String |
_root
The component directory root. |
protected File |
_target
The path to our component bundle file. |
protected boolean |
_uncompressed
Whether we should keep the bundle jars uncompressed rather than zipped. |
protected static String[] |
AUX_EXTS
Used to process auxilliary tilesets. |
protected static String |
SEP_STR
Used to separate keys and values in the map file. |
| Fields inherited from class org.apache.tools.ant.Task |
|---|
target, taskName, taskType, wrapper |
| Fields inherited from class org.apache.tools.ant.ProjectComponent |
|---|
description, location, project |
| Constructor Summary | |
|---|---|
ComponentBundlerTask()
|
|
| Method Summary | |
|---|---|
void |
addFileset(FileSet set)
Adds a nested <fileset> element. |
protected String |
composePath(String[] info,
String extension)
Composes a triplet of [class, name, action] into the path that should be supplied to the JarEntry that contains the associated image data. |
protected OutputStream |
createOutputStream(File target)
Creates the base output stream to which to write our bundle's files. |
protected String[] |
decomposePath(String path)
Decomposes the full path to a component image into a [class, name, action] triplet. |
protected void |
ensureSet(Object value,
String errmsg)
|
void |
execute()
Performs the actual work of the task. |
protected long |
getNewestDate(ArrayList<Object> sources)
|
protected long |
getNewestDate(Object source)
|
protected ComponentBundlerTask.HashMapIDBroker |
loadBroker(File mapfile)
Loads the hashmap ID broker from its persistent representation in the specified file. |
protected OutputStream |
nextEntry(OutputStream lastEntry,
String path)
Advances to the next named entry in the bundle and returns the stream to which to write that entry. |
protected void |
processComponent(String[] info,
TileSet aset,
File cfile,
OutputStream fout,
long newest)
|
protected void |
saveBroker(File mapfile,
ComponentIDBroker broker)
Stores a persistent representation of the supplied hashmap ID broker in the specified file. |
void |
setActiondef(File actiondef)
Sets the path to the action tilesets definition file. |
void |
setKeepRawPngs(boolean keep)
Note whether we are supposed to use the raw png files directly in the bundle or try to re-encode them. |
void |
setMapfile(File mapfile)
Sets the path to the component map file that we'll use to obtain component ids for the bundled components. |
void |
setRoot(File root)
Sets the root path which will be stripped from the image paths prior to parsing them to obtain the component class, type and action names. |
void |
setTarget(File target)
Sets the path to the bundle file that we'll be creating. |
void |
setUncompressed(boolean uncompressed)
Note whether we are supposed to leave the jar uncompressed rather than the normal process of zipping it at maximum compression. |
protected boolean |
skipEntry(String path,
long newest)
Returns whether we should skip the specified entry in the bundle, presumably if it was already created and up to date. |
protected boolean |
skipIfTargetNewer()
Returns whether we should skip updating the bundle if the target is newer than any component. |
protected TrimmedTileSet |
trim(TileSet aset,
OutputStream fout)
Converts the tileset to a trimmed tile set and saves it at the specified location. |
| Methods inherited from class org.apache.tools.ant.Task |
|---|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
| Methods inherited from class org.apache.tools.ant.ProjectComponent |
|---|
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected File _target
protected File _mapfile
protected File _actionDef
protected String _root
protected ArrayList<FileSet> _filesets
protected boolean _keepRawPngs
protected boolean _uncompressed
protected static final String SEP_STR
protected static final String[] AUX_EXTS
| Constructor Detail |
|---|
public ComponentBundlerTask()
| Method Detail |
|---|
public void setTarget(File target)
public void setMapfile(File mapfile)
public void setActiondef(File actiondef)
public void setRoot(File root)
public void addFileset(FileSet set)
public void setKeepRawPngs(boolean keep)
public void setUncompressed(boolean uncompressed)
public void execute()
throws BuildException
execute in class TaskBuildException
protected void processComponent(String[] info,
TileSet aset,
File cfile,
OutputStream fout,
long newest)
throws IOException,
BuildException
IOException
BuildExceptionprotected long getNewestDate(ArrayList<Object> sources)
protected long getNewestDate(Object source)
protected boolean skipIfTargetNewer()
protected String[] decomposePath(String path)
throws BuildException
BuildException
protected String composePath(String[] info,
String extension)
protected void ensureSet(Object value,
String errmsg)
throws BuildException
BuildException
protected OutputStream createOutputStream(File target)
throws IOException
IOException
protected OutputStream nextEntry(OutputStream lastEntry,
String path)
throws IOException
IOException
protected boolean skipEntry(String path,
long newest)
protected TrimmedTileSet trim(TileSet aset,
OutputStream fout)
throws IOException
IOException
protected ComponentBundlerTask.HashMapIDBroker loadBroker(File mapfile)
throws BuildException
BuildException
protected void saveBroker(File mapfile,
ComponentIDBroker broker)
throws BuildException
BuildException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||