Top Description Inners Fields Constructors Methods
org.apache.tools.ant.taskdefs

public Class DependSet

extends MatchingTask
Class Inheritance
Imports
java.io.File, java.util.Date, .Iterator, org.apache.tools.ant.BuildException, .Project, org.apache.tools.ant.types.FileList, .FileSet, .Path, .Resource, .ResourceCollection, .TimeComparison, org.apache.tools.ant.types.resources.Resources, .Restrict, .Union, org.apache.tools.ant.types.resources.comparators.ResourceComparator, .Reverse, org.apache.tools.ant.types.resources.selectors.Exists, .Not, .ResourceSelector, org.apache.tools.ant.util.StreamUtils

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: At least one of both source and target entities is required.

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:

Since
Ant 1.4

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private static final ResourceComparator
private static final ResourceSelector
private static final ResourceComparator
private Union
private Path
private boolean
Inherited from org.apache.tools.ant.taskdefs.MatchingTask:
fileset

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addSrcfilelist(FileList
the FileList to add.
fl
)

Add a list of source files.

public void
addSrcfileset(FileSet
the FileSet to add.
fs
)

Add a set of source files.

public void
addTargetfilelist(FileList
the FileList to add.
fl
)

Add a list of target files.

public void
addTargetfileset(FileSet
the FileSet to add.
fs
)

Add a set of target files.

public synchronized Union

Returns:

a Union instance.
createSources
()

Create a nested sources element.

public synchronized Path

Returns:

a Union instance.
createTargets
()

Create a nested targets element.

public void
execute()

Overrides org.apache.tools.ant.Task.execute.

Execute the task.
private Resource
private Resource
private Resource
private void
private void
private void
public void
setVerbose(boolean
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.

private boolean
Inherited from org.apache.tools.ant.taskdefs.MatchingTask:
addaddAndaddContainsaddContainsRegexpaddCustomaddDateaddDependaddDepthaddDifferentaddFilenameaddMajorityaddModifiedaddNoneaddNotaddOraddPresentaddSelectoraddSizeaddTypeappendSelectorcreateExcludecreateExcludesFilecreateIncludecreateIncludesFilecreatePatternSetgetDirectoryScannergetImplicitFileSetgetSelectorshasSelectorsselectorCountselectorElementssetCaseSensitivesetDefaultexcludessetExcludessetExcludesfilesetFollowSymlinkssetIncludessetIncludesfilesetProjectXsetIgnoreXsetItems

Field Detail

DATEback to summary
private static final ResourceComparator DATE
NOT_EXISTSback to summary
private static final ResourceSelector NOT_EXISTS
REVERSE_DATEback to summary
private static final ResourceComparator REVERSE_DATE
sourcesback to summary
private Union sources
targetsback to summary
private Path targets
verboseback to summary
private boolean verbose

Constructor Detail

DependSetback to summary
public DependSet()

Method Detail

addSrcfilelistback to summary
public void addSrcfilelist(FileList fl)

Add a list of source files.

Parameters
fl:FileList

the FileList to add.

addSrcfilesetback to summary
public void addSrcfileset(FileSet fs)

Add a set of source files.

Parameters
fs:FileSet

the FileSet to add.

addTargetfilelistback to summary
public void addTargetfilelist(FileList fl)

Add a list of target files.

Parameters
fl:FileList

the FileList to add.

addTargetfilesetback to summary
public void addTargetfileset(FileSet fs)

Add a set of target files.

Parameters
fs:FileSet

the FileSet to add.

createSourcesback to summary
public synchronized Union createSources()

Create a nested sources element.

Returns:Union

a Union instance.

createTargetsback to summary
public synchronized Path createTargets()

Create a nested targets element.

Returns:Path

a Union instance.

executeback to summary
public void execute() throws BuildException

Overrides org.apache.tools.ant.Task.execute.

Execute the task.

Annotations
@Override
Exceptions
BuildException:
if errors occur.
getNewestback to summary
private Resource getNewest(ResourceCollection rc)
getOldestback to summary
private Resource getOldest(ResourceCollection rc)
getXestback to summary
private Resource getXest(ResourceCollection rc, ResourceComparator c)
logFutureback to summary
private void logFuture(ResourceCollection rc, ResourceSelector rsel)
logMissingback to summary
private void logMissing(ResourceCollection missing, String what)
logWithModificationTimeback to summary
private void logWithModificationTime(Resource r, String what)
setVerboseback to summary
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

boolean

Since
Ant 1.8.0
uptodateback to summary
private boolean uptodate(ResourceCollection src, ResourceCollection target)
org.apache.tools.ant.taskdefs back to summary

private final Class DependSet.HideMissingBasedir

extends Object
implements ResourceCollection
Class Inheritance
All Implemented Interfaces
org.apache.tools.ant.types.ResourceCollection, java.lang.Iterable

Field Summary

Modifier and TypeField and Description
private FileSet

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private boolean
public boolean
isFilesystemOnly()

Implements org.apache.tools.ant.types.ResourceCollection.isFilesystemOnly.

Indicate whether this ResourceCollection is composed entirely of Resources accessible via local filesystem conventions.
public Iterator<Resource>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.
public int
size()

Implements org.apache.tools.ant.types.ResourceCollection.size.

Learn the number of contained Resources.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fsback to summary
private FileSet fs

Constructor Detail

HideMissingBasedirback to summary
private HideMissingBasedir(FileSet fs)

Method Detail

basedirExistsback to summary
private boolean basedirExists()
isFilesystemOnlyback to summary
public boolean isFilesystemOnly()

Implements org.apache.tools.ant.types.ResourceCollection.isFilesystemOnly.

Doc from org.apache.tools.ant.types.ResourceCollection.isFilesystemOnly.

Indicate whether this ResourceCollection is composed entirely of Resources accessible via local filesystem conventions. If true, all resources returned from this collection should respond with a org.apache.tools.ant.types.resources.FileProvider when asked via Resource#as.

Returns:boolean

whether this is a filesystem-only resource collection.

Annotations
@Override
iteratorback to summary
public Iterator<Resource> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<Resource>

an Iterator.

Annotations
@Override
sizeback to summary
public int size()

Implements org.apache.tools.ant.types.ResourceCollection.size.

Doc from org.apache.tools.ant.types.ResourceCollection.size.

Learn the number of contained Resources.

Returns:int

number of elements as int.

Annotations
@Override
org.apache.tools.ant.taskdefs back to summary

private final Class DependSet.NonExistent

extends Restrict
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from org.apache.tools.ant.types.resources.Restrict:
addadddieOnCircularReferenceisCacheisFilesystemOnlyiteratorsetCachesizetoString

Constructor Detail

NonExistentback to summary
private NonExistent(ResourceCollection rc)