Package org.apache.tools.ant.taskdefs
Class DependSet
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.tools.ant.taskdefs.MatchingTask
org.apache.tools.ant.taskdefs.DependSet
- All Implemented Interfaces:
java.lang.Cloneable,SelectorContainer
public class DependSet extends MatchingTask
Examines and removes out of date target files. If any of the target files
are out of date with respect to any of the source files, all target
files are removed. This is useful where dependencies cannot be
computed (for example, dynamically interpreted parameters or files
that need to stay in synch but are not directly linked) or where
the ant task in question could compute them but does not (for
example, the linked DTD for an XML file using the XSLT task).
nested arguments:
- sources (resource union describing the source resources to examine)
- srcfileset (fileset describing the source files to examine)
- srcfilelist (filelist describing the source files to examine)
- targets (path describing the target files to examine)
- targetfileset (fileset describing the target files to examine)
- targetfilelist (filelist describing the target files to examine)
This task will examine each of the sources against each of the target files. If any target files are out of date with respect to any of the sources, all targets are removed. If any sources or targets do not exist, all targets are removed. Hint: If missing files should be ignored, specify them as include patterns in filesets, rather than using filelists.
This task attempts to optimize speed of dependency checking by comparing only the dates of the oldest target file and the newest source.
Example uses:
- Record the fact that an XML file must be up to date with respect to its XSD (Schema file), even though the XML file itself includes no reference to its XSD.
- Record the fact that an XSL stylesheet includes other sub-stylesheets
- Record the fact that java files must be recompiled if the ant build file changes
- Since:
- Ant 1.4
-
Field Summary
-
Constructor Summary
Constructors Constructor Description DependSet() -
Method Summary
Modifier and Type Method Description voidaddSrcfilelist(FileList fl)Add a list of source files.voidaddSrcfileset(FileSet fs)Add a set of source files.voidaddTargetfilelist(FileList fl)Add a list of target files.voidaddTargetfileset(FileSet fs)Add a set of target files.UnioncreateSources()Create a nested sources element.PathcreateTargets()Create a nested targets element.voidexecute()Execute the task.voidsetVerbose(boolean b)In verbose mode missing targets and sources as well as the modification times of the newest source and latest target will be logged as info.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, XsetItemsMethods 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, setTaskTypeMethods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation
-
Constructor Details
-
DependSet
public DependSet()
-
-
Method Details
-
createSources
Create a nested sources element.- Returns:
- a Union instance.
-
addSrcfileset
Add a set of source files.- Parameters:
fs- the FileSet to add.
-
addSrcfilelist
Add a list of source files.- Parameters:
fl- the FileList to add.
-
createTargets
Create a nested targets element.- Returns:
- a Union instance.
-
addTargetfileset
Add a set of target files.- Parameters:
fs- the FileSet to add.
-
addTargetfilelist
Add a list of target files.- Parameters:
fl- the FileList to add.
-
setVerbose
public void setVerbose(boolean b)In verbose mode missing targets and sources as well as the modification times of the newest source and latest target will be logged as info.All deleted files will be logged as well.
- Parameters:
b- boolean- Since:
- Ant 1.8.0
-
execute
Execute the task.- Overrides:
executein classTask- Throws:
BuildException- if errors occur.
-