/*
 * Copyright (C) The Apache Software Foundation. All rights reserved.
 *
 * This software is published under the terms of the Apache Software License
 * version 1.1, a copy of which has been included with this distribution in
 * the LICENSE.txt file.
 */
package org.apache.tools.todo.taskdefs.javac;

import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.TaskContext;
import org.apache.tools.todo.types.Commandline;
import org.apache.tools.todo.taskdefs.javac.DefaultCompilerAdapter;

/**
 * The implementation of the sj compiler. Uses the defaults for
 * DefaultCompilerAdapter
 *
 * @author <a href="mailto:don@bea.com">Don Ferguson</a>
 */
public class Sj extends DefaultCompilerAdapter
{

    /**
     * Performs a compile using the sj compiler from Symantec.
     *
     * @return Description of the Returned Value
     * @exception org.apache.myrmidon.api.TaskException Description of Exception
     * @author don@bea.com
     */
    public boolean execute()
        throws TaskException
    {
        getTaskContext().debug( "Using symantec java compiler" );

        Commandline cmd = setupJavacCommand();
        cmd.setExecutable( "sj" );

        int firstFileName = cmd.size() - m_compileList.length;

        return executeExternalCompile( cmd.getCommandline(), firstFileName ) == 0;
    }

}

