com.jimischopp.ant
Class FileGroupingJavac

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.apache.tools.ant.taskdefs.Javac
                  extended by com.jimischopp.ant.FileGroupingJavac
All Implemented Interfaces:
org.apache.tools.ant.types.selectors.SelectorContainer

public class FileGroupingJavac
extends org.apache.tools.ant.taskdefs.Javac

Compiles Java source files, grouping files into sets of XX (configurable) files, and passing each group separately to the java compiler. This task directly extends the "javac" task, and therefore supports/requires any arguments as specified by javac. Additionally, the FileGroupingJavac task takes the following argument:

As with javac, when this task executes, it will recursively scan the sourcedir and destdir looking for Java source files to compile. This task makes its compile decision based on timestamp.

However, the files selected for compilation will be additionaly grouped into sets of (not larger than) "groupsize" files. The compiler is then called once for each group (instead of just once for the entire fileset, as with javac.) This is useful when the fileset is large and you typically receive out-of-memory exceptions while compiling. This does NOT take into account dependency issues however, so, if file A must be compiled in the same pass as file B, and file B was put into another group, then the compile for file A may fail. (However, if you do incremental builds - which is most likely the case for large filesets - then file A will compile the second time since file B would have already been compiled.)

When creating the filegroups, FileGroupingJavac evenly distributes the files into the groups. For example, if you specify groupsize=100 and the initial fileset contains 102 files, then FileGroupingJavac will make 2 groups of 51 files (NOT 1 group of 100 files, and another of just 2).

Copyright 2003, James Schopp

Since:
Oct 27, 2003
Author:
James Schopp
See Also:
javac

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.tools.ant.taskdefs.Javac
org.apache.tools.ant.taskdefs.Javac.ImplementationSpecificArgument
 
Field Summary
static int DEFAULT_GROUP_SIZE
           
 
Constructor Summary
FileGroupingJavac()
           
 
Method Summary
 int getGroupsize()
          The getter for the "GroupSize" attribute
 void setGroupsize(int newSize)
          The setter for the "groupsize" attribute
 
Methods inherited from class org.apache.tools.ant.taskdefs.Javac
createBootclasspath, createClasspath, createCompilerArg, createExtdirs, createSourcepath, createSrc, execute, getBootclasspath, getClasspath, getCompiler, getCompilerVersion, getCurrentCompilerArgs, getDebug, getDebugLevel, getDepend, getDeprecation, getDestdir, getEncoding, getExecutable, getExtdirs, getFailonerror, getFileList, getIncludeantruntime, getIncludejavaruntime, getJavacExecutable, getListfiles, getMemoryInitialSize, getMemoryMaximumSize, getNowarn, getOptimize, getSource, getSourcepath, getSrcdir, getTarget, getTempdir, getVerbose, isForkedJavac, setBootclasspath, setBootClasspathRef, setClasspath, setClasspathRef, setCompiler, setDebug, setDebugLevel, setDepend, setDeprecation, setDestdir, setEncoding, setExecutable, setExtdirs, setFailonerror, setFork, setIncludeantruntime, setIncludejavaruntime, setListfiles, setMemoryInitialSize, setMemoryMaximumSize, setNowarn, setOptimize, setProceed, setSource, setSourcepath, setSourcepathRef, setSrcdir, setTarget, setTempdir, setVerbose
 
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, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, init, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_GROUP_SIZE

public static final int DEFAULT_GROUP_SIZE
See Also:
Constant Field Values
Constructor Detail

FileGroupingJavac

public FileGroupingJavac()
Method Detail

setGroupsize

public void setGroupsize(int newSize)
The setter for the "groupsize" attribute

Parameters:
newSize -

getGroupsize

public int getGroupsize()
The getter for the "GroupSize" attribute

Returns:
the value of the "GroupSize" attribute