You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2016/07/31 04:24:53 UTC

[1/3] ant git commit: typos

Repository: ant
Updated Branches:
  refs/heads/master 98e87c528 -> 047844b24


typos


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/eb906395
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/eb906395
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/eb906395

Branch: refs/heads/master
Commit: eb906395ffc45b3a9c08f39b93e049aa5e700e52
Parents: 7ebbdc9
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sun Jul 31 06:17:50 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sun Jul 31 06:17:50 2016 +0200

----------------------------------------------------------------------
 manual/Tasks/javah.html | 2 +-
 manual/Tasks/rmic.html  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/eb906395/manual/Tasks/javah.html
----------------------------------------------------------------------
diff --git a/manual/Tasks/javah.html b/manual/Tasks/javah.html
index 0fdc885..0428e66 100644
--- a/manual/Tasks/javah.html
+++ b/manual/Tasks/javah.html
@@ -45,7 +45,7 @@ name="implementationvalues">Here are the choices of the attribute</a>:</p>
   of <a href="http://gcc.gnu.org/java/"
         target="_top">gcj and gij</a>) <em>since Apache Ant 1.8.2</em></li>
   <li>forking - runs the javah executable via its command line
-    interface in a separate process. Default wehn running on
+    interface in a separate process. Default when running on
     Java9. <em>since Ant 1.9.8</em></li>
 </ul>
 

http://git-wip-us.apache.org/repos/asf/ant/blob/eb906395/manual/Tasks/rmic.html
----------------------------------------------------------------------
diff --git a/manual/Tasks/rmic.html b/manual/Tasks/rmic.html
index 3c7a6d6..fa927bf 100644
--- a/manual/Tasks/rmic.html
+++ b/manual/Tasks/rmic.html
@@ -53,7 +53,7 @@ attribute. or a nested element.
 <a name="compilervalues">Here are the choices</a>:</p>
 <ul>
   <li>default -the default compiler (kaffe, sun or forking) for the platform.
