From 0ef4a791c86adfedee524c5c15098da6203b0124 Mon Sep 17 00:00:00 2001 From: j2blake Date: Sun, 11 Sep 2011 15:05:13 +0000 Subject: [PATCH] NIHVIVO-2811 Improve DirDifferenceFileSet to take elements. This simplifies the build script. --- .../anttasks/AbstractWrappedFileSet.java | 29 ++++++----- .../anttasks/DirDifferenceFileSet.java | 10 ++-- webapp/product-build.xml | 48 +++++++------------ 3 files changed, 39 insertions(+), 48 deletions(-) diff --git a/utilities/anttasks/src/edu/cornell/mannlib/vitro/utilities/anttasks/AbstractWrappedFileSet.java b/utilities/anttasks/src/edu/cornell/mannlib/vitro/utilities/anttasks/AbstractWrappedFileSet.java index 9b9e80b18..ff01a3bdd 100644 --- a/utilities/anttasks/src/edu/cornell/mannlib/vitro/utilities/anttasks/AbstractWrappedFileSet.java +++ b/utilities/anttasks/src/edu/cornell/mannlib/vitro/utilities/anttasks/AbstractWrappedFileSet.java @@ -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 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; } diff --git a/utilities/anttasks/src/edu/cornell/mannlib/vitro/utilities/anttasks/DirDifferenceFileSet.java b/utilities/anttasks/src/edu/cornell/mannlib/vitro/utilities/anttasks/DirDifferenceFileSet.java index 2ebd9bb19..72af590cd 100644 --- a/utilities/anttasks/src/edu/cornell/mannlib/vitro/utilities/anttasks/DirDifferenceFileSet.java +++ b/utilities/anttasks/src/edu/cornell/mannlib/vitro/utilities/anttasks/DirDifferenceFileSet.java @@ -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() { diff --git a/webapp/product-build.xml b/webapp/product-build.xml index 89ec1acb5..19ef4a7fc 100644 --- a/webapp/product-build.xml +++ b/webapp/product-build.xml @@ -54,9 +54,9 @@ - + - + @@ -67,37 +67,23 @@ - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + +