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/types CommandlineJava.java
Date Fri, 11 Jan 2002 14:59:40 GMT
bodewig     02/01/11 06:59:40

  Modified:    src/main/org/apache/tools/ant/taskdefs Javac.java
                        Javadoc.java
               src/main/org/apache/tools/ant/types CommandlineJava.java
  Log:
  Change the methods that try to locate JDK tools to work on AIX with
  IBM's JDK 1.2 as well.
  
  @todo refactor into a single method somewhere
  
  PR: 5541
  
  Revision  Changes    Path
  1.80      +17 -6     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javac.java
  
  Index: Javac.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javac.java,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- Javac.java	10 Jan 2002 13:59:31 -0000	1.79
  +++ Javac.java	11 Jan 2002 14:59:40 -0000	1.80
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -680,14 +680,25 @@
           // nothing for *nix.
           String extension =  Os.isFamily("dos") ? ".exe" : "";
   
  -        // Look for java in the java.home/../bin directory.  Unfortunately
  +        File jExecutable = null;
  +
  +        // On AIX using IBM's JDK 1.2 the javac executable is in
  +        // the java.home/../../sh directory
  +        if (Os.isName("aix")) {
  +            jExecutable = new File(System.getProperty("java.home") +
  +                                   "/../../sh/javac" + extension);
  +        }
  +
  +        if (jExecutable == null || !jExecutable.exists()) {
  +            // Look for javac in the java.home/../bin directory.  
  +            jExecutable = new File(System.getProperty("java.home") +
  +                                   "/../bin/javac" + extension);
  +        }
  +
  +        // Unfortunately
           // on Windows java.home doesn't always refer to the correct location,
           // so we need to fall back to assuming java is somewhere on the
           // PATH.
  -        java.io.File jExecutable =
  -            new java.io.File(System.getProperty("java.home") +
  -                             "/../bin/javac" + extension );
  -
           if (jExecutable.exists() && !Os.isFamily("netware")) {
               return jExecutable.getAbsolutePath();
           } else {
  
  
  
  1.71      +21 -11    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
  
  Index: Javadoc.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- Javadoc.java	10 Jan 2002 13:59:31 -0000	1.70
  +++ Javadoc.java	11 Jan 2002 14:59:40 -0000	1.71
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -1161,19 +1161,29 @@
           // nothing for *nix.
           String extension =  Os.isFamily("dos") ? ".exe" : "";
   
  -        // Look for javadoc in the java.home/../bin directory.  Unfortunately
  -        // on Windows java.home doesn't always refer to the correct location,
  -        // so we need to fall back to assuming javadoc is somewhere on the
  +        File jdocExecutable = null;
  +
  +        // On AIX using IBM's JDK 1.2 the javadoc executable is in
  +        // the java.home/../sh directory
  +        if (Os.isName("aix")) {
  +            jdocExecutable = new File(System.getProperty("java.home") +
  +                                      "/../sh/javadoc" + extension);
  +        }
  +        
  +        if (jdocExecutable == null || !jdocExecutable.exists()) {
  +            // Look for javadoc in the java.home/../bin directory.  
  +            jdocExecutable = new File(System.getProperty("java.home") +
  +                                      "/../bin/javadoc" + extension);
  +        }
  +
  +        // Unfortunately
  +        // on Windows java.home doesn't always refer to the correct location, 
  +        // so we need to fall back to assuming java is somewhere on the
           // PATH.
  -        File jdocExecutable = new File( System.getProperty("java.home") +
  -                                        "/../bin/javadoc" + extension );
   
  -        if (jdocExecutable.exists() && !Os.isFamily("netware"))
  -        {
  +        if (jdocExecutable.exists() && !Os.isFamily("netware")) {
               return jdocExecutable.getAbsolutePath();
  -        }
  -        else
  -        {
  +        } else {
               if (!Os.isFamily("netware")) {
                   log( "Unable to locate " + jdocExecutable.getAbsolutePath() +
                        ". Using \"javadoc\" instead.", Project.MSG_VERBOSE );
  
  
  
  1.25      +18 -5     jakarta-ant/src/main/org/apache/tools/ant/types/CommandlineJava.java
  
  Index: CommandlineJava.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/CommandlineJava.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- CommandlineJava.java	10 Jan 2002 11:21:20 -0000	1.24
  +++ CommandlineJava.java	11 Jan 2002 14:59:40 -0000	1.25
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -54,6 +54,7 @@
   
   package org.apache.tools.ant.types;
   
  +import java.io.File;
   import java.util.Properties;
   import java.util.Enumeration;
   import java.util.Vector;
  @@ -352,13 +353,25 @@
           // nothing for *nix.
           String extension =  Os.isFamily("dos") ? ".exe" : "";
   
  -        // Look for java in the java.home/../bin directory.  Unfortunately
  +        File jExecutable = null;
  +
  +        // On AIX using IBM's JDK 1.2 the java executable is in
  +        // the java.home/../sh directory
  +        if (Os.isName("aix")) {
  +            jExecutable = new File(System.getProperty("java.home") +
  +                                   "/../sh/java" + extension);
  +        }
  +        
  +        if (jExecutable == null || !jExecutable.exists()) {
  +            // Look for java in the java.home/../bin directory.  
  +            jExecutable = new File(System.getProperty("java.home") +
  +                                   "/../bin/java" + extension);
  +        }
  +
  +        // Unfortunately
           // on Windows java.home doesn't always refer to the correct location, 
           // so we need to fall back to assuming java is somewhere on the
           // PATH.
  -        java.io.File jExecutable = 
  -            new java.io.File(System.getProperty("java.home") +
  -                             "/../bin/java" + extension );
   
           if (jExecutable.exists() && !Os.isFamily("netware")) {
               // NetWare may have a "java" in that directory, but 99% of
  
  
  

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