You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@locus.apache.org on 2000/08/04 16:59:05 UTC

cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Javac.java Jikes.java JikesOutputParser.java

bodewig     00/08/04 07:58:55

  Modified:    .        build.xml
               src/main/org/apache/tools/ant/taskdefs Javac.java Jikes.java
                        JikesOutputParser.java
  Log:
  Make Jikes use the new Execute class instead of calling Runtime.exec itself.
  
  Revision  Changes    Path
  1.57      +1 -1      jakarta-ant/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/build.xml,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- build.xml	2000/08/04 06:53:12	1.56
  +++ build.xml	2000/08/04 14:58:40	1.57
  @@ -32,7 +32,7 @@
     <property name="manifest" value="src/etc/manifest"/>
   
     <property name="build.compiler" value="classic"/>
  -  <property name="build.compiler.emacs" value="on"/>
  +<!--  <property name="build.compiler.emacs" value="on"/> -->
   
     <!-- =================================================================== -->
     <!-- Check to see what optional dependencies are available               -->
  
  
  
  1.30      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javac.java
  
  Index: Javac.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javac.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- Javac.java	2000/08/02 15:25:33	1.29
  +++ Javac.java	2000/08/04 14:58:41	1.30
  @@ -748,7 +748,7 @@
   
           JikesOutputParser jop = new JikesOutputParser(this, emacsMode);
   
  -        Jikes compiler = new Jikes(jop,"jikes");
  +        Jikes compiler = new Jikes(jop, "jikes", project);
           compiler.compile(args);
           if (jop.getErrorFlag()) {
               String msg = "Compile failed, messages should have been provided.";
  
  
  
  1.5       +9 -5      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Jikes.java
  
  Index: Jikes.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Jikes.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Jikes.java	2000/07/21 10:19:23	1.4
  +++ Jikes.java	2000/08/04 14:58:42	1.5
  @@ -13,16 +13,18 @@
   public class Jikes {
       protected JikesOutputParser jop;
       protected String command;
  -    
  +    protected Project project;
  +
       /**
        * Constructs a new Jikes obect.
        * @param jop - Parser to send jike's output to
        * @param command - name of jikes executeable
        */
  -    protected Jikes(JikesOutputParser jop,String command) {
  +    protected Jikes(JikesOutputParser jop,String command, Project project) {
           super();
           this.jop = jop;
           this.command = command;
  +        this.project = project;
       }
   
       /**
  @@ -71,9 +73,11 @@
               // -Xstdout that is given to Jikes in Javac.doJikesCompile()
               // should guarantee this. At least I hope so. :)
               try {
  -                Process jikes = Runtime.getRuntime().exec(commandArray);
  -                BufferedReader reader = new BufferedReader(new InputStreamReader(jikes.getInputStream()));
  -                jop.parseOutput(reader);
  +                Execute exe = new Execute(jop);
  +                exe.setAntRun(project);
  +                exe.setWorkingDirectory(project.getBaseDir());
  +                exe.setCommandline(commandArray);
  +                exe.execute();
               } catch (IOException e) {
                   throw new BuildException("Error running Jikes compiler", e);
               }
  
  
  
  1.3       +32 -1     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java
  
  Index: JikesOutputParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JikesOutputParser.java	2000/07/06 16:48:17	1.2
  +++ JikesOutputParser.java	2000/08/04 14:58:43	1.3
  @@ -13,13 +13,44 @@
    * Parsing could be much better
    * @author skanthak@muehlheim.de
    */
  -public class JikesOutputParser {
  +public class JikesOutputParser implements ExecuteStreamHandler {
       protected Task task;
       protected boolean errorFlag = false; // no errors so far
       protected int errors,warnings;
       protected boolean error = false;
       protected boolean emacsMode;
       
  +    protected BufferedReader br;
  +
  +    /**
  +     * Ignore.
  +     */
  +    public void setProcessInputStream(OutputStream os) {}
  +
  +    /**
  +     * Ignore.
  +     */
  +    public void setProcessErrorStream(InputStream is) {}
  +
  +    /**
  +     * Set the inputstream
  +     */
  +    public void setProcessOutputStream(InputStream is) throws IOException {
  +        br = new BufferedReader(new InputStreamReader(is));
  +    }
  +
  +    /**
  +     * Invokes parseOutput.
  +     */
  +    public void start() throws IOException {
  +        parseOutput(br);
  +    }
  +
  +    /**
  +     * Ignore.
  +     */
  +    public void stop() {}
  +
       /**
        * Construct a new Parser object
        * @param task - task in whichs context we are called