FileDocCategorySizeDatePackage
Kjc.javaAPI DocApache Ant 1.703522Wed Dec 13 06:16:20 GMT 2006org.apache.tools.ant.taskdefs.compilers

Kjc

public class Kjc extends DefaultCompilerAdapter
The implementation of the Java compiler for KJC. This is primarily a cut-and-paste from Jikes.java and DefaultCompilerAdapter.
since
Ant 1.4

Fields Summary
Constructors Summary
Methods Summary
public booleanexecute()
Run the compilation.

return
true if the compilation succeeded
exception
BuildException if the compilation has problems.

        attributes.log("Using kjc compiler", Project.MSG_VERBOSE);
        Commandline cmd = setupKjcCommand();
        cmd.setExecutable("at.dms.kjc.Main");
        ExecuteJava ej = new ExecuteJava();
        ej.setJavaCommand(cmd);
        return ej.fork(getJavac()) == 0;
    
protected org.apache.tools.ant.types.CommandlinesetupKjcCommand()
setup kjc command arguments.

return
the command line

        Commandline cmd = new Commandline();

        // generate classpath, because kjc doesn't support sourcepath.
        Path classpath = getCompileClasspath();

        if (deprecation) {
            cmd.createArgument().setValue("-deprecation");
        }

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

        // generate the clsspath
        cmd.createArgument().setValue("-classpath");

        Path cp = new Path(project);

        // kjc don't have bootclasspath option.
        Path p = getBootClassPath();
        if (p.size() > 0) {
            cp.append(p);
        }

        if (extdirs != null) {
            cp.addExtdirs(extdirs);
        }

        cp.append(classpath);
        if (compileSourcepath != null) {
            cp.append(compileSourcepath);
        } else {
            cp.append(src);
        }

        cmd.createArgument().setPath(cp);

        // kjc-1.5A doesn't support -encoding option now.
        // but it will be supported near the feature.
        if (encoding != null) {
            cmd.createArgument().setValue("-encoding");
            cmd.createArgument().setValue(encoding);
        }

        if (debug) {
            cmd.createArgument().setValue("-g");
        }

        if (optimize) {
            cmd.createArgument().setValue("-O2");
        }

        if (verbose) {
            cmd.createArgument().setValue("-verbose");
        }

        addCurrentCompilerArgs(cmd);

        logAndAddFilesToCompile(cmd);
        return cmd;