You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by ke...@apache.org on 2007/10/08 06:31:38 UTC
svn commit: r582707 -
/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java
Author: kevj
Date: Sun Oct 7 21:31:23 2007
New Revision: 582707
URL: http://svn.apache.org/viewvc?rev=582707&view=rev
Log:
-bugzilla #32062, allow javah to use filesets
Modified:
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java?rev=582707&r1=582706&r2=582707&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java Sun Oct 7 21:31:23 2007
@@ -23,14 +23,17 @@
import java.util.Enumeration;
import java.util.StringTokenizer;
import java.util.Vector;
+
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.optional.javah.JavahAdapter;
import org.apache.tools.ant.taskdefs.optional.javah.JavahAdapterFactory;
import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference;
+import org.apache.tools.ant.util.StringUtils;
import org.apache.tools.ant.util.facade.FacadeTaskHelper;
import org.apache.tools.ant.util.facade.ImplementationSpecificArgument;
@@ -78,9 +81,9 @@
private boolean stubs = false;
private Path bootclasspath;
//private Path extdirs;
- private static String lSep = System.getProperty("line.separator");
private FacadeTaskHelper facade = null;
-
+ private Vector files = new Vector();
+
/**
* No arg constructor.
*/
@@ -134,6 +137,10 @@
}
}
+ public void addFileSet(FileSet fs) {
+ files.add(fs);
+ }
+
/**
* Names of the classes to process.
* @return the array of classes.
@@ -148,6 +155,18 @@
}
}
+ if(files.size() > 0) {
+ for(Enumeration e = files.elements(); e.hasMoreElements();){
+ FileSet fs = (FileSet)e.nextElement();
+ String[] includedClasses = fs.getDirectoryScanner(getProject()).getIncludedFiles();
+ for(int i = 0; i < includedClasses.length; i++) {
+ String className =
+ includedClasses[i].replace('\\', '.').replace('/', '.').substring(0,includedClasses[i].length()-6);
+ al.add(className);
+ }
+ }
+ }
+
Enumeration e = classes.elements();
while (e.hasMoreElements()) {
ClassArgument arg = (ClassArgument) e.nextElement();
@@ -390,14 +409,14 @@
public void execute() throws BuildException {
// first off, make sure that we've got a srcdir
- if ((cls == null) && (classes.size() == 0)) {
+ if ((cls == null) && (classes.size() == 0) && (files.size() == 0)) {
throw new BuildException("class attribute must be set!",
getLocation());
}
- if ((cls != null) && (classes.size() > 0)) {
- throw new BuildException("set class attribute or class element, "
- + "not both.", getLocation());
+ if ((cls != null) && (classes.size() > 0) && (files.size() > 0)) {
+ throw new BuildException("set class attribute OR class element OR fileset, "
+ + "not 2 or more of them.", getLocation());
}
if (destDir != null) {
@@ -449,7 +468,7 @@
cmd.createArgument().setValue(c[i]);
niceClassList.append(" ");
niceClassList.append(c[i]);
- niceClassList.append(lSep);
+ niceClassList.append(StringUtils.LINE_SEP);
}
StringBuffer prefix = new StringBuffer("Class");
@@ -457,9 +476,8 @@
prefix.append("es");
}
prefix.append(" to be compiled:");
- prefix.append(lSep);
+ prefix.append(StringUtils.LINE_SEP);
log(prefix.toString() + niceClassList.toString(), Project.MSG_VERBOSE);
}
-}
-
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org