cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/language/programming/java EclipseJavaCompiler.java JavaLanguage.java
Date Thu, 20 Mar 2003 04:12:49 GMT
vgritsenko    2003/03/19 20:12:49

  Modified:    src/java/org/apache/cocoon/components/language/programming/java
                        EclipseJavaCompiler.java JavaLanguage.java
  Log:
  Fix source dir parameter: point to source directory not to the directory where java file
resides.
  Set eclipse source14 parameter to target14.
  
  Revision  Changes    Path
  1.3       +15 -12    cocoon-2.1/src/java/org/apache/cocoon/components/language/programming/java/EclipseJavaCompiler.java
  
  Index: EclipseJavaCompiler.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/language/programming/java/EclipseJavaCompiler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EclipseJavaCompiler.java	11 Mar 2003 17:09:04 -0000	1.2
  +++ EclipseJavaCompiler.java	20 Mar 2003 04:12:49 -0000	1.3
  @@ -94,19 +94,19 @@
   public class EclipseJavaCompiler implements LanguageCompiler, Recyclable {
   
       static boolean target14;
  +    static boolean source14;
   
       static {
           // Detect JDK version we are running under
           String version = System.getProperty("java.specification.version");
           try {
  -            target14 = Float.parseFloat(version) >= 1.4;
  +            source14 = target14 = Float.parseFloat(version) >= 1.4;
           } catch (NumberFormatException e) {
  -            target14 = false;
  +            source14 = target14 = false;
           }
       }
   
       boolean debug;
  -    boolean source14;
   
       String sourceDir;
       String sourceFile; 
  @@ -130,27 +130,30 @@
       }
   
       public void setFile(String file) {
  -        // This seems to be the absolute path to the file to be compiled
  +        // This is the absolute path to the file to be compiled
           this.sourceFile = file;
       }
   
  -    public void setSource(String source) {
  -        // This seems to simply be the directory the file to
  -        // be compiled resides in
  -        // FIXME: this.sourceDir = destDir; does not work here
  +    public void setSource(String srcDir) {
  +        // This is the "sourcepath" of the file to be
  +        // compiled
  +        this.sourceDir = srcDir;
       }
   
       public void setDestination(String destDir) {
  -        // This seems to indicate the "sourcepath" of the file to be
  -        // compiled (as well as the output directory)
  +        // This is the output directory)
           this.destDir = destDir;
  -        this.sourceDir = destDir;
       }
   
       public void setEncoding(String encoding) {
           this.sourceEncoding = encoding; 
       }
   
  +    /**
  +     * Eclipse Java compiler ignores class path setting and uses current
  +     * Java class loader
  +     * @param cp classpath to be ignored
  +     */
       public void setClasspath(String cp) {
           // Not used 
       }
  
  
  
  1.2       +12 -13    cocoon-2.1/src/java/org/apache/cocoon/components/language/programming/java/JavaLanguage.java
  
  Index: JavaLanguage.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/language/programming/java/JavaLanguage.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JavaLanguage.java	9 Mar 2003 00:09:00 -0000	1.1
  +++ JavaLanguage.java	20 Mar 2003 04:12:49 -0000	1.2
  @@ -209,22 +209,21 @@
   
               int pos = name.lastIndexOf(File.separatorChar);
               String filename = name.substring(pos + 1);
  -            String pathname =
  -                    baseDirectory.getCanonicalPath() + File.separator +
  -                    name.substring(0, pos).replace(File.separatorChar, '/');
  -            String filename_abs = pathname + File.separator + filename
  -                    + "." + this.getSourceExtension();
  -
  -            compiler.setFile(filename_abs);
  -            compiler.setSource(pathname);
  -            compiler.setDestination(baseDirectory.getCanonicalPath());
  -            compiler.setClasspath(baseDirectory.getCanonicalPath() + this.classpath);
  +
  +            final String basePath = baseDirectory.getCanonicalPath();
  +            String filepath = basePath + File.separator
  +                    + name + "." + getSourceExtension();
  +
  +            compiler.setFile(filepath);
  +            compiler.setSource(basePath);
  +            compiler.setDestination(basePath);
  +            compiler.setClasspath(basePath + this.classpath);
   
               if (encoding != null) {
                   compiler.setEncoding(encoding);
               }
   
  -            getLogger().debug("Compiling " + filename_abs);
  +            getLogger().debug("Compiling " + filepath);
               if (!compiler.compile()) {
                   StringBuffer message = new StringBuffer("Error compiling ");
                   message.append(filename);
  @@ -234,7 +233,7 @@
                   CompilerError[] compilerErrors = new CompilerError[errors.size()];
                   errors.toArray(compilerErrors);
   
  -                throw new LanguageException(message.toString(), filename_abs, compilerErrors);
  +                throw new LanguageException(message.toString(), filepath, compilerErrors);
               }
   
           } catch (InstantiationException e) {
  
  
  

Mime
View raw message