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/25 14:15:35 UTC
[1/4] ant git commit: line-ends
Repository: ant
Updated Branches:
refs/heads/1.9.x 625d3d371 -> fdfebe801
line-ends
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/d21cef3f
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/d21cef3f
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/d21cef3f
Branch: refs/heads/1.9.x
Commit: d21cef3f5509f4366b5d78536c2d83db4f2beec8
Parents: 625d3d3
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon Jul 25 15:20:12 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon Jul 25 15:20:12 2016 +0200
----------------------------------------------------------------------
.../apache/tools/ant/util/JavaEnvUtilsTest.java | 282 +++++++++----------
1 file changed, 141 insertions(+), 141 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/d21cef3f/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
index aef4f1b..b3f3e02 100644
--- a/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
@@ -1,141 +1,141 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.tools.ant.util;
-
-import java.io.File;
-
-import junit.framework.AssertionFailedError;
-
-import org.apache.tools.ant.taskdefs.condition.Os;
-import org.junit.Assume;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-/**
- * TestCase for JavaEnvUtils.
- *
- */
-public class JavaEnvUtilsTest {
-
- private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
-
-
- @Test
- public void testGetExecutableNetware() {
- Assume.assumeTrue("Test only runs on netware", Os.isName("netware"));
- assertEquals("java", JavaEnvUtils.getJreExecutable("java"));
- assertEquals("javac", JavaEnvUtils.getJdkExecutable("javac"));
- assertEquals("foo", JavaEnvUtils.getJreExecutable("foo"));
- assertEquals("foo", JavaEnvUtils.getJdkExecutable("foo"));
- }
-
- @Test
- public void testGetExecutableWindows() {
- Assume.assumeTrue("Test only runs on windows", Os.isFamily("windows"));
- String javaHome =
- FILE_UTILS.normalize(System.getProperty("java.home"))
- .getAbsolutePath();
-
- String j = JavaEnvUtils.getJreExecutable("java");
- assertTrue(j.endsWith(".exe"));
- assertTrue(j+" is absolute", (new File(j)).isAbsolute());
- try {
- assertTrue(j+" is normalized and in the JRE dir",
- j.startsWith(javaHome));
- } catch (AssertionFailedError e) {
- // java.home is bogus
- assertEquals("java.exe", j);
- }
-
- j = JavaEnvUtils.getJdkExecutable("javac");
- assertTrue(j.endsWith(".exe"));
- try {
- assertTrue(j+" is absolute", (new File(j)).isAbsolute());
- String javaHomeParent =
- FILE_UTILS.normalize(javaHome+"/..").getAbsolutePath();
- assertTrue(j+" is normalized and in the JDK dir",
- j.startsWith(javaHomeParent));
- assertTrue(j+" is normalized and not in the JRE dir",
- !j.startsWith(javaHome));
-
- } catch (AssertionFailedError e) {
- // java.home is bogus
- assertEquals("javac.exe", j);
- }
-
- assertEquals("foo.exe", JavaEnvUtils.getJreExecutable("foo"));
- assertEquals("foo.exe", JavaEnvUtils.getJdkExecutable("foo"));
- }
-
- @Test
- public void testGetExecutableMostPlatforms() {
- Assume.assumeTrue("Test only runs on non Netware and non Windows systems",
- !Os.isName("netware") && !Os.isFamily("windows"));
- String javaHome =
- FILE_UTILS.normalize(System.getProperty("java.home"))
- .getAbsolutePath();
-
- // could still be OS/2
- String extension = Os.isFamily("dos") ? ".exe" : "";
-
- String j = JavaEnvUtils.getJreExecutable("java");
- if (!extension.equals("")) {
- assertTrue(j.endsWith(extension));
- }
- assertTrue(j+" is absolute", (new File(j)).isAbsolute());
- assertTrue(j+" is normalized and in the JRE dir",
- j.startsWith(javaHome));
-
- j = JavaEnvUtils.getJdkExecutable("javac");
- if (!extension.equals("")) {
- assertTrue(j.endsWith(extension));
- }
- assertTrue(j+" is absolute", (new File(j)).isAbsolute());
-
- String javaHomeParent =
- FILE_UTILS.normalize(javaHome+"/..").getAbsolutePath();
- assertTrue(j+" is normalized and in the JDK dir",
- j.startsWith(javaHomeParent));
-
- if ((Os.isFamily("mac") && JavaEnvUtils.getJavaVersionNumber() <= JavaEnvUtils.VERSION_1_6)
- || JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)) {
- assertTrue(j+" is normalized and in the JRE dir",
- j.startsWith(javaHome));
- } else {
- assertTrue(j+" is normalized and not in the JRE dir",
- !j.startsWith(javaHome));
- }
-
- assertEquals("foo"+extension,
- JavaEnvUtils.getJreExecutable("foo"));
- assertEquals("foo"+extension,
- JavaEnvUtils.getJdkExecutable("foo"));
- }
-
- @Test
- public void testIsAtLeastJavaVersion()
- {
- assertTrue(
- "Current java version is not at least the current java version...",
- JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.getJavaVersion()));
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.tools.ant.util;
+
+import java.io.File;
+
+import junit.framework.AssertionFailedError;
+
+import org.apache.tools.ant.taskdefs.condition.Os;
+import org.junit.Assume;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * TestCase for JavaEnvUtils.
+ *
+ */
+public class JavaEnvUtilsTest {
+
+ private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
+
+
+ @Test
+ public void testGetExecutableNetware() {
+ Assume.assumeTrue("Test only runs on netware", Os.isName("netware"));
+ assertEquals("java", JavaEnvUtils.getJreExecutable("java"));
+ assertEquals("javac", JavaEnvUtils.getJdkExecutable("javac"));
+ assertEquals("foo", JavaEnvUtils.getJreExecutable("foo"));
+ assertEquals("foo", JavaEnvUtils.getJdkExecutable("foo"));
+ }
+
+ @Test
+ public void testGetExecutableWindows() {
+ Assume.assumeTrue("Test only runs on windows", Os.isFamily("windows"));
+ String javaHome =
+ FILE_UTILS.normalize(System.getProperty("java.home"))
+ .getAbsolutePath();
+
+ String j = JavaEnvUtils.getJreExecutable("java");
+ assertTrue(j.endsWith(".exe"));
+ assertTrue(j+" is absolute", (new File(j)).isAbsolute());
+ try {
+ assertTrue(j+" is normalized and in the JRE dir",
+ j.startsWith(javaHome));
+ } catch (AssertionFailedError e) {
+ // java.home is bogus
+ assertEquals("java.exe", j);
+ }
+
+ j = JavaEnvUtils.getJdkExecutable("javac");
+ assertTrue(j.endsWith(".exe"));
+ try {
+ assertTrue(j+" is absolute", (new File(j)).isAbsolute());
+ String javaHomeParent =
+ FILE_UTILS.normalize(javaHome+"/..").getAbsolutePath();
+ assertTrue(j+" is normalized and in the JDK dir",
+ j.startsWith(javaHomeParent));
+ assertTrue(j+" is normalized and not in the JRE dir",
+ !j.startsWith(javaHome));
+
+ } catch (AssertionFailedError e) {
+ // java.home is bogus
+ assertEquals("javac.exe", j);
+ }
+
+ assertEquals("foo.exe", JavaEnvUtils.getJreExecutable("foo"));
+ assertEquals("foo.exe", JavaEnvUtils.getJdkExecutable("foo"));
+ }
+
+ @Test
+ public void testGetExecutableMostPlatforms() {
+ Assume.assumeTrue("Test only runs on non Netware and non Windows systems",
+ !Os.isName("netware") && !Os.isFamily("windows"));
+ String javaHome =
+ FILE_UTILS.normalize(System.getProperty("java.home"))
+ .getAbsolutePath();
+
+ // could still be OS/2
+ String extension = Os.isFamily("dos") ? ".exe" : "";
+
+ String j = JavaEnvUtils.getJreExecutable("java");
+ if (!extension.equals("")) {
+ assertTrue(j.endsWith(extension));
+ }
+ assertTrue(j+" is absolute", (new File(j)).isAbsolute());
+ assertTrue(j+" is normalized and in the JRE dir",
+ j.startsWith(javaHome));
+
+ j = JavaEnvUtils.getJdkExecutable("javac");
+ if (!extension.equals("")) {
+ assertTrue(j.endsWith(extension));
+ }
+ assertTrue(j+" is absolute", (new File(j)).isAbsolute());
+
+ String javaHomeParent =
+ FILE_UTILS.normalize(javaHome+"/..").getAbsolutePath();
+ assertTrue(j+" is normalized and in the JDK dir",
+ j.startsWith(javaHomeParent));
+
+ if ((Os.isFamily("mac") && JavaEnvUtils.getJavaVersionNumber() <= JavaEnvUtils.VERSION_1_6)
+ || JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)) {
+ assertTrue(j+" is normalized and in the JRE dir",
+ j.startsWith(javaHome));
+ } else {
+ assertTrue(j+" is normalized and not in the JRE dir",
+ !j.startsWith(javaHome));
+ }
+
+ assertEquals("foo"+extension,
+ JavaEnvUtils.getJreExecutable("foo"));
+ assertEquals("foo"+extension,
+ JavaEnvUtils.getJdkExecutable("foo"));
+ }
+
+ @Test
+ public void testIsAtLeastJavaVersion()
+ {
+ assertTrue(
+ "Current java version is not at least the current java version...",
+ JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.getJavaVersion()));
+ }
+
+}
[2/4] ant git commit: old JAVA_1_9 still works as expected
Posted by bo...@apache.org.
old JAVA_1_9 still works as expected
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/53fed9e4
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/53fed9e4
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/53fed9e4
Branch: refs/heads/1.9.x
Commit: 53fed9e4e223adbc34760423a53654aa0546e3ea
Parents: d21cef3
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon Jul 25 15:25:51 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon Jul 25 15:25:51 2016 +0200
----------------------------------------------------------------------
.../junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java | 8 ++++++++
1 file changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/53fed9e4/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
index b3f3e02..80a92a9 100644
--- a/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/JavaEnvUtilsTest.java
@@ -28,6 +28,7 @@ import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
/**
* TestCase for JavaEnvUtils.
@@ -138,4 +139,11 @@ public class JavaEnvUtilsTest {
JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.getJavaVersion()));
}
+ @Test
+ public void isJavaVersionSupportsBothVersionsOfJava9() {
+ assumeTrue(JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_9));
+ assertTrue("JAVA_1_9 is not considered equal to JAVA_9",
+ JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_9));
+ }
+
}
[3/4] ant git commit: we can always assume java5
Posted by bo...@apache.org.
we can always assume java5
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/2bac4d00
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/2bac4d00
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/2bac4d00
Branch: refs/heads/1.9.x
Commit: 2bac4d00111b0f2df6c8db54bfd591206b0d6ad3
Parents: 53fed9e
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon Jul 25 15:49:17 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon Jul 25 15:49:17 2016 +0200
----------------------------------------------------------------------
src/etc/testcases/taskdefs/rmic/rmic.xml | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/2bac4d00/src/etc/testcases/taskdefs/rmic/rmic.xml
----------------------------------------------------------------------
diff --git a/src/etc/testcases/taskdefs/rmic/rmic.xml b/src/etc/testcases/taskdefs/rmic/rmic.xml
index 757fca5..944cdcd 100644
--- a/src/etc/testcases/taskdefs/rmic/rmic.xml
+++ b/src/etc/testcases/taskdefs/rmic/rmic.xml
@@ -202,12 +202,6 @@
<available property="kaffe.present" classname="jkaffe.rmi.rmic.RMIC"/>
<available property="rmic.present" classname="sun.rmi.rmic.Main"/>
<available property="wlrmic.present" classname="weblogic.rmic"/>
- <condition property="rmic5.present">
- <and>
- <isset property="rmic.present"/>
- <available classname="java.net.Proxy"/>
- </and>
- </condition>
<condition property="rmic6.present">
<and>
<isset property="rmic.present"/>
@@ -434,41 +428,41 @@
<!--
This test stamps on the XML parser settings on java6, so it is disabled.
-->
- <target name="testXnew" if="rmic5.present" unless="rmic6.present" depends="init">
+ <target name="testXnew" if="rmic.present" unless="rmic6.present" depends="init">
<base-rmic compiler="sun">
<compilerarg value="-Xnew"/>
</base-rmic>
<assertBaseCompiled/>
</target>
- <target name="testXnewDest" if="rmic5.present" unless="rmic6.present" depends="init">
+ <target name="testXnewDest" if="rmic.present" unless="rmic6.present" depends="init">
<dest-rmic compiler="sun">
<compilerarg value="-Xnew"/>
</dest-rmic>
<assertBaseCompiledInDest/>
</target>
- <target name="testXnewForked" if="rmic5.present" depends="init">
+ <target name="testXnewForked" if="rmic.present" depends="init">
<base-rmic compiler="forking">
<compilerarg value="-Xnew"/>
</base-rmic>
<assertBaseCompiled/>
</target>
- <target name="testXnewForkedDest" if="rmic5.present" depends="init">
+ <target name="testXnewForkedDest" if="rmic.present" depends="init">
<dest-rmic compiler="forking">
<compilerarg value="-Xnew"/>
</dest-rmic>
<assertBaseCompiledInDest/>
</target>
- <target name="testXnewCompiler" if="rmic5.present" depends="init">
+ <target name="testXnewCompiler" if="rmic.present" depends="init">
<base-rmic compiler="xnew">
</base-rmic>
<assertBaseCompiled/>
</target>
- <target name="testXnewCompilerDest" if="rmic5.present" depends="init">
+ <target name="testXnewCompilerDest" if="rmic.present" depends="init">
<dest-rmic compiler="xnew">
</dest-rmic>
<assertBaseCompiledInDest/>
[4/4] ant git commit: default to forking rmic on JDK 9+
Posted by bo...@apache.org.
default to forking rmic on JDK 9+
https://bz.apache.org/bugzilla/show_bug.cgi?id=59860
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/fdfebe80
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/fdfebe80
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/fdfebe80
Branch: refs/heads/1.9.x
Commit: fdfebe8013e1e2fe89b571d96935e61dbdbdc0c2
Parents: 2bac4d0
Author: Stefan Bodewig <bo...@apache.org>
Authored: Mon Jul 25 16:14:59 2016 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Mon Jul 25 16:14:59 2016 +0200
----------------------------------------------------------------------
WHATSNEW | 6 ++++
manual/Tasks/rmic.html | 8 +++--
src/etc/testcases/taskdefs/rmic/rmic.xml | 34 +++++++++++++-------
.../ant/taskdefs/rmic/RmicAdapterFactory.java | 11 +++++--
.../apache/tools/ant/taskdefs/rmic/SunRmic.java | 8 +++++
.../tools/ant/taskdefs/RmicAdvancedTest.java | 7 ++--
6 files changed, 52 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/fdfebe80/WHATSNEW
----------------------------------------------------------------------
diff --git a/WHATSNEW b/WHATSNEW
index 3e4e90b..da25374 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -50,6 +50,12 @@ Other changes:
* added a new <native2asciifilter> filter that can perform non-ASCII
to Unicode-escape conversions.
+ * <rmic> defaults to the "forking" compiler on JDK 9+ as the
+ implementation class of rmic is not exported by its containing
+ module and thus not accessible to Ant without applying -XaddExports
+ magic.
+ Bugzilla Report 59860
+
Changes from Ant 1.9.6 TO Ant 1.9.7
===================================
http://git-wip-us.apache.org/repos/asf/ant/blob/fdfebe80/manual/Tasks/rmic.html
----------------------------------------------------------------------
diff --git a/manual/Tasks/rmic.html b/manual/Tasks/rmic.html
index b644c68..12b30c5 100644
--- a/manual/Tasks/rmic.html
+++ b/manual/Tasks/rmic.html
@@ -52,11 +52,13 @@ with the "build.rmic" property, the <code>compiler</code>
attribute. or a nested element.
<a name="compilervalues">Here are the choices</a>:</p>
<ul>
- <li>default -the default compiler (kaffe or sun) for the platform.
- <li>sun (the standard compiler of the JDK)</li>
+ <li>default -the default compiler (kaffe, sun or forking) for the platform.
+ <li>sun (the standard compiler of the JDK < 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 Apache Ant 1.7)</li>
+ <li>forking - the sun compiler forked into a separate process (since
+ Apache Ant 1.7). Starting with Ant 1.9.8 this is the default when
+ running on JDK 9+.</li>
<li>xnew - the sun compiler forked into a separate process,
with the -Xnew option (since Ant 1.7).
This is the most reliable way to use -Xnew</li>
http://git-wip-us.apache.org/repos/asf/ant/blob/fdfebe80/src/etc/testcases/taskdefs/rmic/rmic.xml
----------------------------------------------------------------------
diff --git a/src/etc/testcases/taskdefs/rmic/rmic.xml b/src/etc/testcases/taskdefs/rmic/rmic.xml
index 944cdcd..4670f43 100644
--- a/src/etc/testcases/taskdefs/rmic/rmic.xml
+++ b/src/etc/testcases/taskdefs/rmic/rmic.xml
@@ -200,7 +200,17 @@
<target name="probe-rmic">
<available property="kaffe.present" classname="jkaffe.rmi.rmic.RMIC"/>
- <available property="rmic.present" classname="sun.rmi.rmic.Main"/>
+ <condition property="rmic.present">
+ <or>
+ <available classname="sun.rmi.rmic.Main"/>
+ <!-- we'll use forking as default for Java9 -->
+ <available classname="java.lang.module.ModuleDescriptor"/>
+ </or>
+ </condition>
+ <condition property="rmic.compiler" value="forking">
+ <available classname="java.lang.module.ModuleDescriptor"/>
+ </condition>
+ <property name="rmic.compiler" value="sun"/>
<available property="wlrmic.present" classname="weblogic.rmic"/>
<condition property="rmic6.present">
<and>
@@ -263,24 +273,24 @@
</target>
<target name="testRmic" if="rmic.present" depends="init">
- <base-rmic compiler="sun"/>
+ <base-rmic compiler="${rmic.compiler}"/>
<assertBaseCompiled/>
</target>
<target name="testRmicDest" if="rmic.present" depends="init">
- <dest-rmic compiler="sun"/>
+ <dest-rmic compiler="${rmic.compiler}"/>
<assertBaseCompiledInDest/>
</target>
<target name="testRmicJArg" if="rmic.present" depends="init">
- <base-rmic compiler="sun">
+ <base-rmic compiler="${rmic.compiler}">
<compilerarg value="-J-mx256m" />
</base-rmic>
<assertBaseCompiled/>
</target>
<target name="testRmicJArgDest" if="rmic.present" depends="init">
- <dest-rmic compiler="sun">
+ <dest-rmic compiler="${rmic.compiler}">
<compilerarg value="-J-mx256m" />
</dest-rmic>
<assertBaseCompiledInDest/>
@@ -322,7 +332,7 @@
<assertBaseCompiled/>
</target>
- <target name="testBadName" if="rmic.present" depends="init">
+ <target name="testBadName" depends="init">
<base-rmic
compiler="no-such-compiler"
/>
@@ -330,12 +340,12 @@
<target name="testExplicitClass" if="rmic.present" depends="init">
<base-rmic
- compiler="org.apache.tools.ant.taskdefs.rmic.SunRmic"
+ compiler="org.apache.tools.ant.taskdefs.rmic.ForkingSunRmic"
/>
<assertBaseCompiled/>
</target>
- <target name="testWrongClass" if="rmic.present" depends="init">
+ <target name="testWrongClass" depends="init">
<base-rmic
compiler="org.apache.tools.ant.BuildException"
/>
@@ -389,14 +399,14 @@
<assertAntCompiledInDest/>
</target>
- <target name="testForkingAntClasspath" if="rmic.present" depends="compileAntTimestamp">
+ <target name="testForkingAntClasspath" depends="compileAntTimestamp">
<base-rmic
compiler="forking"
/>
<assertAntCompiled />
</target>
- <target name="testForkingAntClasspathDest" if="rmic.present" depends="compileAntTimestamp">
+ <target name="testForkingAntClasspathDest" depends="compileAntTimestamp">
<dest-rmic
compiler="forking"
/>
@@ -429,14 +439,14 @@
This test stamps on the XML parser settings on java6, so it is disabled.
-->
<target name="testXnew" if="rmic.present" unless="rmic6.present" depends="init">
- <base-rmic compiler="sun">
+ <base-rmic compiler="${rmic.compiler}">
<compilerarg value="-Xnew"/>
</base-rmic>
<assertBaseCompiled/>
</target>
<target name="testXnewDest" if="rmic.present" unless="rmic6.present" depends="init">
- <dest-rmic compiler="sun">
+ <dest-rmic compiler="${rmic.compiler}">
<compilerarg value="-Xnew"/>
</dest-rmic>
<assertBaseCompiledInDest/>
http://git-wip-us.apache.org/repos/asf/ant/blob/fdfebe80/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java b/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java
index 4a2708c..a604144 100644
--- a/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java
+++ b/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java
@@ -22,6 +22,7 @@ import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.util.ClasspathUtils;
+import org.apache.tools.ant.util.JavaEnvUtils;
/**
* Creates the necessary rmic adapter, given basic criteria.
@@ -95,9 +96,13 @@ public final class RmicAdapterFactory {
throws BuildException {
//handle default specially by choosing the sun or kaffe compiler
if (DEFAULT_COMPILER.equalsIgnoreCase(rmicType) || rmicType.length() == 0) {
- rmicType = KaffeRmic.isAvailable()
- ? KaffeRmic.COMPILER_NAME
- : SunRmic.COMPILER_NAME;
+ if (KaffeRmic.isAvailable()) {
+ rmicType = KaffeRmic.COMPILER_NAME;
+ } else if (JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)) {
+ rmicType = ForkingSunRmic.COMPILER_NAME;
+ } else {
+ rmicType = SunRmic.COMPILER_NAME;
+ }
}
if (SunRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) {
return new SunRmic();
http://git-wip-us.apache.org/repos/asf/ant/blob/fdfebe80/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java b/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java
index 07cbd30..1b5e67d 100644
--- a/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java
+++ b/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java
@@ -27,6 +27,7 @@ import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.LogOutputStream;
import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.util.JavaEnvUtils;
/**
* The implementation of the rmic for SUN's JDK.
@@ -54,6 +55,9 @@ public class SunRmic extends DefaultRmicAdapter {
+ "available. A common solution is to "
+ "set the environment variable "
+ "JAVA_HOME";
+ public static final String ERROR_NO_RMIC_ON_CLASSPATH_JAVA_9 = "Cannot use SUN rmic, as it is not "
+ + "available. The class we try to use is part of the jdk.rmic module which may not be. "
+ + "Please use the 'forking' compiler for JDK 9+";
/** Error message to use when there is an error starting the sun rmic compiler */
public static final String ERROR_RMIC_FAILED = "Error starting SUN rmic: ";
@@ -84,6 +88,10 @@ public class SunRmic extends DefaultRmicAdapter {
(new Object[] {cmd.getArguments()}));
return ok.booleanValue();
} catch (ClassNotFoundException ex) {
+ if (JavaEnvUtils.isAtLeastJavaVersion(JavaEnvUtils.JAVA_9)) {
+ throw new BuildException(ERROR_NO_RMIC_ON_CLASSPATH_JAVA_9,
+ getRmic().getLocation());
+ }
throw new BuildException(ERROR_NO_RMIC_ON_CLASSPATH,
getRmic().getLocation());
} catch (Exception ex) {
http://git-wip-us.apache.org/repos/asf/ant/blob/fdfebe80/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java
index c9d2514..e0e2d9a 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java
@@ -137,7 +137,7 @@ public class RmicAdvancedTest {
* test weblogic
*/
@Test
- @Ignore("WLRmin tests don't work")
+ @Ignore("WLRmic tests don't work")
public void XtestWlrmic() throws Exception {
buildRule.executeTarget("testWlrmic");
}
@@ -146,7 +146,7 @@ public class RmicAdvancedTest {
* test weblogic's stripping of -J args
*/
@Test
- @Ignore("WLRmin tests don't work")
+ @Ignore("WLRmic tests don't work")
public void XtestWlrmicJArg() throws Exception {
buildRule.executeTarget("testWlrmicJArg");
}
@@ -155,8 +155,7 @@ public class RmicAdvancedTest {
* test the forking compiler
*/
@Test
- @Ignore("WLRmin tests don't work")
- public void NotestForking() throws Exception {
+ public void testForking() throws Exception {
buildRule.executeTarget("testForking");
}