Author: bodewig
Date: Mon Aug 17 03:56:28 2009
New Revision: 804843
URL: http://svn.apache.org/viewvc?rev=804843&view=rev
Log:
filesOnly mode for archiving tasks
Modified:
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/ArchiveBase.java
Modified:
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/ArchiveBase.java
URL:
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/ArchiveBase.java?rev=804843&r1=804842&r2=804843&view=diff
==============================================================================
---
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/ArchiveBase.java
(original)
+++
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/ArchiveBase.java
Mon Aug 17 03:56:28 2009
@@ -66,6 +66,7 @@
private List/*<ResourceCollection>*/ sources = new ArrayList();
private Mode mode = new Mode();
private String encoding;
+ private boolean filesOnly = true;
protected ArchiveBase(StreamFactory factory, EntryBuilder builder) {
this.factory = factory;
@@ -111,6 +112,13 @@
encoding = e;
}
+ /**
+ * Whether only file entries should be added to the archive.
+ */
+ public void setFilesOnly(boolean b) {
+ filesOnly = b;
+ }
+
public void execute() {
validate();
if (!dest.isExists()) {
@@ -157,7 +165,9 @@
ResourceCollectionFlags rcFlags = getFlags(rc);
for (Iterator rs = rc.iterator(); rs.hasNext(); ) {
Resource r = (Resource) rs.next();
- l.add(new ResourceWithFlags(r, rcFlags, getFlags(r)));
+ if (!filesOnly || !r.isDirectory()) {
+ l.add(new ResourceWithFlags(r, rcFlags, getFlags(r)));
+ }
}
}
return (ResourceWithFlags[]) l.toArray(new
ResourceWithFlags[l.size()]);