git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1479454 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -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 | 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. | of the files being selected. | ||||
| * support for GNU Classpath. | |||||
| Bugzilla report 54760. | |||||
| Changes from Ant 1.8.3 TO Ant 1.8.4 | Changes from Ant 1.8.3 TO Ant 1.8.4 | ||||
| =================================== | =================================== | ||||
| @@ -32,7 +32,7 @@ public final class KaffeNative2Ascii extends DefaultNative2Ascii { | |||||
| // sorted by newest Kaffe version first | // sorted by newest Kaffe version first | ||||
| private static final String[] N2A_CLASSNAMES = new String[] { | private static final String[] N2A_CLASSNAMES = new String[] { | ||||
| "gnu.classpath.tools.native2ascii.Native2Ascii", | |||||
| "gnu.classpath.tools.native2ascii.Native2ASCII", | |||||
| // pre Kaffe 1.1.5 | // pre Kaffe 1.1.5 | ||||
| "kaffe.tools.native2ascii.Native2Ascii", | "kaffe.tools.native2ascii.Native2Ascii", | ||||
| }; | }; | ||||
| @@ -40,7 +40,7 @@ public class Native2AsciiAdapterFactory { | |||||
| * vendor | * vendor | ||||
| */ | */ | ||||
| public static String getDefault() { | public static String getDefault() { | ||||
| if (JavaEnvUtils.isKaffe()) { | |||||
| if (JavaEnvUtils.isKaffe() || JavaEnvUtils.isClasspathBased()) { | |||||
| return KaffeNative2Ascii.IMPLEMENTATION_NAME; | return KaffeNative2Ascii.IMPLEMENTATION_NAME; | ||||
| } | } | ||||
| return SunNative2Ascii.IMPLEMENTATION_NAME; | return SunNative2Ascii.IMPLEMENTATION_NAME; | ||||
| @@ -79,7 +79,7 @@ public class Native2AsciiAdapterFactory { | |||||
| ProjectComponent log, | ProjectComponent log, | ||||
| Path classpath) | Path classpath) | ||||
| throws BuildException { | throws BuildException { | ||||
| if ((JavaEnvUtils.isKaffe() && choice == null) | |||||
| if (((JavaEnvUtils.isKaffe() || JavaEnvUtils.isClasspathBased()) && choice == null) | |||||
| || KaffeNative2Ascii.IMPLEMENTATION_NAME.equals(choice)) { | || KaffeNative2Ascii.IMPLEMENTATION_NAME.equals(choice)) { | ||||
| return new KaffeNative2Ascii(); | return new KaffeNative2Ascii(); | ||||
| } else if (SunNative2Ascii.IMPLEMENTATION_NAME.equals(choice)) { | } else if (SunNative2Ascii.IMPLEMENTATION_NAME.equals(choice)) { | ||||
| @@ -101,6 +101,10 @@ public final class JavaEnvUtils { | |||||
| /** Whether this is the Kaffe VM */ | /** Whether this is the Kaffe VM */ | ||||
| private static boolean kaffeDetected; | private static boolean kaffeDetected; | ||||
| /** Wheter this is a GNU Classpath based VM */ | |||||
| private static boolean classpathDetected; | |||||
| /** Whether this is the GNU VM (gcj/gij) */ | /** Whether this is the GNU VM (gcj/gij) */ | ||||
| private static boolean gijDetected; | private static boolean gijDetected; | ||||
| @@ -159,6 +163,13 @@ public final class JavaEnvUtils { | |||||
| } catch (Throwable t) { | } catch (Throwable t) { | ||||
| // swallow as this simply doesn't seem to be Kaffe | // 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; | gijDetected = false; | ||||
| try { | try { | ||||
| Class.forName("gnu.gcj.Core"); | Class.forName("gnu.gcj.Core"); | ||||
| @@ -233,6 +244,15 @@ public final class JavaEnvUtils { | |||||
| return kaffeDetected; | return kaffeDetected; | ||||
| } | } | ||||
| /** | |||||
| * 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 | * Checks whether the current Java VM is the GNU interpreter gij | ||||
| * or we are running in a gcj precompiled binary. | * or we are running in a gcj precompiled binary. | ||||