Hello all,
I've made some small improvements to the NetRexxC taskdef, maybe there's one
so nice and commits them to CVS?
Improvements so far:
- all log messages split into separate log() calls
- destdir and srcdir are replaced in the messages.
The second point needs a bit explanation:
NetRexxC copies the files from the source to the destination and compiles
them there. First, that's a nice "compile only if newer" thing for the
rather slow compiler. Second, there's no possibility for the compiler
to build to a given directory, there's only the possibility to copy to
the current directory or nearby the source. Sigh.
The error messages, though, state the copied files instead the original
ones from the source directory.
My change replaces all occurences of the build dir through the source dir
and makes my IDE happy with the messages. I think that's useful for ALL
NetRexx developers out there, therefore I didn't built a switch to turn
it off. If someone complains about it, I'll do it.
Here's the patch (inlined, diff -ruawN):
--- NetRexxC.java Thu Oct 11 22:58:30 2001
+++ \NetRexxC.java Fri Mar 29 20:42:22 2002
@@ -556,18 +556,29 @@
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);
- }
- else if (rc == 1) {
- log(out.toString(), Project.MSG_WARN);
- }
- else {
- log(out.toString(), Project.MSG_INFO);
- }
+ String sdir=srcDir.getAbsolutePath();
+ String ddir=destDir.getAbsolutePath();
+ int dlen=ddir.length();
+ String l;
+ BufferedReader in=new BufferedReader(new
StringReader(out.toString()));
+ log("looking for basedir '"+ddir+"'", Project.MSG_VERBOSE);
+ while ((l=in.readLine())!=null){
+ String left,right;
+ int idx;
+ if ((idx=l.indexOf(ddir))!=-1) { // path is mentioned in the
message
+ left=l.substring(0,idx);
+ if (idx+dlen<l.length())
+ right=l.substring(idx+dlen);
+ else
+ right="";
+ l=left+sdir+right;
+ }
+ log(l, Project.MSG_ERR);
+ }
+ if (rc>1)
+ throw new BuildException("Compile failed, messages should have
been provided.");
+ } catch (IOException ioe) { // we do not expect this, really?
+ // PB
} finally {
// need to reset java.class.path property
// since the NetRexx compiler has no option for the classpath
sincerely,
Patric Bechtel
IPCON Informationssysteme
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>