ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers JasperC.java JspCompilerAdapterFactory.java
Date Fri, 21 Feb 2003 06:35:54 GMT
stevel      2003/02/20 22:35:54

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/jsp Tag:
                        ANT_15_BRANCH JspC.java JspNameMangler.java
               src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers
                        Tag: ANT_15_BRANCH JasperC.java
                        JspCompilerAdapterFactory.java
  Added:       src/main/org/apache/tools/ant/taskdefs/optional/jsp Tag:
                        ANT_15_BRANCH Jasper41Mangler.java
  Log:
  jspc sync w/ 1.6 version. Not 100% aligned as ant1.5 creates classloaders different-like.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.16.2.7  +16 -19    ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java
  
  Index: JspC.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java,v
  retrieving revision 1.16.2.6
  retrieving revision 1.16.2.7
  diff -u -r1.16.2.6 -r1.16.2.7
  --- JspC.java	18 Feb 2003 14:30:26 -0000	1.16.2.6
  +++ JspC.java	21 Feb 2003 06:35:54 -0000	1.16.2.7
  @@ -106,7 +106,6 @@
    * @since 1.5
    */
   public class JspC extends MatchingTask {
  -    /* ------------------------------------------------------------ */
       private Path classpath;
       private Path compilerClasspath;
       private Path src;
  @@ -155,11 +154,11 @@
   
       private static final String FAIL_MSG
           = "Compile failed, messages should have been provided.";
  -    /* ------------------------------------------------------------ */
  +
       /**
  -     * Path for source JSP files.
  +     * Set the path for source JSP files.
        */
  -    public void setSrcdir(Path srcDir) {
  +    public void setSrcDir(Path srcDir) {
           if (src == null) {
               src = srcDir;
           } else {
  @@ -169,7 +168,7 @@
       public Path getSrcDir(){
           return src;
       }
  -    /* ------------------------------------------------------------ */
  +
       /**
        * Set the destination directory into which the JSP source
        * files should be compiled.
  @@ -180,7 +179,6 @@
       public File getDestdir(){
           return destDir;
       }
  -    /* ------------------------------------------------------------ */
   
       /**
        * Set the name of the package the compiled jsp files should be in.
  @@ -193,7 +191,6 @@
           return packageName;
       }
   
  -    /* ------------------------------------------------------------ */
       /**
        * Set the verbose level of the compiler
        */
  @@ -204,7 +201,6 @@
           return verbose;
       }
   
  -    /* ------------------------------------------------------------ */
       /**
        * Whether or not the build should halt if compilation fails.
        * Defaults to <code>true</code>.
  @@ -218,15 +214,15 @@
       public boolean getFailonerror() {
           return failOnError;
       }
  -    /* ------------------------------------------------------------ */
  +
       public String getIeplugin() {
           return iepluginid;
       }
       /**
        * Java Plugin CLASSID for Internet Explorer
        */
  -    public void setIeplugin(String iepluginid_) {
  -        iepluginid = iepluginid_;
  +    public void setIeplugin(String iepluginid) {
  +        this.iepluginid = iepluginid;
       }
   
       /**
  @@ -237,12 +233,13 @@
       public boolean isMapped() {
           return mapped;
       }
  +
       /**
        * If true, generate separate write() calls for each HTML line
        * in the JSP.
        */
  -    public void setMapped(boolean mapped_) {
  -        mapped = mapped_;
  +    public void setMapped(boolean mapped) {
  +        this.mapped = mapped;
       }
   
       /**
  @@ -422,23 +419,23 @@
           //bind to a compiler
           JspCompilerAdapter compiler =
               JspCompilerAdapterFactory.getCompiler(compilerName, this,
  -               new AntClassLoader(getProject(), compilerClasspath));
  +                new AntClassLoader(getProject(), compilerClasspath));
   
           //if we are a webapp, hand off to the compiler, which had better handle it
           if(webApp!=null) {
               doCompilation(compiler);
               return;
           }
  -            
  -        // make sure that we've got a srcdir 
  +
  +        // make sure that we've got a srcdir
           if (src == null) {
               throw new BuildException("srcdir attribute must be set!",
  -                                     location);
  +                                     getLocation());
           } 
           String [] list = src.list();
           if (list.length == 0) {
               throw new BuildException("srcdir attribute must be set!",
  -                                     location);
  +                    getLocation());
           }
   
   
  @@ -456,7 +453,7 @@
           resetFileLists();
           int filecount = 0;
           for (int i = 0; i < list.length; i++) {
  -            File srcDir = (File) getProject().resolveFile(list[i]);
  +            File srcDir = getProject().resolveFile(list[i]);
               if (!srcDir.exists()) {
                   throw new BuildException("srcdir \"" + srcDir.getPath() +
                                            "\" does not exist!", getLocation());
  
  
  
  1.7.2.2   +4 -4      ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspNameMangler.java
  
  Index: JspNameMangler.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspNameMangler.java,v
  retrieving revision 1.7.2.1
  retrieving revision 1.7.2.2
  diff -u -r1.7.2.1 -r1.7.2.2
  --- JspNameMangler.java	10 Feb 2003 14:25:12 -0000	1.7.2.1
  +++ JspNameMangler.java	21 Feb 2003 06:35:54 -0000	1.7.2.2
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -55,7 +55,7 @@
   import java.io.File;
   
   /**
  - * This is a class derived from the Jasper code 
  + * This is a class derived from the Jasper code
    * (org.apache.jasper.compiler.CommandLineCompiler) to map from a JSP filename
    * to a valid Java classname.
    *
  @@ -159,7 +159,7 @@
        * definition of the char escaping algorithm
        *
        * @param ch char to mangle
  -     * @return mangled string; 5 digit hex value 
  +     * @return mangled string; 5 digit hex value
        */
       private static final String mangleChar(char ch) {
   
  @@ -183,7 +183,7 @@
       /**
        * taking in the substring representing the path relative to the source dir
        * return a new string representing the destination path
  -     * @todo
  +     * not supported, as jasper in tomcat4.0 doesnt either
        */
       public String mapPath(String path) {
           return null;
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +0 -0      ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/Jasper41Mangler.java
  
  Index: Jasper41Mangler.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/Jasper41Mangler.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.8.2.5   +14 -18    ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java
  
  Index: JasperC.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java,v
  retrieving revision 1.8.2.4
  retrieving revision 1.8.2.5
  diff -u -r1.8.2.4 -r1.8.2.5
  --- JasperC.java	10 Feb 2003 14:25:12 -0000	1.8.2.4
  +++ JasperC.java	21 Feb 2003 06:35:54 -0000	1.8.2.5
  @@ -73,6 +73,17 @@
    * @since ant1.5
    */
   public class JasperC extends DefaultJspCompilerAdapter {
  +
  +
  +    /**
  +     * what produces java classes from .jsp files
  +     */
  +    JspMangler mangler;
  +
  +    public JasperC(JspMangler mangler) {
  +        this.mangler = mangler;
  +    }
  +
       /**
        * our execute method
        */
  @@ -80,28 +91,11 @@
           throws BuildException {
           getJspc().log("Using jasper compiler", Project.MSG_VERBOSE);
           CommandlineJava cmd = setupJasperCommand();
  -        /*
  -        Path classpath=cmd.createClasspath(getProject());
  -        if (getJspc().getClasspath() != null) {
  -            classpath=getJspc().getClasspath();
  -        } else {
  -            classpath.concatSystemClasspath();
  -        }
  -        ExecuteJava exec=new ExecuteJava();
  -        exec.execute(getProject());
  -        if ((err = executeJava()) != 0) {
  -            if (failOnError) {
  -                throw new BuildException("Java returned: " + err, location);
  -            } else {
  -                log("Java Result: " + err, Project.MSG_ERR);
  -            }
  -        */
   
   
           try {
               // Create an instance of the compiler, redirecting output to
               // the project log
  -            // REVISIT. ugly. 
               Java java = (Java) (getProject().createTask("java"));
               if (getJspc().getClasspath() != null) {
                   getProject().log("using user supplied classpath: "+getJspc().getClasspath(),
  @@ -155,6 +149,8 @@
           addArg(cmd, "-uriroot", jspc.getUriroot());
           addArg(cmd, "-uribase", jspc.getUribase());
           addArg(cmd, "-ieplugin", jspc.getIeplugin());
  +        addArg(cmd, "-webinc", jspc.getWebinc());
  +        addArg(cmd, "-webxml", jspc.getWebxml());        
           addArg(cmd, "-die9");
   
           if (jspc.isMapped()){
  @@ -173,6 +169,6 @@
        */
   
       public JspMangler createMangler() {
  -        return new JspNameMangler();
  +        return mangler;
       }
   }
  
  
  
  1.2.2.3   +14 -8     ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JspCompilerAdapterFactory.java
  
  Index: JspCompilerAdapterFactory.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JspCompilerAdapterFactory.java,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- JspCompilerAdapterFactory.java	10 Feb 2003 14:25:12 -0000	1.2.2.2
  +++ JspCompilerAdapterFactory.java	21 Feb 2003 06:35:54 -0000	1.2.2.3
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -56,6 +56,8 @@
   import org.apache.tools.ant.AntClassLoader;
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Task;
  +import org.apache.tools.ant.taskdefs.optional.jsp.JspNameMangler;
  +import org.apache.tools.ant.taskdefs.optional.jsp.Jasper41Mangler;
   
   
   /**
  @@ -63,6 +65,7 @@
    *
    * @author <a href="mailto:jayglanville@home.com">J D Glanville</a>
    * @author Matthew Watson <a href="mailto:mattw@i3sp.com">mattw@i3sp.com</a>
  + * @author Steve Loughran
    */
   public class JspCompilerAdapterFactory {
   
  @@ -88,8 +91,8 @@
        */
       public static JspCompilerAdapter getCompiler(String compilerType, Task task)
           throws BuildException {
  -        return getCompiler(compilerType, task, 
  -                           new AntClassLoader(task.getProject(), null));
  +        return getCompiler(compilerType, task,
  +                            new AntClassLoader(task.getProject(), null));
       }
   
       /**
  @@ -105,18 +108,21 @@
        * @param compilerType either the name of the desired compiler, or the
        * full classname of the compiler's adapter.
        * @param task a task to log through.
  -     * @param loader AntClassLoader with which the compiler should be loaded 
  +     * @param loader AntClassLoader with which the compiler should be loaded
        * @throws BuildException if the compiler type could not be resolved into
        * a compiler adapter.
        */
       public static JspCompilerAdapter getCompiler(String compilerType, Task task,
                                                    AntClassLoader loader)
           throws BuildException {
  -        /* If I've done things right, this should be the extent of the
  -         * conditional statements required.
  -         */
  +
           if (compilerType.equalsIgnoreCase("jasper")) {
  -            return new JasperC();
  +            //tomcat4.0 gets the old mangler
  +            return new JasperC(new JspNameMangler());
  +        }
  +        if (compilerType.equalsIgnoreCase("jasper41")) {
  +            //tomcat4.1 gets the new one
  +            return new JasperC(new Jasper41Mangler());
           }
           return resolveClassName(compilerType, loader);
       }
  
  
  

Mime
View raw message