You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by st...@locus.apache.org on 2000/02/09 21:51:50 UTC
cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Copydir.java GZip.java Jar.java Java.java Javac.java Jikes.java Zip.java
stefano 00/02/09 12:51:50
Modified: src/main/org/apache/tools/ant DirectoryScanner.java
src/main/org/apache/tools/ant/taskdefs Copydir.java
GZip.java Jar.java Java.java Javac.java Jikes.java
Zip.java
Log:
better abstraction on the includes/excludes
Revision Changes Path
1.2 +1 -1 jakarta-ant/src/main/org/apache/tools/ant/DirectoryScanner.java
Index: DirectoryScanner.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/DirectoryScanner.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DirectoryScanner.java 2000/02/06 16:13:55 1.1
+++ DirectoryScanner.java 2000/02/09 20:51:45 1.2
@@ -131,7 +131,7 @@
* This will scan a directory called test for .class files, but excludes all
* .class files in all directories under a directory called "modules"
*
- * @author Arnout J. Kuiper <A HREF="mailto:ajkuiper@wxs.nl">ajkuiper@wxs.nl</A>
+ * @author Arnout J. Kuiper <a href="mailto:ajkuiper@wxs.nl">ajkuiper@wxs.nl</a>
*/
public class DirectoryScanner {
1.4 +28 -129 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copydir.java
Index: Copydir.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copydir.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Copydir.java 2000/02/06 16:16:29 1.3
+++ Copydir.java 2000/02/09 20:51:47 1.4
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -9,7 +9,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -17,15 +17,15 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
+ * from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
@@ -60,154 +60,53 @@
import java.util.*;
/**
+ * Copies a directory.
*
- *
- * @author duncan@x180.com
+ * @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a>
*/
-public class Copydir extends Task {
+public class Copydir extends MatchingTask {
private File srcDir;
private File destDir;
- private String[] includes;
- private String[] excludes;
- private boolean useDefaultExcludes = true;
private Hashtable filecopyList = new Hashtable();
public void setSrc(String src) {
- srcDir = project.resolveFile(src);
+ srcDir = project.resolveFile(src);
}
public void setDest(String dest) {
- destDir = project.resolveFile(dest);
- }
-
- /**
- * Sets the set of include patterns. Patterns may be separated by a comma
- * or a space.
- *
- * @param includes the string containing the include patterns
- */
- public void setIncludes(String includes) {
- if (includes != null && includes.length() > 0) {
- Vector tmpIncludes = new Vector();
- StringTokenizer tok = new StringTokenizer(includes, ", ", false);
- while (tok.hasMoreTokens()) {
- String pattern = tok.nextToken().trim();
- if (pattern.length() > 0) {
- tmpIncludes.addElement(pattern);
- }
- }
- this.includes = new String[tmpIncludes.size()];
- for (int i = 0; i < tmpIncludes.size(); i++) {
- this.includes[i] = (String)tmpIncludes.elementAt(i);
- }
- } else {
- this.includes = null;
- }
- }
-
- /**
- * Sets the set of exclude patterns. Patterns may be separated by a comma
- * or a space.
- *
- * @param excludes the string containing the exclude patterns
- */
- public void setExcludes(String excludes) {
- if (excludes != null && excludes.length() > 0) {
- Vector tmpExcludes = new Vector();
- StringTokenizer tok = new StringTokenizer(excludes, ", ", false);
- while (tok.hasMoreTokens()) {
- String pattern = tok.nextToken().trim();
- if (pattern.length() > 0) {
- tmpExcludes.addElement(pattern);
- }
- }
- this.excludes = new String[tmpExcludes.size()];
- for (int i = 0; i < tmpExcludes.size(); i++) {
- this.excludes[i] = (String)tmpExcludes.elementAt(i);
- }
- } else {
- this.excludes = null;
- }
- }
-
- /**
- * Sets whether default exclusions should be used or not.
- *
- * @param useDefaultExcludes "true" or "on" when default exclusions should
- * be used, "false" or "off" when they
- * shouldn't be used.
- */
- public void setDefaultexcludes(String useDefaultExcludes) {
- this.useDefaultExcludes = Project.toBoolean(useDefaultExcludes);
+ destDir = project.resolveFile(dest);
}
public void execute() throws BuildException {
if (srcDir == null) {
throw new BuildException("srcdir attribute must be set!");
}
+
if (!srcDir.exists()) {
throw new BuildException("srcdir does not exist!");
}
- DirectoryScanner ds = new DirectoryScanner();
- ds.setBasedir(srcDir);
- ds.setIncludes(includes);
- ds.setExcludes(excludes);
- if (useDefaultExcludes) {
- ds.addDefaultExcludes();
- }
- ds.scan();
+ DirectoryScanner ds = super.getDirectoryScanner(srcDir);
+
String[] files = ds.getIncludedFiles();
scanDir(srcDir, destDir, files);
- if (filecopyList.size() > 0) {
- project.log("Copying " + filecopyList.size() + " files to "
- + destDir.getAbsolutePath());
- Enumeration enum = filecopyList.keys();
- while (enum.hasMoreElements()) {
- String fromFile = (String)enum.nextElement();
- String toFile = (String)filecopyList.get(fromFile);
- try {
- copyFile(fromFile, toFile);
- } catch (IOException ioe) {
- String msg = "Failed to copy " + fromFile + " to " + toFile
- + " due to " + ioe.getMessage();
- throw new BuildException(msg);
- }
- }
- }
- }
-
- /**
- List of filenames and directory names to not
- include in the final .jar file. They should be either
- , or " " (space) separated.
- <p>
- For example:
- <p>
- ignore="package.html, foo.class"
- <p>
- The ignored files will be logged.
-
- @author Jon S. Stevens <a href="mailto:jon@clearink.com">jon@clearink.com</a>
- */
- public void setIgnore(String ignoreString) {
- project.log("The ignore attribute is deprecated. "+
- "Please use the excludes attribute.",
- Project.MSG_WARN);
- if (ignoreString != null && ignoreString.length() > 0) {
- Vector tmpExcludes = new Vector();
- StringTokenizer tok = new StringTokenizer(ignoreString, ", ", false);
- while (tok.hasMoreTokens()) {
- tmpExcludes.addElement("**/"+tok.nextToken().trim()+"/**");
- }
- this.excludes = new String[tmpExcludes.size()];
- for (int i = 0; i < tmpExcludes.size(); i++) {
- this.excludes[i] = (String)tmpExcludes.elementAt(i);
+ if (filecopyList.size() > 0) {
+ project.log("Copying " + filecopyList.size() + " files to "
+ + destDir.getAbsolutePath());
+ Enumeration enum = filecopyList.keys();
+ while (enum.hasMoreElements()) {
+ String fromFile = (String)enum.nextElement();
+ String toFile = (String)filecopyList.get(fromFile);
+ try {
+ copyFile(fromFile, toFile);
+ } catch (IOException ioe) {
+ String msg = "Failed to copy " + fromFile + " to " + toFile
+ + " due to " + ioe.getMessage();
+ throw new BuildException(msg);
+ }
}
- } else {
- this.excludes = null;
}
}
@@ -218,7 +117,7 @@
File destFile = new File(to, filename);
if (srcFile.lastModified() > destFile.lastModified()) {
filecopyList.put(srcFile.getAbsolutePath(),
- destFile.getAbsolutePath());
+ destFile.getAbsolutePath());
}
}
}
1.2 +4 -7 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/GZip.java
Index: GZip.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/GZip.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GZip.java 2000/01/13 10:41:41 1.1
+++ GZip.java 2000/02/09 20:51:47 1.2
@@ -57,23 +57,20 @@
import org.apache.tools.ant.*;
import java.io.*;
-import java.util.Enumeration;
-import java.util.StringTokenizer;
-import java.util.Vector;
import java.util.zip.*;
/**
- * Allows one to create a .gz file from another file such as a tar file.
+ * Compresses a file with the GZIP algorightm. Normally used to compress
+ * non-compressed archives such as TAR files.
*
- * @author duncan@x180.com
+ * @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a>
* @author Jon S. Stevens <a href="mailto:jon@clearink.com">jon@clearink.com</a>
*/
+
public class GZip extends Task {
private File zipFile;
private File source;
- private Vector items = new Vector();
- private Vector ignoreList = new Vector();
public void setZipfile(String zipFilename) {
zipFile = project.resolveFile(zipFilename);
1.3 +3 -3 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Jar.java
Index: Jar.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Jar.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Jar.java 2000/02/06 16:16:29 1.2
+++ Jar.java 2000/02/09 20:51:47 1.3
@@ -60,9 +60,9 @@
import java.util.zip.*;
/**
- *
- *
- * @author duncan@x180.com
+ * Creates a JAR archive.
+ *
+ * @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a>
*/
public class Jar extends Zip {
1.3 +14 -1 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Java.java
Index: Java.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Java.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Java.java 2000/01/27 03:53:24 1.2
+++ Java.java 2000/02/09 20:51:48 1.3
@@ -69,6 +69,7 @@
private String classname = null;
private String args = null;
private String jvmargs = null;
+ private String classpath = null;
private boolean fork = false;
/**
@@ -85,6 +86,11 @@
if (fork) {
StringBuffer b = new StringBuffer();
b.append("java ");
+ if (classpath != null) {
+ b.append("-cp ");
+ b.append(classpath);
+ b.append(" ");
+ }
if (jvmargs != null) {
b.append(jvmargs);
b.append(" ");
@@ -98,10 +104,17 @@
run(b.toString());
} else {
Vector argList = tokenize(args);
- if (jvmargs != null) project.log("JVM args ignored when same JVM is used.", "java", project.MSG_VERBOSE);
+ if (jvmargs != null) project.log("JVM args and classpath ignored when same JVM is used.", "java", project.MSG_VERBOSE);
project.log("Java args: " + argList.toString(), "java", project.MSG_VERBOSE);
run(classname, argList);
}
+ }
+
+ /**
+ * Set the classpath to be used for this compilation.
+ */
+ public void setClasspath(String s) {
+ this.classpath = Project.translatePath(s);
}
/**
1.4 +11 -103 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javac.java
Index: Javac.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javac.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Javac.java 2000/02/06 16:16:29 1.3
+++ Javac.java 2000/02/09 20:51:48 1.4
@@ -57,10 +57,7 @@
import org.apache.tools.ant.*;
import java.io.*;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.StringTokenizer;
-import java.util.Vector;
+import java.util.*;
/**
* Task to compile Java source files. This task can take the following
@@ -84,10 +81,10 @@
* sourcedir will be copied to the destdir allowing support files to be
* located properly in the classpath.
*
- * @author duncan@x180.com
+ * @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a>
*/
-public class Javac extends Task {
+public class Javac extends MatchingTask {
private File srcDir;
private File destDir;
@@ -98,9 +95,6 @@
private String target;
private String bootclasspath;
private String extdirs;
- private String[] includes;
- private String[] excludes;
- private boolean useDefaultExcludes = true;
private Vector compileList = new Vector();
private Hashtable filecopyList = new Hashtable();
@@ -108,7 +102,6 @@
/**
* Set the source dir to find the source Java files.
*/
-
public void setSrcdir(String srcDirName) {
srcDir = project.resolveFile(srcDirName);
}
@@ -117,7 +110,6 @@
* Set the destination directory into which the Java source
* files should be compiled.
*/
-
public void setDestdir(String destDirName) {
destDir = project.resolveFile(destDirName);
}
@@ -125,7 +117,6 @@
/**
* Set the classpath to be used for this compilation.
*/
-
public void setClasspath(String classpath) {
compileClasspath = Project.translatePath(classpath);
}
@@ -134,7 +125,6 @@
* Sets the bootclasspath that will be used to compile the classes
* against.
*/
-
public void setBootclasspath(String bootclasspath) {
this.bootclasspath = Project.translatePath(bootclasspath);
}
@@ -143,114 +133,40 @@
* Sets the extension directories that will be used during the
* compilation.
*/
-
public void setExtdirs(String extdirs) {
this.extdirs = Project.translatePath(extdirs);
}
-
/**
- * Set the deprecation flag. Valid strings are "on", "off", "true", and
- * "false".
+ * Set the deprecation flag.
*/
-
- public void setDeprecation(String deprecation) {
- this.deprecation = Project.toBoolean(deprecation);
+ public void setDeprecation(String deprecationString) {
+ this.deprecation = Project.toBoolean(deprecationString);
}
-
/**
- * Set the debug flag. Valid strings are "on", "off", "true", and "false".
+ * Set the debug flag.
*/
-
public void setDebug(String debugString) {
- if (debugString.equalsIgnoreCase("on") ||
- debugString.equalsIgnoreCase("true")) {
- debug = true;
- } else {
- debug = false;
- }
+ this.debug = Project.toBoolean(debugString);
}
/**
- * Set the optimize flag. Valid strings are "on", "off", "true", and
- * "false".
+ * Set the optimize flag.
*/
-
public void setOptimize(String optimizeString) {
- if (optimizeString.equalsIgnoreCase("on") ||
- optimizeString.equalsIgnoreCase("true")) {
- optimize = true;
- } else {
- optimize = false;
- }
+ this.optimize = Project.toBoolean(optimizeString);
}
/**
* Sets the target VM that the classes will be compiled for. Valid
* strings are "1.1", "1.2", and "1.3".
*/
-
public void setTarget(String target) {
this.target = target;
}
/**
- * Sets the set of include patterns. Patterns may be separated by a comma
- * or a space.
- *
- * @param includes the string containing the include patterns
- */
- public void setIncludes(String includes) {
- if (includes != null && includes.length() > 0) {
- Vector tmpIncludes = new Vector();
- StringTokenizer tok = new StringTokenizer(includes, ", ", false);
- while (tok.hasMoreTokens()) {
- tmpIncludes.addElement(tok.nextToken().trim());
- }
- this.includes = new String[tmpIncludes.size()];
- for (int i = 0; i < tmpIncludes.size(); i++) {
- this.includes[i] = (String)tmpIncludes.elementAt(i);
- }
- } else {
- this.includes = null;
- }
- }
-
- /**
- * Sets the set of exclude patterns. Patterns may be separated by a comma
- * or a space.
- *
- * @param excludes the string containing the exclude patterns
- */
- public void setExcludes(String excludes) {
- if (excludes != null && excludes.length() > 0) {
- Vector tmpExcludes = new Vector();
- StringTokenizer tok = new StringTokenizer(excludes, ", ", false);
- while (tok.hasMoreTokens()) {
- tmpExcludes.addElement(tok.nextToken().trim());
- }
- this.excludes = new String[tmpExcludes.size()];
- for (int i = 0; i < tmpExcludes.size(); i++) {
- this.excludes[i] = (String)tmpExcludes.elementAt(i);
- }
- } else {
- this.excludes = null;
- }
- }
-
- /**
- * Sets whether default exclusions should be used or not.
- *
- * @param useDefaultExcludes "true" or "on" when default exclusions should
- * be used, "false" or "off" when they
- * shouldn't be used.
- */
- public void setDefaultexcludes(String useDefaultExcludes) {
- this.useDefaultExcludes = Project.toBoolean(useDefaultExcludes);
- }
-
- /**
* Executes the task.
*/
public void execute() throws BuildException {
@@ -269,14 +185,7 @@
// scan source and dest dirs to build up both copy lists and
// compile lists
- DirectoryScanner ds = new DirectoryScanner();
- ds.setBasedir(srcDir);
- ds.setIncludes(includes);
- ds.setExcludes(excludes);
- if (useDefaultExcludes) {
- ds.addDefaultExcludes();
- }
- ds.scan();
+ DirectoryScanner ds = super.getDirectoryScanner(srcDir);
String[] files = ds.getIncludedFiles();
@@ -411,7 +320,6 @@
}
}
-
/**
* Peforms a copmile using the classic compiler that shipped with
1.2 +19 -19 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Jikes.java
Index: Jikes.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Jikes.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Jikes.java 2000/01/13 10:41:41 1.1
+++ Jikes.java 2000/02/09 20:51:48 1.2
@@ -17,9 +17,9 @@
* @param command - name of jikes executeable
*/
protected Jikes(JikesOutputParser jop,String command) {
- super();
- this.jop = jop;
- this.command = command;
+ super();
+ this.jop = jop;
+ this.command = command;
}
/**
@@ -27,21 +27,21 @@
* @param args - arguments to pass to process on command line
*/
protected void compile(String[] args) {
- String[] commandArray = new String[args.length+1];
- commandArray[0] = command;
- System.arraycopy(args,0,commandArray,1,args.length);
-
- // We assume, that everything jikes writes goes to
- // standard output, not to standard error. The option
- // -Xstdout that is given to Jikes in Javac.doJikesCompile()
- // should guarantee this. At least I hope so. :)
- try {
- Process jikes = Runtime.getRuntime().exec(commandArray);
- BufferedReader reader = new BufferedReader(new InputStreamReader(jikes.getInputStream()));
- jop.parseOutput(reader);
- } catch (IOException e) {
- // Where could we log this to? We don't have an instance
- // of project. Perhaps we should add one to our constructor?
- }
+ String[] commandArray = new String[args.length+1];
+ commandArray[0] = command;
+ System.arraycopy(args,0,commandArray,1,args.length);
+
+ // We assume, that everything jikes writes goes to
+ // standard output, not to standard error. The option
+ // -Xstdout that is given to Jikes in Javac.doJikesCompile()
+ // should guarantee this. At least I hope so. :)
+ try {
+ Process jikes = Runtime.getRuntime().exec(commandArray);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(jikes.getInputStream()));
+ jop.parseOutput(reader);
+ } catch (IOException e) {
+ // Where could we log this to? We don't have an instance
+ // of project. Perhaps we should add one to our constructor?
+ }
}
}
1.3 +3 -145 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java
Index: Zip.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Zip.java 2000/02/06 16:16:29 1.2
+++ Zip.java 2000/02/09 20:51:48 1.3
@@ -63,21 +63,16 @@
import java.util.zip.*;
/**
- * Same as the Jar task, but creates .zip files without the MANIFEST
- * stuff that .jar files have.
+ * Create a ZIP archive.
*
* @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a>
* @author Jon S. Stevens <a href="mailto:jon@clearink.com">jon@clearink.com</a>
*/
-public class Zip extends Task {
+public class Zip extends MatchingTask {
private File zipFile;
private File baseDir;
- private String[] includes;
- private String[] excludes;
- private boolean useDefaultExcludes = true;
- private File manifest;
protected String archiveType = "zip";
/**
@@ -95,136 +90,6 @@
baseDir = project.resolveFile(baseDirname);
}
- /**
- Set this to be the items in the base directory
- that you want to include in the zip archive.
- (ie: items="foo, bar, ack.html, f.java").
- You can also specify "*" for the items (ie: items="*")
- and it will include all the items in the base directory.
- Do not try to have items="*, foo". Also note that
- you can specify items to ignore with setIgnore and they
- will still be ignored if you choose "*". Sometimes
- ignore lists are easier than include lists. ;-)
- */
- public void setItems(String itemString) {
- project.log("The items attribute is deprecated. "+
- "Please use the includes attribute.",
- Project.MSG_WARN);
- if (itemString == null || itemString.equals("*")) {
- includes = new String[1];
- includes[0] = "**";
- } else {
- Vector tmpIncludes = new Vector();
- StringTokenizer tok = new StringTokenizer(itemString, ", ");
- while (tok.hasMoreTokens()) {
- String pattern = tok.nextToken().trim();
- if (pattern.length() > 0) {
- tmpIncludes.addElement(pattern+"/**");
- }
- }
- this.includes = new String[tmpIncludes.size()];
- for (int i = 0; i < tmpIncludes.size(); i++) {
- this.includes[i] = (String)tmpIncludes.elementAt(i);
- }
- }
- }
-
- /**
- List of filenames and directory names to not
- include in the final .jar file. They should be either
- , or " " (space) separated.
- <p>
- For example:
- <p>
- ignore="package.html, foo.class"
- <p>
- The ignored files will be logged.
-
- @author Jon S. Stevens <a href="mailto:jon@clearink.com">jon@clearink.com</a>
- */
- public void setIgnore(String ignoreString) {
- project.log("The ignore attribute is deprecated. "+
- "Please use the excludes attribute.",
- Project.MSG_WARN);
- if (ignoreString == null) {
- this.excludes = null;
- } else {
- Vector tmpExcludes = new Vector();
- StringTokenizer tok = new StringTokenizer(ignoreString, ", ");
- while (tok.hasMoreTokens()) {
- String pattern = tok.nextToken().trim();
- if (pattern.length() > 0) {
- tmpExcludes.addElement("**/"+pattern+"/**");
- }
- }
- this.excludes = new String[tmpExcludes.size()];
- for (int i = 0; i < tmpExcludes.size(); i++) {
- this.excludes[i] = (String)tmpExcludes.elementAt(i);
- }
- }
- }
-
- /**
- * Sets the set of include patterns. Patterns may be separated by a comma
- * or a space.
- *
- * @param includes the string containing the include patterns
- */
- public void setIncludes(String includes) {
- if (includes == null) {
- this.includes = null;
- } else {
- Vector tmpIncludes = new Vector();
- StringTokenizer tok = new StringTokenizer(includes, ", ");
- while (tok.hasMoreTokens()) {
- String pattern = tok.nextToken().trim();
- if (pattern.length() > 0) {
- tmpIncludes.addElement(pattern);
- }
- }
- this.includes = new String[tmpIncludes.size()];
- for (int i = 0; i < tmpIncludes.size(); i++) {
- this.includes[i] = (String)tmpIncludes.elementAt(i);
- }
- }
- }
-
- /**
- * Sets the set of exclude patterns. Patterns may be separated by a comma
- * or a space.
- *
- * @param excludes the string containing the exclude patterns
- */
- public void setExcludes(String excludes) {
- if (excludes == null) {
- this.excludes = null;
- } else {
- Vector tmpExcludes = new Vector();
- StringTokenizer tok = new StringTokenizer(excludes, ", ", false);
- while (tok.hasMoreTokens()) {
- String pattern = tok.nextToken().trim();
- if (pattern.length() > 0) {
- tmpExcludes.addElement(pattern);
- }
- }
- this.excludes = new String[tmpExcludes.size()];
- for (int i = 0; i < tmpExcludes.size(); i++) {
- this.excludes[i] = (String)tmpExcludes.elementAt(i);
- }
- }
- }
-
- /**
- * Sets whether default exclusions should be used or not.
- *
- * @param useDefaultExcludes "true" or "on" when default exclusions should
- * be used, "false" or "off" when they
- * shouldn't be used.
- */
- public void setDefaultexcludes(String useDefaultExcludes) {
- this.useDefaultExcludes = Project.toBoolean(useDefaultExcludes);
- }
-
public void execute() throws BuildException {
project.log("Building "+ archiveType +": "+ zipFile.getAbsolutePath());
@@ -235,14 +100,7 @@
throw new BuildException("basedir does not exist!");
}
- DirectoryScanner ds = new DirectoryScanner();
- ds.setBasedir(baseDir);
- ds.setIncludes(includes);
- ds.setExcludes(excludes);
- if (useDefaultExcludes) {
- ds.addDefaultExcludes();
- }
- ds.scan();
+ DirectoryScanner ds = super.getDirectoryScanner(baseDir);
String[] files = ds.getIncludedFiles();
String[] dirs = ds.getIncludedDirectories();