FileDocCategorySizeDatePackage
Kaffeh.javaAPI DocApache Ant 1.703186Wed Dec 13 06:16:22 GMT 2006org.apache.tools.ant.taskdefs.optional.javah

Kaffeh

public class Kaffeh extends Object implements JavahAdapter
Adapter to the native kaffeh compiler.
since
Ant 1.6.3

Fields Summary
public static final String
IMPLEMENTATION_NAME
the name of the javah adapter - kaffeh
Constructors Summary
Methods Summary
public booleancompile(org.apache.tools.ant.taskdefs.optional.Javah javah)
Performs the actual compilation.

param
javah the calling javah task.
return
true if the compilation was successful.
throws
BuildException if there is an error.
since
Ant 1.6.3


                                    
          
        Commandline cmd = setupKaffehCommand(javah);
        try {
            Execute.runCommand(javah, cmd.getCommandline());
            return true;
        } catch (BuildException e) {
            if (e.getMessage().indexOf("failed with return code") == -1) {
                throw e;
            }
        }
        return false;
    
private org.apache.tools.ant.types.CommandlinesetupKaffehCommand(org.apache.tools.ant.taskdefs.optional.Javah javah)

        Commandline cmd = new Commandline();
        cmd.setExecutable(JavaEnvUtils.getJdkExecutable("kaffeh"));

        if (javah.getDestdir() != null) {
            cmd.createArgument().setValue("-d");
            cmd.createArgument().setFile(javah.getDestdir());
        }

        if (javah.getOutputfile() != null) {
            cmd.createArgument().setValue("-o");
            cmd.createArgument().setFile(javah.getOutputfile());
        }

        Path cp = new Path(javah.getProject());
        if (javah.getBootclasspath() != null) {
            cp.append(javah.getBootclasspath());
        }
        cp = cp.concatSystemBootClasspath("ignore");
        if (javah.getClasspath() != null) {
            cp.append(javah.getClasspath());
        }
        if (cp.size() > 0) {
            cmd.createArgument().setValue("-classpath");
            cmd.createArgument().setPath(cp);
        }

        if (!javah.getOld()) {
            cmd.createArgument().setValue("-jni");
        }

        cmd.addArguments(javah.getCurrentArgs());

        javah.logAndAddFiles(cmd);
        return cmd;