ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1027025 - in /ant/core/trunk: ./ docs/manual/Tasks/ src/main/org/apache/tools/ant/taskdefs/optional/javah/ src/main/org/apache/tools/ant/util/
Date Mon, 25 Oct 2010 10:08:36 GMT
Author: bodewig
Date: Mon Oct 25 10:08:35 2010
New Revision: 1027025

URL: http://svn.apache.org/viewvc?rev=1027025&view=rev
Log:
add support for gchj to javah.  PR 50149.  Submitted by Bernhard Rosenkraenzer

Added:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/javah/Gcjh.java
      - copied, changed from r1026975, ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/javah/Kaffeh.java
Modified:
    ant/core/trunk/CONTRIBUTORS
    ant/core/trunk/WHATSNEW
    ant/core/trunk/contributors.xml
    ant/core/trunk/docs/manual/Tasks/javah.html
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/javah/JavahAdapterFactory.java
    ant/core/trunk/src/main/org/apache/tools/ant/util/JavaEnvUtils.java

Modified: ant/core/trunk/CONTRIBUTORS
URL: http://svn.apache.org/viewvc/ant/core/trunk/CONTRIBUTORS?rev=1027025&r1=1027024&r2=1027025&view=diff
==============================================================================
--- ant/core/trunk/CONTRIBUTORS (original)
+++ ant/core/trunk/CONTRIBUTORS Mon Oct 25 10:08:35 2010
@@ -33,6 +33,7 @@ Benjamin Burgess
 Ben Galbraith
 Benoit Moussaud
 Bernd Dutkowski
+Bernhard Rosenkraenzer
 Brad Clark
 Brant Langer Gurganus
 Brian Curnow

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=1027025&r1=1027024&r2=1027025&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Mon Oct 25 10:08:35 2010
@@ -229,6 +229,9 @@ Other changes:
  * A new <cutdirsmapper> can be used like wget's --cut-dirs option to
    strip leading directories from file names.
 
+ * <javah> now supports the GNU project's gcjh compiler.
+   Bugzilla Report 50149.
+
 Changes from Ant 1.8.0 TO Ant 1.8.1 
 ===================================
 

Modified: ant/core/trunk/contributors.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/contributors.xml?rev=1027025&r1=1027024&r2=1027025&view=diff
==============================================================================
--- ant/core/trunk/contributors.xml (original)
+++ ant/core/trunk/contributors.xml Mon Oct 25 10:08:35 2010
@@ -157,6 +157,10 @@
     <last>Dutkowski</last>
   </name>
   <name>
+    <first>Bernhard</first>
+    <last>Rosenkraenzer</last>
+  </name>
+  <name>
     <first>Brad</first>
     <last>Clark</last>
   </name>

Modified: ant/core/trunk/docs/manual/Tasks/javah.html
URL: http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/Tasks/javah.html?rev=1027025&r1=1027024&r2=1027025&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/Tasks/javah.html (original)
+++ ant/core/trunk/docs/manual/Tasks/javah.html Mon Oct 25 10:08:35 2010
@@ -40,6 +40,9 @@ name="implementationvalues">Here are the
   <li>default - the default compiler (kaffeh or sun) for the platform.</li>
   <li>sun (the standard compiler of the JDK)</li>
   <li>kaffeh (the native standard compiler of <a href="http://www.kaffe.org" target="_top">Kaffe</a>)</li>
+  <li>gcjh (the native standard compiler
+  of <a href="http://gcc.gnu.org/java/"
+  target="_top">gcj and gij</a>) <em>since Ant 1.8.2</em></li>
 </ul>
 
 <p><b>Note:</b> if you are using this task to work on multiple files

Copied: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/javah/Gcjh.java (from
r1026975, ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/javah/Kaffeh.java)
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/javah/Gcjh.java?p2=ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/javah/Gcjh.java&p1=ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/javah/Kaffeh.java&r1=1026975&r2=1027025&rev=1027025&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/javah/Kaffeh.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/javah/Gcjh.java Mon Oct
25 10:08:35 2010
@@ -25,24 +25,19 @@ import org.apache.tools.ant.types.Path;
 import org.apache.tools.ant.util.JavaEnvUtils;
 
 /**
- * Adapter to the native kaffeh compiler.
+ * Adapter to the native gcjh compiler.
  *
- * @since Ant 1.6.3
+ * @since Ant 1.8.2
  */
