Jonathan, Very cool. I can't wait to try this task as it's something I've wanted to use in my build scripts for Jive (our open-source forum product).
One thing though -- I noticed in your code that you have a 'replaceString' method and it looks pretty inefficient. We (coolservlets.com) have a fast string replacement method. We wrote it to be as fast as possible since it's called often in one of our filters. Here's the code -- you might want to give it a spin: /** * Replaces all instances of oldString with newString in line. <p> * * CoolServlets.com * (APL license: http://www.coolservlets.com/jive/liscense.jsp) * * @param line the String to search to perform replacements on * @param oldString the String that should be replaced by newString * @param newString the String that will replace all instances of oldString * * @return a String will all instances of oldString replaced by newString */ public static final String replace( String line, String oldString, String newString ) { int i=0; if ( ( i=line.indexOf( oldString, i ) ) >= 0 ) { char [] line2 = line.toCharArray(); char [] newString2 = newString.toCharArray(); int oLength = oldString.length(); StringBuffer buf = new StringBuffer(line2.length); buf.append(line2, 0, i).append(newString2); i += oLength; int j = i; while( ( i=line.indexOf( oldString, i ) ) > 0 ) { buf.append(line2, j, i-j).append(newString2); i += oLength; j = i; } buf.append(line2, j, line2.length - j); return buf.toString(); } return line; } (this code resides in the com.coolservlets.util package in StringUtils.java. All source is available as part of Jive: www.coolservlets.com/jive) --Bill +--------------------------------------------------------+ | Bill Lynch | |--------------------------------------------------------| | [EMAIL PROTECTED] http://www.4charity.com | | [EMAIL PROTECTED] http://www.coolservlets.com | +--------------------------------------------------------+ > -----Original Message----- > From: Jonathan Gray [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 28, 2000 12:27 PM > To: [EMAIL PROTECTED] > Subject: JspC task (including code) > > > I have been working on a <jspc> task, most of which is a > copy-and-paste from > both <javac> and <wljspc> tasks, which supports jasper.jspc and should > eventually support the weblogic.jspc compiler. However, a few issues have > arisen: > > I am trying to emulate the Tomcat JSP compilation process as closely as > possible and as such, when scanning the destination directories for JSPs > which have already been compiled, I am replacing all underscores > with their > Unicode equivalent '0005f' which Tomcat seems to do with all of the .java > and .class files it creates in its web application tomcat/work > directory. I > am not sure whether I should be doing this as I don't know whether it is > standard behaviour across both Jasper and WebLogic jspc compilers. > > Also, the weblogic.jspc compiler also has the ability to then compile the > generated java classes to check whether they compile. jasper.jspc does not > provide this option so it would either mean leaving this second phase of > compilation for a separate Ant task or have the two-phases built-in to the > jspc task. > > Also, what are the chances of having this task, once complete, included in > the standard Ant distribution? > > thanks > > Jon > >
