NIHVIVO-2811 Improve DirDifferenceFileSet to take <include> elements. This simplifies the build script.
This commit is contained in:
parent
38a5269521
commit
0ef4a791c8
3 changed files with 39 additions and 48 deletions
|
@ -3,13 +3,13 @@
|
|||
package edu.cornell.mannlib.vitro.utilities.anttasks;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.types.FileSet;
|
||||
import org.apache.tools.ant.types.PatternSet;
|
||||
import org.apache.tools.ant.types.Resource;
|
||||
import org.apache.tools.ant.types.ResourceCollection;
|
||||
import org.apache.tools.ant.types.resources.FileResource;
|
||||
|
@ -18,20 +18,26 @@ import org.apache.tools.ant.types.resources.FileResource;
|
|||
* A base class for our custom-made FileSet extensions.
|
||||
*/
|
||||
public abstract class AbstractWrappedFileSet implements ResourceCollection {
|
||||
private Project p;
|
||||
|
||||
/** The list of FileResources that we will yield to the task. */
|
||||
protected List<FileResource> files;
|
||||
|
||||
private Project p;
|
||||
private File dir;
|
||||
|
||||
private FileSet fileSet;
|
||||
/** The internal FileSet */
|
||||
private FileSet fileSet = new FileSet();
|
||||
|
||||
public void setProject(Project p) {
|
||||
this.p = p;
|
||||
fileSet.setProject(p);
|
||||
}
|
||||
|
||||
public void setDir(File dir) {
|
||||
this.dir = dir;
|
||||
fileSet.setDir(dir);
|
||||
}
|
||||
|
||||
public PatternSet.NameEntry createInclude() {
|
||||
return fileSet.createInclude();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
|
@ -58,14 +64,11 @@ public abstract class AbstractWrappedFileSet implements ResourceCollection {
|
|||
|
||||
protected abstract void fillFileList();
|
||||
|
||||
protected Project getProject() {
|
||||
return p;
|
||||
}
|
||||
|
||||
protected FileSet getInternalFileSet() {
|
||||
if (fileSet != null) {
|
||||
return fileSet;
|
||||
}
|
||||
|
||||
fileSet = new FileSet();
|
||||
fileSet.setProject(p);
|
||||
fileSet.setDir(dir);
|
||||
return fileSet;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,10 +16,12 @@ import org.apache.tools.ant.types.resources.FileResource;
|
|||
public class DirDifferenceFileSet extends AbstractWrappedFileSet {
|
||||
private Path blockingPath;
|
||||
|
||||
@SuppressWarnings("hiding")
|
||||
public void addConfiguredPath(Path blockingPath) {
|
||||
this.blockingPath = blockingPath;
|
||||
}
|
||||
public Path createBlockingPath() {
|
||||
if (blockingPath == null) {
|
||||
blockingPath = new Path(getProject());
|
||||
}
|
||||
return blockingPath.createPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillFileList() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue