You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by an...@apache.org on 2013/05/06 04:21:56 UTC

svn commit: r1479454 - in /ant/core/trunk: ./ src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/ src/main/org/apache/tools/ant/util/

Author: antoine
Date: Mon May  6 02:21:56 2013
New Revision: 1479454

URL: http://svn.apache.org/r1479454
Log:
Debian patch for GNU Classpath, contributed by Emmanuel Bourg. Bugzilla PR 54760

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/KaffeNative2Ascii.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/Native2AsciiAdapterFactory.java
    ant/core/trunk/src/main/org/apache/tools/ant/util/JavaEnvUtils.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1479454&r1=1479453&r2=1479454&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Mon May  6 02:21:56 2013
@@ -175,6 +175,9 @@ Other changes:
    This will be useful to use the contains selector if the encoding of the VM is different from the encoding
    of the files being selected.
 
+ * support for GNU Classpath.
+   Bugzilla report 54760.
+
 Changes from Ant 1.8.3 TO Ant 1.8.4
 ===================================
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/KaffeNative2Ascii.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/KaffeNative2Ascii.java?rev=1479454&r1=1479453&r2=1479454&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/KaffeNative2Ascii.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/KaffeNative2Ascii.java Mon May  6 02:21:56 2013
@@ -32,7 +32,7 @@ public final class KaffeNative2Ascii ext
 
     // sorted by newest Kaffe version first
     private static final String[] N2A_CLASSNAMES = new String[] {
-        "gnu.classpath.tools.native2ascii.Native2Ascii",
+        "gnu.classpath.tools.native2ascii.Native2ASCII",
         // pre Kaffe 1.1.5
         "kaffe.tools.native2ascii.Native2Ascii",
     };

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/Native2AsciiAdapterFactory.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/Native2AsciiAdapterFactory.java?rev=1479454&r1=1479453&r2=1479454&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/Native2AsciiAdapterFactory.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/Native2AsciiAdapterFactory.java Mon May  6 02:21:56 2013
@@ -40,7 +40,7 @@ public class Native2AsciiAdapterFactory 
      * vendor
      */
     public static String getDefault() {
-        if (JavaEnvUtils.isKaffe()) {
+        if (JavaEnvUtils.isKaffe() || JavaEnvUtils.isClasspathBased()) {
             return KaffeNative2Ascii.IMPLEMENTATION_NAME;
         }
         return SunNative2Ascii.IMPLEMENTATION_NAME;
@@ -79,7 +79,7 @@ public class Native2AsciiAdapterFactory 
                                                  ProjectComponent log,
                                                  Path classpath)
         throws BuildException {
-        if ((JavaEnvUtils.isKaffe() && choice == null)
+        if (((JavaEnvUtils.isKaffe() || JavaEnvUtils.isClasspathBased()) && choice == null)
             || KaffeNative2Ascii.IMPLEMENTATION_NAME.equals(choice)) {
             return new KaffeNative2Ascii();
         } else if (SunNative2Ascii.IMPLEMENTATION_NAME.equals(choice)) {

Modified: ant/core/trunk/src/main/org/apache/tools/ant/util/JavaEnvUtils.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/util/JavaEnvUtils.java?rev=1479454&r1=1479453&r2=1479454&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/util/JavaEnvUtils.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/util/JavaEnvUtils.java Mon May  6 02:21:56 2013
@@ -101,6 +101,10 @@ public final class JavaEnvUtils {
 
     /** Whether this is the Kaffe VM */
     private static boolean kaffeDetected;
+
+    /** Wheter this is a GNU Classpath based VM */
+    private static boolean classpathDetected;
+
     /** Whether this is the GNU VM (gcj/gij) */
     private static boolean gijDetected;
 
@@ -159,6 +163,13 @@ public final class JavaEnvUtils {
         } catch (Throwable t) {
             // swallow as this simply doesn't seem to be Kaffe
         }
+        classpathDetected = false;
+        try {
+            Class.forName("gnu.classpath.Configuration");
+            classpathDetected = true;
+        } catch (Throwable t) {
+            // swallow as this simply doesn't seem to be GNU classpath based.
+        }
         gijDetected = false;
         try {
             Class.forName("gnu.gcj.Core");
@@ -234,6 +245,15 @@ public final class JavaEnvUtils {
     }
 
     /**
+     * Checks whether the current Java VM is GNU Classpath
+     * @since Ant 1.9.1
+     * @return true if the version of Java is GNU Classpath
+     */
+    public static boolean isClasspathBased() {
+        return classpathDetected;
+    }
+
+    /**
      * Checks whether the current Java VM is the GNU interpreter gij
      * or we are running in a gcj precompiled binary.
      * @since Ant 1.8.2