tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jhun...@hyperreal.org
Subject cvs commit: jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs Javac.java Rmic.java
Date Fri, 22 Oct 1999 19:54:48 GMT
jhunter     99/10/22 12:54:47

  Modified:    .        ant.jar
               ant/src/main/org/apache/tools/ant Project.java
               ant/src/main/org/apache/tools/ant/taskdefs Javac.java
                        Rmic.java
  Log:
  Made ant smarter about Java version detection.  Now instead of looking at the
  inconsistently implemented java.version system property, ant determines the
  version based on the existence or non-existence of certain core classes.  To
  use the new logic, tasks call Project.getJavaVersion().
  
  Pls let me know if anyone still gets any "-sourcepath" kind of errors on
  their JVM.
  
  Revision  Changes    Path
  1.9       +47 -50    jakarta-tools/ant.jar
  
  	<<Binary file>>
  
  
  1.5       +28 -0     jakarta-tools/ant/src/main/org/apache/tools/ant/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tools/ant/src/main/org/apache/tools/ant/Project.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Project.java	1999/10/15 02:24:07	1.4
  +++ Project.java	1999/10/22 19:54:45	1.5
  @@ -22,6 +22,8 @@
       public static final int MSG_INFO = 2;
       public static final int MSG_VERBOSE = 3;
   
  +    private static String javaVersion;
  +
       private String name;
       private PrintStream out = System.out;
       private int msgOutputLevel = MSG_INFO;
  @@ -118,6 +120,32 @@
   	return baseDir;
       }
       
  +
  +    public static String getJavaVersion() {
  +        if (javaVersion != null) {
  +            return javaVersion;
  +        }
  +
  +        // Determine the Java version by looking at available classes
  +        // java.lang.StrictMath was introduced in JDK 1.3
  +        // java.lang.ThreadLocal was introduced in JDK 1.2
  +        // java.lang.Void was introduced in JDK 1.1
  +        // Count up version until a NoClassDefFoundError ends the try
  +        try {
  +            javaVersion = "1.0";
  +            Class.forName("java.lang.Void");
  +            javaVersion = "1.1";
  +            Class.forName("java.lang.ThreadLocal");  
  +            javaVersion = "1.2";
  +            Class.forName("java.lang.StrictMath");
  +            javaVersion = "1.3";
  +        }
  +        catch (Throwable t) {
  +        }
  +
  +        return javaVersion;
  +    }
  +
       public void addTaskDefinition(String taskName, Class taskClass) {
   	String msg = " +User task: " + taskName + "     " +
   	    taskClass.getName();
  
  
  
  1.7       +2 -6      jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs/Javac.java
  
  Index: Javac.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs/Javac.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Javac.java	1999/10/18 03:03:40	1.6
  +++ Javac.java	1999/10/22 19:54:46	1.7
  @@ -75,8 +75,7 @@
   
   	String compiler = project.getProperty("build.compiler");
   	if (compiler == null) {
  -	    String javaVersion = System.getProperty("java.version");
  -	    if (javaVersion.startsWith("1.3")) {
  +	    if (Project.getJavaVersion().startsWith("1.3")) {
   		compiler = "modern";
   	    } else {
   		compiler = "classic";
  @@ -192,10 +191,7 @@
   	argList.addElement(destDir.getAbsolutePath());
   	argList.addElement("-classpath");
   	// Just add "sourcepath" to classpath ( for JDK1.1 )
  -        // Note: SGI JDK 1.1.x has java.version of "3.1 (Sun 1.1.x)"
  -	String javaVersion = System.getProperty("java.version");
  -	if (javaVersion.startsWith("1.1") ||
  -               javaVersion.indexOf("Sun 1.1") != -1) {
  +	if (Project.getJavaVersion().startsWith("1.1")) {
   	    argList.addElement(classpath + File.pathSeparator +
                                  srcDir.getAbsolutePath());
   	} else {
  
  
  
  1.2       +1 -2      jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs/Rmic.java
  
  Index: Rmic.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs/Rmic.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Rmic.java	1999/10/09 00:06:07	1.1
  +++ Rmic.java	1999/10/22 19:54:46	1.2
  @@ -33,8 +33,7 @@
           
           // in jdk 1.2, the system classes are not on the visible classpath.
           
  -        String javaversion = System.getProperty("java.version");        
  -        if (javaversion.startsWith("1.2")) {
  +        if (Project.getJavaVersion().startsWith("1.2")) {
               String bootcp = System.getProperty("sun.boot.class.path");
               if (bootcp != null) {
                   classpath.append(pathsep);
  
  
  

Mime
View raw message