Browse Source

Debian patch for GNU Classpath, contributed by Emmanuel Bourg. Bugzilla PR 54760

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1479454 13f79535-47bb-0310-9956-ffa450edef68
master
Antoine Levy-Lambert 12 years ago
parent
commit
58a2039b5a
4 changed files with 26 additions and 3 deletions
  1. +3
    -0
      WHATSNEW
  2. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/KaffeNative2Ascii.java
  3. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/Native2AsciiAdapterFactory.java
  4. +20
    -0
      src/main/org/apache/tools/ant/util/JavaEnvUtils.java

+ 3
- 0
WHATSNEW View File

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



+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/KaffeNative2Ascii.java View File

@@ -32,7 +32,7 @@ public final class KaffeNative2Ascii extends DefaultNative2Ascii {

// 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",
};


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/Native2AsciiAdapterFactory.java View File

@@ -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)) {


+ 20
- 0
src/main/org/apache/tools/ant/util/JavaEnvUtils.java View File

@@ -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");
@@ -233,6 +244,15 @@ public final class JavaEnvUtils {
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
* or we are running in a gcj precompiled binary.


Loading…
Cancel
Save