Methods Summary |
---|
public org.apache.tools.ant.util.facade.ImplementationSpecificArgument | createArg()Adds an implementation specific command-line argument.
ImplementationSpecificArgument arg =
new ImplementationSpecificArgument();
facade.addImplementationArgument(arg);
return arg;
|
public org.apache.tools.ant.types.Path | createBootclasspath()Adds path to bootstrap class files.
if (bootclasspath == null) {
bootclasspath = new Path(getProject());
}
return bootclasspath.createPath();
|
public org.apache.tools.ant.taskdefs.optional.Javah$ClassArgument | createClass()Adds class to process.
ClassArgument ga = new ClassArgument();
classes.addElement(ga);
return ga;
|
public org.apache.tools.ant.types.Path | createClasspath()Path to use for classpath.
if (classpath == null) {
classpath = new Path(getProject());
}
return classpath.createPath();
|
public void | execute()Execute the task
// first off, make sure that we've got a srcdir
if ((cls == null) && (classes.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 (destDir != null) {
if (!destDir.isDirectory()) {
throw new BuildException("destination directory \"" + destDir
+ "\" does not exist or is not a directory", getLocation());
}
if (outputFile != null) {
throw new BuildException("destdir and outputFile are mutually "
+ "exclusive", getLocation());
}
}
if (classpath == null) {
classpath = (new Path(getProject())).concatSystemClasspath("last");
} else {
classpath = classpath.concatSystemClasspath("ignore");
}
JavahAdapter ad =
JavahAdapterFactory.getAdapter(facade.getImplementation(),
this);
if (!ad.compile(this)) {
throw new BuildException("compilation failed");
}
|
public org.apache.tools.ant.types.Path | getBootclasspath()The bootclasspath to use.
return bootclasspath;
|
public java.lang.String[] | getClasses()Names of the classes to process.
ArrayList al = new ArrayList();
if (cls != null) {
StringTokenizer tok = new StringTokenizer(cls, ",", false);
while (tok.hasMoreTokens()) {
al.add(tok.nextToken().trim());
}
}
Enumeration e = classes.elements();
while (e.hasMoreElements()) {
ClassArgument arg = (ClassArgument) e.nextElement();
al.add(arg.getName());
}
return (String[]) al.toArray(new String[al.size()]);
|
public org.apache.tools.ant.types.Path | getClasspath()The classpath to use.
return classpath;
|
public java.lang.String[] | getCurrentArgs()Returns the (implementation specific) settings given as nested
arg elements.
return facade.getArgs();
|
public java.io.File | getDestdir()The destination directory, if any.
return destDir;
|
public boolean | getForce()Whether output files should always be written.
return force;
|
public boolean | getOld()Whether old JDK1.0-style header files should be generated.
return old;
|
public java.io.File | getOutputfile()The destination file, if any.
return outputFile;
|
public boolean | getStubs()Whether C declarations from the Java object file should be generated.
return stubs;
|
public boolean | getVerbose()Whether verbose output should get generated.
return verbose;
|
public void | logAndAddFiles(org.apache.tools.ant.types.Commandline cmd)Logs the compilation parameters, adds the files to compile and logs the
"niceSourceList"
logAndAddFilesToCompile(cmd);
|
protected void | logAndAddFilesToCompile(org.apache.tools.ant.types.Commandline cmd)Logs the compilation parameters, adds the files to compile and logs the
"niceSourceList"
log("Compilation " + cmd.describeArguments(),
Project.MSG_VERBOSE);
StringBuffer niceClassList = new StringBuffer();
String[] c = getClasses();
for (int i = 0; i < c.length; i++) {
cmd.createArgument().setValue(c[i]);
niceClassList.append(" ");
niceClassList.append(c[i]);
niceClassList.append(lSep);
}
StringBuffer prefix = new StringBuffer("Class");
if (c.length > 1) {
prefix.append("es");
}
prefix.append(" to be compiled:");
prefix.append(lSep);
log(prefix.toString() + niceClassList.toString(), Project.MSG_VERBOSE);
|
public void | setBootClasspathRef(org.apache.tools.ant.types.Reference r)To the bootstrap path, this adds a reference to a classpath defined elsewhere.
createBootclasspath().setRefid(r);
|
public void | setBootclasspath(org.apache.tools.ant.types.Path src)location of bootstrap class files.
if (bootclasspath == null) {
bootclasspath = src;
} else {
bootclasspath.append(src);
}
|
public void | setClass(java.lang.String cls)the fully-qualified name of the class (or classes, separated by commas).
this.cls = cls;
|
public void | setClasspath(org.apache.tools.ant.types.Path src)the classpath to use.
if (classpath == null) {
classpath = src;
} else {
classpath.append(src);
}
|
public void | setClasspathRef(org.apache.tools.ant.types.Reference r)Adds a reference to a classpath defined elsewhere.
createClasspath().setRefid(r);
|
public void | setDestdir(java.io.File destDir)Set the destination directory into which the Java source
files should be compiled.
this.destDir = destDir;
|
public void | setForce(boolean force)If true, output files should always be written (JDK1.2 only).
this.force = force;
|
public void | setImplementation(java.lang.String impl)Choose the implementation for this particular task.
if ("default".equals(impl)) {
facade.setImplementation(JavahAdapterFactory.getDefault());
} else {
facade.setImplementation(impl);
}
|
public void | setOld(boolean old)If true, specifies that old JDK1.0-style header files should be
generated.
(otherwise output file contain JNI-style native method function
prototypes) (JDK1.2 only).
this.old = old;
|
public void | setOutputFile(java.io.File outputFile)Concatenates the resulting header or source files for all
the classes listed into this file.
this.outputFile = outputFile;
|
public void | setStubs(boolean stubs)If true, generate C declarations from the Java object file (used with old).
this.stubs = stubs;
|
public void | setVerbose(boolean verbose)If true, causes Javah to print a message concerning
the status of the generated files.
this.verbose = verbose;
|