ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers JasperC.java DefaultJspCompilerAdapter.java
Date Tue, 07 May 2002 00:28:24 GMT
stevel      02/05/06 17:28:24

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers
                        Tag: ANT_15_BRANCH JasperC.java
                        DefaultJspCompilerAdapter.java
  Log:
  some changes related to bug #8846, but dont fundamentally fix the problem...just make moving
from Java to Exec easier
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.8.2.1   +29 -8     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java
  
  Index: JasperC.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- JasperC.java	15 Apr 2002 13:36:21 -0000	1.8
  +++ JasperC.java	7 May 2002 00:28:23 -0000	1.8.2.1
  @@ -56,12 +56,13 @@
   
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Project;
  -import org.apache.tools.ant.types.Commandline;
  +import org.apache.tools.ant.types.CommandlineJava;
   import org.apache.tools.ant.types.Path;
   import org.apache.tools.ant.taskdefs.optional.jsp.JspC;
   import org.apache.tools.ant.taskdefs.optional.jsp.JspMangler;
   import org.apache.tools.ant.taskdefs.optional.jsp.JspNameMangler;
   import org.apache.tools.ant.taskdefs.Java;
  +import org.apache.tools.ant.taskdefs.ExecuteJava;
   
   import java.io.File;
   
  @@ -80,20 +81,41 @@
       public boolean execute()
           throws BuildException {
           getJspc().log("Using jasper compiler", Project.MSG_VERBOSE);
  -        Commandline cmd = setupJasperCommand();
  +        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) (getJspc().getProject()).createTask("java");
  +            Java java = (Java) (getProject().createTask("java"));
               if (getJspc().getClasspath() != null) {
                   java.setClasspath(getJspc().getClasspath());
               } else {
  -                java.setClasspath(Path.systemClasspath);
  +                Path classpath=new Path(getProject());
  +                classpath.concatSystemClasspath();
  +                java.setClasspath(classpath);
               }
  +            java.setDir(getProject().getBaseDir());
               java.setClassname("org.apache.jasper.JspC");
  -            String args[] = cmd.getArguments();
  +            //this is really irritating; we need a way to set stuff
  +            String args[] = cmd.getJavaCommand().getArguments();
               for (int i = 0; i < args.length; i++) {
                   java.createArg().setValue(args[i]);
               }
  @@ -104,7 +126,6 @@
               java.execute();
               return true;
           } catch (Exception ex) {
  -            //@todo implement failonerror support here?
               if (ex instanceof BuildException) {
                   throw (BuildException) ex;
               } else {
  @@ -122,8 +143,8 @@
        * build up a command line
        * @return a command line for jasper
        */
  -    private Commandline setupJasperCommand() {
  -        Commandline cmd = new Commandline();
  +    private CommandlineJava setupJasperCommand() {
  +        CommandlineJava cmd = new CommandlineJava();
           JspC jspc = getJspc();
           addArg(cmd, "-d", jspc.getDestdir());
           addArg(cmd, "-p", jspc.getPackage());
  
  
  
  1.4.2.1   +14 -6     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultJspCompilerAdapter.java
  
  Index: DefaultJspCompilerAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultJspCompilerAdapter.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- DefaultJspCompilerAdapter.java	25 Apr 2002 12:14:50 -0000	1.4
  +++ DefaultJspCompilerAdapter.java	7 May 2002 00:28:23 -0000	1.4.2.1
  @@ -57,7 +57,7 @@
   import org.apache.tools.ant.Project;
   
   import org.apache.tools.ant.taskdefs.optional.jsp.JspC;
  -import org.apache.tools.ant.types.Commandline;
  +import org.apache.tools.ant.types.CommandlineJava;
   
   import java.util.Vector;
   import java.util.Enumeration;
  @@ -83,8 +83,8 @@
        */
       protected void logAndAddFilesToCompile(JspC jspc,
                                              Vector compileList,
  -                                           Commandline cmd) {
  -        jspc.log("Compilation " + cmd.describeArguments(), 
  +                                           CommandlineJava cmd) {
  +        jspc.log("Compilation " + cmd.describeJavaCommand(),
                    Project.MSG_VERBOSE);
   
           StringBuffer niceSourceList = new StringBuffer("File");
  @@ -130,7 +130,7 @@
        *
        * @param  argument  The argument
        */
  -    protected void addArg(Commandline cmd, String argument) {
  +    protected void addArg(CommandlineJava cmd, String argument) {
           if (argument != null && argument.length() != 0) {
              cmd.createArgument().setValue(argument);
           }
  @@ -143,7 +143,7 @@
        * @param  argument  The argument
        * @param  value     the parameter
        */
  -    protected void addArg(Commandline cmd, String argument, String value) {
  +    protected void addArg(CommandlineJava cmd, String argument, String value) {
           if (value != null) {
               cmd.createArgument().setValue(argument);
               cmd.createArgument().setValue(value);
  @@ -156,7 +156,7 @@
        * @param  argument  The argument
        * @param  file     the parameter
        */
  -    protected void addArg(Commandline cmd, String argument, File file) {
  +    protected void addArg(CommandlineJava cmd, String argument, File file) {
           if (file != null) {
               cmd.createArgument().setValue(argument);
               cmd.createArgument().setFile(file);
  @@ -170,6 +170,14 @@
        */
       public boolean implementsOwnDependencyChecking() {
           return false;
  +    }
  +
  +    /**
  +     * get our project
  +     * @return owner project data
  +     */
  +    public Project getProject() {
  +        return getJspc().getProject();
       }
   }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message