org.lightwolf.tools
Class LightWolfAntTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.apache.tools.ant.taskdefs.MatchingTask
              extended by org.lightwolf.tools.LightWolfAntTask
All Implemented Interfaces:
Cloneable, SelectorContainer

public class LightWolfAntTask
extends MatchingTask

An Ant task that enhances classes that uses FlowMethod annotation. This task reads the specified .class files, looking for flow methods in each file. If a class contains flow methods, each of them will have its bytecode enhanced, and the class is rewritten to file system. Classes without flow methods are untouched.

The classes to enhance are specified in the classesdir attribute, which contains directories separated by semicolon. If an entry in the classesdir is a JAR or ZIP, such file is not itself transformed or changed in any way, but their classes are read to check whether they contain flow methods that are referenced by enhanced classes.

This task is a matching task, which means that you can add selectors such as <exclude> and <different>. Below are some examples:

Example 1: enhances all classes in the bin directory:

 <project name="Sample" default="main">
     <taskdef name="lightwolf" classname="org.lightwolf.tools.LightWolfAntTask" />
     <target name="main">
         <lightwolf classesdir="bin"/>
     </target>
 </project>
 
Example 2: enhances all classes in the bin directory, except Test* classes:
 <project name="Sample" default="main">
     <taskdef name="lightwolf" classname="org.lightwolf.tools.LightWolfAntTask" />
     <target name="main">
         <lightwolf classesdir="bin">
             <exclude name="**/Test*"/>
         </lightwolf>
     </target>
 </project>
 
Example 3: enhances all classes in the lwbin directory, except those that are identical to classes in the bin directory:
 <project name="Sample" default="main">
     <taskdef name="lightwolf" classname="org.lightwolf.tools.LightWolfAntTask" />
     <target name="main">
         <lightwolf classesdir="lwbin">
             <different targetdir="bin" ignoreFileTimes="true"/>
         </lightwolf>
     </target>
 </project>
 
Example 4: enhances all classes in the bin1 and bin2 directories, considering flow methods that might be in the referenced.jar file.
 <project name="Sample" default="main">
     <taskdef name="lightwolf" classname="org.lightwolf.tools.LightWolfAntTask" />
     <target name="main">
         <lightwolf classesdir="bin1;bin2;referenced.jar"/>
     </target>
 </project>
 

Author:
Fernando Colombo

Field Summary
 
Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask
fileset
 
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
LightWolfAntTask()
           
 
Method Summary
 void execute()
           
 Path getClassesdir()
           
static void main(String[] args)
           
 void setClassesdir(Path srcDir)
           
 
Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask
add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems
 
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
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LightWolfAntTask

public LightWolfAntTask()
Method Detail

main

public static void main(String[] args)

setClassesdir

public void setClassesdir(Path srcDir)

getClassesdir

public Path getClassesdir()

execute

public void execute()
             throws BuildException
Overrides:
execute in class Task
Throws:
BuildException