ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/rmic DefaultRmicAdapter.java
Date Wed, 31 Oct 2001 11:01:24 GMT
bodewig     01/10/31 03:01:24

  Modified:    src/main/org/apache/tools/ant/types Path.java
               src/main/org/apache/tools/ant/taskdefs/compilers
                        DefaultCompilerAdapter.java
               src/main/org/apache/tools/ant/taskdefs/rmic
                        DefaultRmicAdapter.java
  Log:
  factor out runtime library detection.
  
  Revision  Changes    Path
  1.22      +46 -1     jakarta-ant/src/main/org/apache/tools/ant/types/Path.java
  
  Index: Path.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/Path.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- Path.java	2001/10/28 21:27:19	1.21
  +++ Path.java	2001/10/31 11:01:24	1.22
  @@ -62,7 +62,7 @@
   import java.io.File;
   
   import java.util.Enumeration;
  -
  +import java.util.Locale;
   import java.util.Stack;
   import java.util.Vector;
   
  @@ -516,6 +516,51 @@
   
           return result;
   
  +    }
  +
  +    /**
  +     * Add the Java Runtime classes to this Path instance.
  +     */
  +    public void addJavaRuntime() {
  +        if (System.getProperty("java.vendor").toLowerCase(Locale.US).indexOf("microsoft")
>= 0) {
  +            // Pull in *.zip from packages directory
  +            FileSet msZipFiles = new FileSet();
  +            msZipFiles.setDir(new File(System.getProperty("java.home") + File.separator
+ "Packages"));
  +            msZipFiles.setIncludes("*.ZIP");
  +            addFileset(msZipFiles);
  +        }
  +        else if (Project.getJavaVersion() == Project.JAVA_1_1) {
  +            addExisting(new Path(null,
  +                                 System.getProperty("java.home")
  +                                 + File.separator + "lib"
  +                                 + File.separator
  +                                 + "classes.zip"));
  +        } else {
  +            // JDK > 1.1 seems to set java.home to the JRE directory.
  +            addExisting(new Path(null,
  +                                 System.getProperty("java.home")
  +                                 + File.separator + "lib"
  +                                 + File.separator + "rt.jar"));
  +            // Just keep the old version as well and let addExistingToPath
  +            // sort it out.
  +            addExisting(new Path(null,
  +                                 System.getProperty("java.home")
  +                                 + File.separator +"jre"
  +                                 + File.separator + "lib"
  +                                 + File.separator + "rt.jar"));
  +            
  +            // Added for MacOS X
  +            addExisting(new Path(null,
  +                                 System.getProperty("java.home")
  +                                 + File.separator + ".."
  +                                 + File.separator + "Classes"
  +                                 + File.separator + "classes.jar"));
  +            addExisting(new Path(null,
  +                                 System.getProperty("java.home")
  +                                 + File.separator + ".."
  +                                 + File.separator + "Classes"
  +                                 + File.separator + "ui.jar"));
  +        }
       }
   
   }
  
  
  
  1.11      +2 -42     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  
  Index: DefaultCompilerAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DefaultCompilerAdapter.java	2001/10/28 21:27:51	1.10
  +++ DefaultCompilerAdapter.java	2001/10/31 11:01:24	1.11
  @@ -68,6 +68,7 @@
   import java.io.PrintWriter;
   import java.io.FileWriter;
   import java.io.IOException;
  +import java.util.Locale;
   import java.util.Random;
   
   /**
  @@ -165,48 +166,7 @@
           }
   
           if (includeJavaRuntime) {
  -            // XXX move this stuff to a separate class, code is identical to
  -            //     code in ../rmic/DefaultRmicAdapter
  -
  -            if (System.getProperty("java.vendor").toLowerCase().indexOf("microsoft") >=
0) {
  -                // Pull in *.zip from packages directory
  -                FileSet msZipFiles = new FileSet();
  -                msZipFiles.setDir(new File(System.getProperty("java.home") + File.separator
+ "Packages"));
  -                msZipFiles.setIncludes("*.ZIP");
  -                classpath.addFileset(msZipFiles);
  -            }
  -            else if (Project.getJavaVersion() == Project.JAVA_1_1) {
  -                classpath.addExisting(new Path(null,
  -                                                System.getProperty("java.home")
  -                                                + File.separator + "lib"
  -                                                + File.separator
  -                                                + "classes.zip"));
  -            } else {
  -                // JDK > 1.1 seems to set java.home to the JRE directory.
  -                classpath.addExisting(new Path(null,
  -                                                System.getProperty("java.home")
  -                                                + File.separator + "lib"
  -                                                + File.separator + "rt.jar"));
  -                // Just keep the old version as well and let addExistingToPath
  -                // sort it out.
  -                classpath.addExisting(new Path(null,
  -                                                System.getProperty("java.home")
  -                                                + File.separator +"jre"
  -                                                + File.separator + "lib"
  -                                                + File.separator + "rt.jar"));
  -
  -                // Added for MacOS X
  -                classpath.addExisting(new Path(null,
  -                                               System.getProperty("java.home")
  -                                               + File.separator + ".."
  -                                               + File.separator + "Classes"
  -                                               + File.separator + "classes.jar"));
  -                classpath.addExisting(new Path(null,
  -                                               System.getProperty("java.home")
  -                                               + File.separator + ".."
  -                                               + File.separator + "Classes"
  -                                               + File.separator + "ui.jar"));
  -            }
  +            classpath.addJavaRuntime();
           }
   
           return classpath;
  
  
  
  1.9       +1 -49     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java
  
  Index: DefaultRmicAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultRmicAdapter.java	2001/10/28 21:28:27	1.8
  +++ DefaultRmicAdapter.java	2001/10/31 11:01:24	1.9
  @@ -145,55 +145,7 @@
           }
   
           if (attributes.getIncludejavaruntime()) {
  -            // XXX move this stuff to a separate class, code is identical to
  -            //     code in ../compiler/DefaultCompilerAdapter
  -
  -            if (System.getProperty("java.vendor").toLowerCase().indexOf("microsoft") >=
0) {
  -                // Pull in *.zip from packages directory
  -                FileSet msZipFiles = new FileSet();
  -                msZipFiles.setDir(new File(System.getProperty("java.home") + File.separator
+ "Packages"));
  -                msZipFiles.setIncludes("*.ZIP");
  -                classpath.addFileset(msZipFiles);
  -            } else if (Project.getJavaVersion() == Project.JAVA_1_1) {
  -                classpath.addExisting(new Path(null,
  -                                                System.getProperty("java.home")
  -                                                + File.separator + "lib"
  -                                                + File.separator 
  -                                                + "classes.zip"));
  -            } else if(System.getProperty("java.vm.name").equals("Kaffe")) {
  -                FileSet kaffeJarFiles = new FileSet();
  -                kaffeJarFiles.setDir(new File(System.getProperty("java.home") 
  -                                              + File.separator + "share"
  -                                              + File.separator + "kaffe"));
  -                
  -                kaffeJarFiles.setIncludes("*.jar");
  -                classpath.addFileset(kaffeJarFiles);
  -            } else {
  -                // JDK > 1.1 seems to set java.home to the JRE directory.
  -                classpath.addExisting(new Path(null,
  -                                                System.getProperty("java.home")
  -                                                + File.separator + "lib"
  -                                                + File.separator + "rt.jar"));
  -                // Just keep the old version as well and let addExistingToPath
  -                // sort it out.
  -                classpath.addExisting(new Path(null,
  -                                                System.getProperty("java.home")
  -                                                + File.separator +"jre"
  -                                                + File.separator + "lib"
  -                                                + File.separator + "rt.jar"));
  -
  -                // Added for MacOS X
  -                classpath.addExisting(new Path(null,
  -                                               System.getProperty("java.home")
  -                                               + File.separator + ".."
  -                                               + File.separator + "Classes"
  -                                               + File.separator + "classes.jar"));
  -                classpath.addExisting(new Path(null,
  -                                               System.getProperty("java.home")
  -                                               + File.separator + ".."
  -                                               + File.separator + "Classes"
  -                                               + File.separator + "ui.jar"));
  -            }
  +            classpath.addJavaRuntime();
           }
           return classpath;
       }
  
  
  

--
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