-public class Kaffeh implements JavahAdapter {
+public class Gcjh implements JavahAdapter {
 
-    /** the name of the javah adapter - kaffeh */
-    public static final String IMPLEMENTATION_NAME = "kaffeh";
+    public static final String IMPLEMENTATION_NAME = "gcjh";
 
     /**
      * Performs the actual compilation.
-     * @param javah the calling javah task.
-     * @return true if the compilation was successful.
-     * @throws BuildException if there is an error.
-     * @since Ant 1.6.3
      */
     public boolean compile(Javah javah) throws BuildException {
-        Commandline cmd = setupKaffehCommand(javah);
+        Commandline cmd = setupGcjhCommand(javah);
         try {
             Execute.runCommand(javah, cmd.getCommandline());
             return true;
@@ -54,9 +49,9 @@ public class Kaffeh implements JavahAdap
         return false;
     }
 
-    private Commandline setupKaffehCommand(Javah javah) {
+    private Commandline setupGcjhCommand(Javah javah) {
         Commandline cmd = new Commandline();
-        cmd.setExecutable(JavaEnvUtils.getJdkExecutable("kaffeh"));
+        cmd.setExecutable(JavaEnvUtils.getJdkExecutable("gcjh"));
 
         if (javah.getDestdir() != null) {
             cmd.createArgument().setValue("-d");
@@ -77,7 +72,7 @@ public class Kaffeh implements JavahAdap
             cp.append(javah.getClasspath());
         }
         if (cp.size() > 0) {
-            cmd.createArgument().setValue("-classpath");
+            cmd.createArgument().setValue("--classpath");
             cmd.createArgument().setPath(cp);
         }
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/javah/JavahAdapterFactory.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/javah/JavahAdapterFactory.java?rev=1027025&r1=1027024&r2=1027025&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/javah/JavahAdapterFactory.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/javah/JavahAdapterFactory.java
Mon Oct 25 10:08:35 2010
@@ -42,6 +42,8 @@ public class JavahAdapterFactory {
     public static String getDefault() {
         if (JavaEnvUtils.isKaffe()) {
             return Kaffeh.IMPLEMENTATION_NAME;
+        } else if (JavaEnvUtils.isGij()) {
+            return Gcjh.IMPLEMENTATION_NAME;
         }
         return SunJavah.IMPLEMENTATION_NAME;
     }
@@ -82,6 +84,9 @@ public class JavahAdapterFactory {
         if ((JavaEnvUtils.isKaffe() && choice == null)
             || Kaffeh.IMPLEMENTATION_NAME.equals(choice)) {
             return new Kaffeh();
+        } else if ((JavaEnvUtils.isGij() && choice == null)
+            || Gcjh.IMPLEMENTATION_NAME.equals(choice)) {
+            return new Gcjh();
         } else if (SunJavah.IMPLEMENTATION_NAME.equals(choice)) {
             return new SunJavah();
         } else if (choice != null) {

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=1027025&r1=1027024&r2=1027025&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 Oct 25 10:08:35
2010
@@ -91,6 +91,8 @@ public final class JavaEnvUtils {
 
     /** Whether this is the Kaffe VM */
     private static boolean kaffeDetected;
+    /** Whether this is the GNU VM (gcj/gij) */
+    private static boolean gijDetected;
 
     /** array of packages in the runtime */
     private static Vector jrePackages;
@@ -138,6 +140,13 @@ public final class JavaEnvUtils {
         } catch (Throwable t) {
             // swallow as this simply doesn't seem to be Kaffe
         }
+        gijDetected = false;
+        try {
+            Class.forName("gnu.gcj.Core");
+            gijDetected = true;
+        } catch (Throwable t) {
+            // swallow as this simply doesn't seem to be gcj/gij
+        }
     }
 
     /**
@@ -199,6 +208,15 @@ public final class JavaEnvUtils {
     }
 
     /**
+     * Checks whether the current Java VM is the GNU interpreter gij
+     * or we are running in a gcj precompiled binary.
+     * @return true if the current Java VM is gcj/gij.
+     */
+    public static boolean isGij() {
+        return gijDetected;
+    }
+
+    /**
      * Finds an executable that is part of a JRE installation based on
      * the java.home system property.
      *



Mime
View raw message