costin 2002/06/14 14:23:15 Modified: jasper2/src/share/org/apache/jasper JspC.java Log: Add the --compile CLI and 'compile=' ant attribute. If set we'll also compile. I have some doubts about this - it would be ugly to change jspc to support all the options that <javac> normally supports, and it's not a good design to mix to tasks. Revision Changes Path 1.9 +22 -8 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java Index: JspC.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- JspC.java 14 Jun 2002 20:43:05 -0000 1.8 +++ JspC.java 14 Jun 2002 21:23:15 -0000 1.9 @@ -123,6 +123,7 @@ public static final String SWITCH_PACKAGE_NAME = "-p"; public static final String SWITCH_CLASS_NAME = "-c"; public static final String SWITCH_FULL_STOP = "--"; + public static final String SWITCH_COMPILE = "--compile"; public static final String SWITCH_URI_BASE = "-uribase"; public static final String SWITCH_URI_ROOT = "-uriroot"; public static final String SWITCH_FILE_WEBAPP = "-webapp"; @@ -168,6 +169,8 @@ static int die; // I realize it is duplication, but this is for // the static main catch + boolean compile=false; + boolean dirset; Vector extensions; @@ -306,6 +309,10 @@ Constants.jasperLog.setVerbosityLevel(level); } + public void setCompile( boolean b ) { + compile=b; + } + public void setOutputDir( String s ) { if( s!= null ) { scratchDir=new File(new File(s).getAbsolutePath()); @@ -489,12 +496,17 @@ Compiler clc = clctxt.createCompiler(); - // Don't compile if the .class file is newer than the .jsp file - if( clc.isOutDated(false) ) { - clc.generateJava(); + if( compile ) { + // Generate both .class and .java + if( clc.isOutDated() ) { + clc.compile(); + } } else { - // already compiled - // System.out.println("Already compiled " + file ); + // Only generate .java, compilation is separated + // Don't compile if the .class file is newer than the .jsp file + if( clc.isOutDated(false) ) { + clc.generateJava(); + } } // Generate mapping @@ -815,6 +827,8 @@ } } else if (tok.equals(SWITCH_PACKAGE_NAME)) { targetPackage = nextArg(); + } else if (tok.equals(SWITCH_COMPILE)) { + compile=true; } else if (tok.equals(SWITCH_CLASS_NAME)) { targetClassName = nextArg(); } else if (tok.equals(SWITCH_URI_BASE)) {
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>