ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc JavaCC.java
Date Sun, 06 Jan 2002 02:07:06 GMT
donaldp     02/01/05 18:07:06

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc
                        JavaCC.java
  Log:
  Move runCommand into this class
  
  Revision  Changes    Path
  1.10      +26 -3     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java
  
  Index: JavaCC.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JavaCC.java	23 Dec 2001 14:22:46 -0000	1.9
  +++ JavaCC.java	6 Jan 2002 02:07:06 -0000	1.10
  @@ -8,12 +8,14 @@
   package org.apache.tools.ant.taskdefs.optional.javacc;
   
   import java.io.File;
  +import java.io.IOException;
   import java.util.Enumeration;
   import java.util.Hashtable;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.Task;
  -import org.apache.tools.ant.taskdefs.exec.Execute;
  +import org.apache.tools.ant.taskdefs.exec.Execute2;
   import org.apache.tools.ant.types.Argument;
  +import org.apache.tools.ant.types.Commandline;
   import org.apache.tools.ant.types.CommandlineJava;
   import org.apache.tools.ant.types.Path;
   
  @@ -224,7 +226,7 @@
           {
               throw new TaskException( "Javacchome not set." );
           }
  -        final Path classpath = cmdl.createClasspath( getProject() );
  +        final Path classpath = cmdl.createClasspath();
           classpath.createPathElement().setPath( javaccHome.getAbsolutePath() +
                                                  "/JavaCC.zip" );
           classpath.addJavaRuntime();
  @@ -233,7 +235,28 @@
           arg.setValue( "-mx140M" );
           arg.setValue( "-Dinstall.root=" + javaccHome.getAbsolutePath() );
   
  -        Execute.runCommand( this, cmdl.getCommandline() );
  +        runCommand( cmdl.getCommandline() );
  +    }
  +
  +    private void runCommand( final String[] cmdline )
  +        throws TaskException
  +    {
  +        try
  +        {
  +            getLogger().debug( Commandline.toString( cmdline ) );
  +            final Execute2 exe = new Execute2();
  +            setupLogger( exe );
  +            exe.setCommandline( cmdline );
  +            int retval = exe.execute();
  +            if( retval != 0 )
  +            {
  +                throw new TaskException( cmdline[ 0 ] + " failed with return code " + retval
);
  +            }
  +        }
  +        catch( final IOException ioe )
  +        {
  +            throw new TaskException( "Could not launch " + cmdline[ 0 ] + ": " + ioe );
  +        }
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message