You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2002/04/01 16:00:05 UTC
DO NOT REPLY [Bug 7657] New: -
NetRexxC log enhancements/bug fixes
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7657>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7657
NetRexxC log enhancements/bug fixes
Summary: NetRexxC log enhancements/bug fixes
Product: Ant
Version: 1.4.1
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: Other
Component: Optional Tasks
AssignedTo: ant-dev@jakarta.apache.org
ReportedBy: bechtel@ipcon.de
NetRexxC copies the sourcefiles to the build directory and compiles them there.
So, all
messages from the compiler refer to the copied files, not the original
ones.
The patch
corrects that in that it replaces the paths in the compiler messages
with the original source
file paths.
Further, it breaks up the log into single lines, so that eventlisteners get
one
event per compiler message, not one for all (doing so is more conformant with
the other
tasks).
Here's the patch:
--------------------------
--- NetRexxC.org Sat Mar 30 16:15:55 2002
+++
NetRexxC.java Mon Apr 1 13:41:01 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,41 @@
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=l.indexOf(ddir))!=-1) { // path is mentioned in
the message
+ lb.replace(idx,idx+dlen,sdir);
+ }
+ l=lb.toString();
+ if
(l.indexOf("Error:")!=-1) {
+ log(l, Project.MSG_ERR);
+ } else if
(l.indexOf("Warning:")!=-1) {
+ log(l, Project.MSG_WARN);
+ } else {
+ log(l,
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);
}
+
}
/**
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>