On Sun, 31 Mar 2002 02:02:14 +1000, [EMAIL PROTECTED] wrote:

>Hey, I'm not an ant committer, just the original author of the NetRexxC 
>task, and a NetRexx user!
>
>But to get things committed, it'd be best to resend the patch in full, 
>against the CVS version of the code.
>

ok. Here it is:

--------------------------------------------------------------------------------------------
--- NetRexxC.java       Sat Mar 30 16:15:55 2002
+++ \NetRexxC.java      Sat Mar 30 16:04:20 2002
@@ -57,6 +57,8 @@
 import java.io.IOException;
 import java.io.StringWriter;
 import java.io.PrintWriter;
+import java.io.StringReader;
+import java.io.BufferedReader;
 
 import java.util.Vector;
 import java.util.Hashtable;
@@ -567,24 +569,40 @@
             StringWriter out = new StringWriter(); 
             int rc = COM.ibm.netrexx.process.NetRexxC.
                 main(new Rexx(compileArgs), new PrintWriter(out));
-
-            if (rc > 1) { // 1 is warnings from real NetRexxC
-                log(out.toString(), Project.MSG_ERR);
-                String msg = "Compile failed, messages should have been 
provided.";
-                throw new BuildException(msg);
+            String sdir=srcDir.getAbsolutePath();
+            String ddir=destDir.getAbsolutePath();
+            int dlen=ddir.length();
+            String l;
+            StringBuffer lb;
+            BufferedReader in=new BufferedReader(new 
StringReader(out.toString()));
+            log("replacing destdir '"+ddir+"' through sourcedir '"+sdir+"'", 
Project.MSG_VERBOSE);
+            while ((l=in.readLine())!=null) {
+               lb=new StringBuffer(l);
+                int idx;
+                while ((idx=lb.indexOf(ddir))!=-1) { // path is mentioned in 
the message
+                    lb.replace(idx,idx+dlen,sdir);
+                }
+                if (lb.indexOf("Error")!=-1) {
+                    log(lb.toString(), Project.MSG_ERR);
+                } else if (lb.indexOf("Warning")!=-1) {
+                    log(lb.toString(), Project.MSG_WARN);
+                } else {
+                    log(lb.toString(), Project.MSG_INFO);
             }
-            else if (rc == 1) {
-                log(out.toString(), Project.MSG_WARN);
             }
-            else {
-                log(out.toString(), Project.MSG_INFO);
+            if (rc>1) {
+                throw new BuildException("Compile failed, messages should have 
been provided.");
             }        
+        } catch (IOException ioe) {
+            ioe.printStackTrace(); // we would like to know WHY this happened. 
Should never!
+            throw new BuildException("Unexpected IOException while playing 
with Strings: "+ioe.toString());
         } finally {
             // need to reset java.class.path property
             // since the NetRexx compiler has no option for the classpath
             currentProperties = System.getProperties();
             currentProperties.put("java.class.path", currentClassPath);
         }
+
     }
 
     /**
-------------------------------------------------------------------------------

I hope someone will commit it now... :-)

tia

Patric




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to