-  <li>sun (the standard compiler of the JDK < JDK 9)</li>
+  <li>sun (the standard compiler of the JDK &lt; JDK 9)</li>
   <li>kaffe (the standard compiler of <a href="http://www.kaffe.org" target="_top">Kaffe</a>)</li>
   <li>weblogic</li>
   <li>forking - the sun compiler forked into a separate process (since


[2/3] ant git commit: add support for javac -h

Posted by bo...@apache.org.
add support for javac -h

https://bz.apache.org/bugzilla/show_bug.cgi?id=59905


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/ee85859e
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/ee85859e
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/ee85859e

Branch: refs/heads/master
Commit: ee85859ea0903f64792c04c1b9eff3e9c1fa19e0
Parents: eb90639
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sun Jul 31 06:21:43 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sun Jul 31 06:21:43 2016 +0200

----------------------------------------------------------------------
 WHATSNEW                                        |  4 ++
 manual/Tasks/javac.html                         | 17 ++++++
 manual/Tasks/javah.html                         |  8 +++
 .../org/apache/tools/ant/taskdefs/Javac.java    | 21 +++++++
 .../compilers/DefaultCompilerAdapter.java       | 10 ++++
 src/tests/antunit/taskdefs/javac-test.xml       | 59 +++++++++++++++-----
 6 files changed, 104 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/ee85859e/WHATSNEW
----------------------------------------------------------------------
diff --git a/WHATSNEW b/WHATSNEW
index 019b8a4..9a36711 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -67,6 +67,10 @@ Other changes:
  * a new implementation "forking" has been added to <javah> and is
    used as default when running on JDK9.
 
+ * support for javac's -h switch has been added with the
+   nativeheaderdir attribute.
+   Bugzilla Report 59905
+
 Changes from Ant 1.9.6 TO Ant 1.9.7
 ===================================
 

http://git-wip-us.apache.org/repos/asf/ant/blob/ee85859e/manual/Tasks/javac.html
----------------------------------------------------------------------
diff --git a/manual/Tasks/javac.html b/manual/Tasks/javac.html
index a5fc56c..202215f 100644
--- a/manual/Tasks/javac.html
+++ b/manual/Tasks/javac.html
@@ -125,6 +125,15 @@ classpath of the <code>&lt;javac&gt;</code> task, and does not release them.
 The side effect of this is that you will not be able to delete or move
 those files later on in the build.  The workaround is to fork when
 invoking the compiler.</p>
+<p>If you are using Java 8 or above and your source contains native
+  methods or fields annotated with the <code>@Native</code> annotation
+  you can set the <code>nativeheaderdir</code> attribute in order to
+  use the <code>-h</code> switch of <code>javac</code> to generate the
+  native header files. Note that the logic Ant uses to determine which
+  files to compile does not take native headers into account, i.e. if
+  the <code>.class</code> is more recent than the
+  corresponding <code>.java</code> file the file will not get compiled
+  even if a native header file generated for it would be outdated.</p>
 <h3>Parameters</h3>
 <table border="1" cellpadding="2" cellspacing="0">
   <tr>
@@ -505,6 +514,14 @@ invoking the compiler.</p>
       <em>since Ant 1.9.7</em></td>
     <td align="center" valign="top">No</td>
   </tr>
+  <tr>
+    <td valign="top">nativeheaderdir</td>
+    <td valign="top">
+      Specify where to place generated native header files. Ignored
+      when running on JDK &lt; 8.
+      <em>Since Ant 1.9.8</em>.
+    <td align="center" valign="top">No</td>
+  </tr>
 </table>
 
 <h3>Parameters specified as nested elements</h3>

http://git-wip-us.apache.org/repos/asf/ant/blob/ee85859e/manual/Tasks/javah.html
----------------------------------------------------------------------
diff --git a/manual/Tasks/javah.html b/manual/Tasks/javah.html
index 0428e66..4d3979b 100644
--- a/manual/Tasks/javah.html
+++ b/manual/Tasks/javah.html
@@ -33,6 +33,14 @@ whether <a href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/ja
 or <a href="http://java.sun.com/products/jdk/1.1/docs/tooldocs/win32/javah.html">pre-JDK1.2</a>
 systems are used.</p>
 
+<p>If you are building with Java 8 or above consider
+  using <a href="javac.html"><code>javac</code></a>'s <code>nativeheaderdir</code>
+  attribute instead which allows you to compile the classes and
+  generate the native header files with a single step.</p>
+
+<p><b>Note</b> the <code>javah</code> has been deprecated as of Java 9
+  and is scheduled to be removed with Java 10.</p>
+
 <p>It is possible to use different compilers. This can be selected
 with the <code>implementation</code> attribute or a nested element.  <a
 name="implementationvalues">Here are the choices of the attribute</a>:</p>

http://git-wip-us.apache.org/repos/asf/ant/blob/ee85859e/src/main/org/apache/tools/ant/taskdefs/Javac.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Javac.java b/src/main/org/apache/tools/ant/taskdefs/Javac.java
index 892c0f1..3452592 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Javac.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Javac.java
@@ -108,6 +108,7 @@ public class Javac extends MatchingTask {
 
     private Path src;
     private File destDir;
+    private File nativeHeaderDir;
     private Path compileClasspath;
     private Path modulepath;
     private Path upgrademodulepath;
@@ -286,6 +287,26 @@ public class Javac extends MatchingTask {
     }
 
     /**
+     * Set the destination directory into which the generated native
+     * header files should be placed.
+     * @param nhDir where to place generated native header files
+     * @since Ant 1.9.8
+     */
+    public void setNativeHeaderDir(final File nhDir) {
+        this.nativeHeaderDir = nhDir;
+    }
+
+    /**
+     * Gets the destination directory into which the generated native
+     * header files should be placed.
+     * @return where to place generated native header files
+     * @since Ant 1.9.8
+     */
+    public File getNativeHeaderDir() {
+        return nativeHeaderDir;
+    }
+
+    /**
      * Set the sourcepath to be used for this compilation.
      * @param sourcepath the source path
      */

http://git-wip-us.apache.org/repos/asf/ant/blob/ee85859e/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
index db6cd85..5f1f1f7 100644
--- a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
+++ b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
@@ -414,6 +414,16 @@ public abstract class DefaultCompilerAdapter
             cmd.createArgument().setValue("-upgrademodulepath");
             cmd.createArgument().setPath(ump);
         }
+        if (attributes.getNativeHeaderDir() != null) {
+            if (assumeJava13() || assumeJava14() || assumeJava15()
+                || assumeJava16() || assumeJava17()) {
+                attributes.log("Support for javac -h has been added in Java8,"
+                               + " ignoring it");
+            } else {
+                cmd.createArgument().setValue("-h");
+                cmd.createArgument().setFile(attributes.getNativeHeaderDir());
+            }
+        }
         return cmd;
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/ee85859e/src/tests/antunit/taskdefs/javac-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/taskdefs/javac-test.xml b/src/tests/antunit/taskdefs/javac-test.xml
index de193ea..05c3269 100644
--- a/src/tests/antunit/taskdefs/javac-test.xml
+++ b/src/tests/antunit/taskdefs/javac-test.xml
@@ -18,10 +18,16 @@
 <project default="antunit" xmlns:au="antlib:org.apache.ant.antunit">
   <import file="../antunit-base.xml" />
 
-  <property name="javac-dir" location="${output}/javac-dir" />
-  <property name="build-dir" location="${javac-dir}/build" />
+  <target name="setup">
+    <property name="javac-dir" location="${output}/javac-dir" />
+    <property name="build-dir" location="${javac-dir}/build" />
+    <presetdef name="testJavac">
+      <javac srcdir="${javac-dir}/src" destdir="${javac-dir}/classes"
+             includeantruntime="false"/>
+    </presetdef>
+  </target>
 
-  <target name="test-includeDestClasses">
+  <target name="test-includeDestClasses" depends="setup">
     <property name="DATE" value="09/10/1999 4:30 pm" />
     <delete dir="${javac-dir}/src" />
     <mkdir dir="${javac-dir}/src" />
@@ -54,7 +60,7 @@
     </au:assertFalse>
   </target>
 
-  <target name="test-updated-property">
+  <target name="test-updated-property" depends="setup">
     <delete quiet="yes" dir="${build-dir}" />
     <mkdir dir="${build-dir}" />
     <javac srcdir="javac-dir/good-src" destdir="${build-dir}" updatedProperty="classes-updated" />
@@ -67,7 +73,7 @@
     </au:assertFalse>
   </target>
 
-  <target name="test-error-property">
+  <target name="test-error-property" depends="setup">
     <delete quiet="yes" dir="${build-dir}" />
     <mkdir dir="${build-dir}" />
     <javac srcdir="javac-dir/good-src" destdir="${build-dir}" failOnError="false" errorProperty="compile-failed" />
@@ -80,7 +86,7 @@
     </au:assertTrue>
   </target>
 
-  <target name="setUpForPackageInfoJava">
+  <target name="setUpForPackageInfoJava" depends="setup">
     <mkdir dir="${javac-dir}/src/a" />
     <mkdir dir="${build-dir}" />
     <echo file="${javac-dir}/src/a/package-info.java">
@@ -151,7 +157,7 @@
     <au:assertFileDoesntExist file="${build-dir}/a/package-info.class"/>
   </target>
 
-  <target name="-create-javac-adapter">
+  <target name="-create-javac-adapter" depends="setup">
     <property name="adapter.dir" location="${output}/adapter" />
     <mkdir dir="${input}/org/example" />
     <echo file="${input}/org/example/Adapter.java">
@@ -198,16 +204,14 @@ public class Adapter implements CompilerAdapter {
     <au:assertLogContains text="adapter called" />
   </target>
 
-  <target name="testSourceAttributes" xmlns:if="ant:if" xmlns:unless="ant:unless">
+  <target name="testSourceAttributes" depends="setup"
+          xmlns:if="ant:if" xmlns:unless="ant:unless">
     <delete dir="${javac-dir}/src" />
     <mkdir dir="${javac-dir}/src" />
     <mkdir dir="${javac-dir}/classes" />
     <echo file="${javac-dir}/src/A.java">
       public class A { }
     </echo>
-  	<presetdef name="testJavac">
-      <javac srcdir="${javac-dir}/src" destdir="${javac-dir}/classes" includeantruntime="false"/>  	    
-  	</presetdef>
 
     <au:expectfailure>
       <testJavac source="notValid"/>
@@ -256,16 +260,14 @@ public class Adapter implements CompilerAdapter {
     </sequential>
   </target>	
 	
-  <target name="testTargetAttributes" xmlns:if="ant:if" xmlns:unless="ant:unless">
+  <target name="testTargetAttributes" depends="setup"
+          xmlns:if="ant:if" xmlns:unless="ant:unless">
     <delete dir="${javac-dir}/src" />
     <mkdir dir="${javac-dir}/src" />
     <mkdir dir="${javac-dir}/classes" />
     <echo file="${javac-dir}/src/A.java">
       public class A { }
     </echo>
-    <presetdef name="testJavac">
-      <javac srcdir="${javac-dir}/src" destdir="${javac-dir}/classes" includeantruntime="false"/>       
-    </presetdef>
 
     <au:expectfailure>
       <testJavac target="notValid"/>
@@ -313,4 +315,31 @@ public class Adapter implements CompilerAdapter {
       <mkdir dir="${javac-dir}/classes"/>
     </sequential>
   </target> 
+
+  <target name="testJavacWithNativeHeaderGeneration" if="jdk1.8+" depends="setup">
+    <mkdir dir="${javac-dir}/src/org/example" />
+    <mkdir dir="${javac-dir}/classes"/>
+    <mkdir dir="${javac-dir}/headers"/>
+    <echo file="${javac-dir}/src/org/example/Foo.java">
+      <![CDATA[
+package org.example;
+public class Foo {
+    public Foo() {}
+    public native String bar(Object baz);
+}
+]]></echo>
+    <echo file="${javac-dir}/src/org/example/Bar.java">
+      <![CDATA[
+package org.example;
+public class Bar {
+    public Bar() {}
+    public String xyzzy(Object baz) {
+        return new Foo().bar(baz);
+    }
+}
+]]></echo>
+      <testJavac nativeheaderdir="${javac-dir}/headers"/>
+      <au:assertFileExists file="${javac-dir}/headers/org_example_Foo.h"/>
+      <au:assertFileDoesntExist file="${javac-dir}/headers/org_example_Bar.h"/>
+  </target>
 </project>


[3/3] ant git commit: Merge branch '1.9.x'

Posted by bo...@apache.org.
Merge branch '1.9.x'


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/047844b2
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/047844b2
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/047844b2

Branch: refs/heads/master
Commit: 047844b2471041b02b1662a8726270ee7d8ad47d
Parents: 98e87c5 ee85859
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sun Jul 31 06:24:36 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sun Jul 31 06:24:36 2016 +0200

----------------------------------------------------------------------
 WHATSNEW                                        |  4 ++
 manual/Tasks/javac.html                         | 17 ++++++
 manual/Tasks/javah.html                         |  8 +++
 manual/Tasks/rmic.html                          |  2 +-
 .../org/apache/tools/ant/taskdefs/Javac.java    | 21 +++++++
 .../compilers/DefaultCompilerAdapter.java       | 10 ++++
 src/tests/antunit/taskdefs/javac-test.xml       | 59 +++++++++++++++-----
 7 files changed, 105 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/047844b2/WHATSNEW
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ant/blob/047844b2/manual/Tasks/javah.html
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ant/blob/047844b2/src/main/org/apache/tools/ant/taskdefs/Javac.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ant/blob/047844b2/src/tests/antunit/taskdefs/javac-test.xml
----------------------------------------------------------------------
diff --cc src/tests/antunit/taskdefs/javac-test.xml
index a3ffc82,05c3269..60bc552
--- a/src/tests/antunit/taskdefs/javac-test.xml
+++ b/src/tests/antunit/taskdefs/javac-test.xml
@@@ -264,4 -315,31 +266,31 @@@ public class Adapter implements Compile
        <mkdir dir="${javac-dir}/classes"/>
      </sequential>
    </target> 
+ 
 -  <target name="testJavacWithNativeHeaderGeneration" if="jdk1.8+" depends="setup">
++  <target name="testJavacWithNativeHeaderGeneration" depends="setup">
+     <mkdir dir="${javac-dir}/src/org/example" />
+     <mkdir dir="${javac-dir}/classes"/>
+     <mkdir dir="${javac-dir}/headers"/>
+     <echo file="${javac-dir}/src/org/example/Foo.java">
+       <![CDATA[
+ package org.example;
+ public class Foo {
+     public Foo() {}
+     public native String bar(Object baz);
+ }
+ ]]></echo>
+     <echo file="${javac-dir}/src/org/example/Bar.java">
+       <![CDATA[
+ package org.example;
+ public class Bar {
+     public Bar() {}
+     public String xyzzy(Object baz) {
+         return new Foo().bar(baz);
+     }
+ }
+ ]]></echo>
+       <testJavac nativeheaderdir="${javac-dir}/headers"/>
+       <au:assertFileExists file="${javac-dir}/headers/org_example_Foo.h"/>
+       <au:assertFileDoesntExist file="${javac-dir}/headers/org_example_Bar.h"/>
+   </target>
  </project>