FileDocCategorySizeDatePackage
ForkingSunRmic.javaAPI DocApache Ant 1.703059Wed Dec 13 06:16:24 GMT 2006org.apache.tools.ant.taskdefs.rmic

ForkingSunRmic

public class ForkingSunRmic extends DefaultRmicAdapter
This is an extension of the sun rmic compiler, which forks rather than executes it inline. Why so? Because rmic is dog slow, but if you fork the compiler you can have multiple copies compiling different bits of your project at the same time. Which, on a multi-cpu system results in significant speedups. Also, Java1.6 behaves oddly with -XNew, so we switch it on here if needed.
since
ant1.7

Fields Summary
public static final String
COMPILER_NAME
the name of this adapter for users to select
Constructors Summary
Methods Summary
public booleanexecute()
exec by creating a new command

return
true if the command ran successfully
throws
BuildException on error


                          
         
        Rmic owner = getRmic();
        Commandline cmd = setupRmicCommand();
        Project project = owner.getProject();
        //rely on RMIC being on the path
        cmd.setExecutable(JavaEnvUtils.getJdkExecutable(getExecutableName()));

        //set up the args
        String[] args = cmd.getCommandline();

        try {
            Execute exe = new Execute(new LogStreamHandler(owner,
                    Project.MSG_INFO,
                    Project.MSG_WARN));
            exe.setAntRun(project);
            exe.setWorkingDirectory(project.getBaseDir());
            exe.setCommandline(args);
            exe.execute();
            return !exe.isFailure();
        } catch (IOException exception) {
            throw new BuildException("Error running " + getExecutableName()
                    + " -maybe it is not on the path", exception);
        }
    
protected java.lang.StringgetExecutableName()
Override point.

return
the executable name.

        return SunRmic.RMIC_EXECUTABLE;