You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by st...@apache.org on 2006/08/23 14:36:26 UTC
svn commit: r434029 - in /ant/core/trunk: ./ docs/manual/CoreTasks/
src/etc/testcases/taskdefs/rmic/ src/main/org/apache/tools/ant/taskdefs/rmic/
src/testcases/org/apache/tools/ant/taskdefs/
Author: stevel
Date: Wed Aug 23 05:36:25 2006
New Revision: 434029
URL: http://svn.apache.org/viewvc?rev=434029&view=rev
Log:
bug ID#38732 , rmic task doesn't work with -Xnew and JDK 6.0
Fixed by writing a new adapter, xnew, that extends the forking adapter and sets the -Xnew argument. Tests supplied, though the old test, the one that would fail on java1.6, is still there.
Also made the name matching code of rmic locale-independent.
Modified:
ant/core/trunk/WHATSNEW
ant/core/trunk/docs/manual/CoreTasks/rmic.html
ant/core/trunk/src/etc/testcases/taskdefs/rmic/rmic.xml
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/ForkingSunRmic.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java
ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java
Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=434029&r1=434028&r2=434029&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Wed Aug 23 05:36:25 2006
@@ -71,6 +71,8 @@
IE (Windows) or Gnome2 (Unix/Linux) proxy settings. This may break any build
file that somehow relied on content outside the firewall being unreachable:
use the -noproxy command-line option to disable this new feature.
+ Note that the Java1.5 proxy configuration system still does not appear to work
+ reliably on Windows or Linux.
* A bug in SQLExec would prevent the execution of trailing,
non-semicolon-delimited statements. Bugzilla Report 37764.
@@ -97,7 +99,7 @@
* Ant launcher program prints errors to stderr, and exits with a 2 exit code
value if, for any reason, it cannot actually start Ant proper. This will only
affect programs/scripts that called the launcher and which did not want to
- receive an error if ant itself would not start
+ receive an error if Ant itself would not start
Fixed bugs:
-----------
@@ -264,6 +266,9 @@
* The <zip> API allowed creation of directories in file-only archives; a
habitual offender was the subclassed <jar>, which included META-INF/ in
the destination file regardless of whether filesonly was set to true.
+
+* <rmic> has a new adapter, xnew, to use the -XNew back end on java1.5+.
+ By forking rmic, this works on java1.6+. Bugzilla report 38732.
Other changes:
--------------
@@ -271,7 +276,7 @@
* InputHandler implementations may now call InputRequest.getDefaultValue()
if they wish. The default handler uses this also. Bugzilla report 28621.
-* Took in bugzilla report 39320.
+* Took in bugzilla report 39320, "Simple code cleanups"
* Improve compatibility with GNU Classpath and java versions prior to 1.5. Bugzilla 39027.
Modified: ant/core/trunk/docs/manual/CoreTasks/rmic.html
URL: http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/CoreTasks/rmic.html?rev=434029&r1=434028&r2=434029&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTasks/rmic.html (original)
+++ ant/core/trunk/docs/manual/CoreTasks/rmic.html Wed Aug 23 05:36:25 2006
@@ -40,8 +40,11 @@
<li>sun (the standard compiler of the JDK)</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</li>
- <li> "" (empty string). This has the same behaviour as not setting the compiler attribute.
+ <li>forking - the sun compiler forked into a separate process (since Ant 1.7)</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>
+ <li> "" (empty string). This has the same behaviour as not setting the compiler attribute.
First the value of <tt>build.rmic</tt> is used if defined, and if not, the default
for the platform is chosen. If build.rmic is set to this, you get the default.
@@ -83,7 +86,9 @@
<td valign="top">stubversion</td>
<td valign="top">Specify the JDK version for the generated stub code.
Specify "1.1" to pass the "-v1.1" option to rmic,
- "1.2" for -v12, compat for -vcompat.
+ "1.2" for -v12, compat for -vcompat. <br>
+ Since Ant1.7, if you do not specify a version, and do not ask
+ for iiop or idl files, "compat" is selected.
</td>
<td align="center" valign="top">No, default="compat"</td>
@@ -245,7 +250,7 @@
<code>${build}/classes</code>.</p>
<hr>
-<p align="center">Copyright © 2000-2005 The Apache Software Foundation. All rights
+<p align="center">Copyright © 2000-2006 The Apache Software Foundation. All rights
Reserved.</p>
</body>
Modified: ant/core/trunk/src/etc/testcases/taskdefs/rmic/rmic.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/etc/testcases/taskdefs/rmic/rmic.xml?rev=434029&r1=434028&r2=434029&view=diff
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/rmic/rmic.xml (original)
+++ ant/core/trunk/src/etc/testcases/taskdefs/rmic/rmic.xml Wed Aug 23 05:36:25 2006
@@ -108,6 +108,12 @@
<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"/>
@@ -173,6 +179,13 @@
/>
</target>
+ <target name="testExplicitClass" if="rmic.present" depends="init">
+ <base-rmic
+ compiler="org.apache.tools.ant.taskdefs.rmic.SunRmic"
+ />
+ <assertBaseCompiled/>
+ </target>
+
<target name="testWrongClass" if="rmic.present" depends="init">
<base-rmic
compiler="org.apache.tools.ant.BuildException"
@@ -249,16 +262,22 @@
<assertBaseCompiled/>
</target>
- <target name="testXnew" if="rmic6.present" depends="init">
+ <target name="testXnew" if="rmic5.present" depends="init">
<base-rmic compiler="sun">
<compilerarg value="-Xnew"/>
</base-rmic>
<assertBaseCompiled/>
</target>
- <target name="testXnewForked" if="rmic6.present" depends="init">
+ <target name="testXnewForked" if="rmic5.present" depends="init">
<base-rmic compiler="forking">
<compilerarg value="-Xnew"/>
+ </base-rmic>
+ <assertBaseCompiled/>
+ </target>
+
+ <target name="testXnewCompiler" if="rmic5.present" depends="init">
+ <base-rmic compiler="xnew">
</base-rmic>
<assertBaseCompiled/>
</target>
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/ForkingSunRmic.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/ForkingSunRmic.java?rev=434029&r1=434028&r2=434029&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/ForkingSunRmic.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/ForkingSunRmic.java Wed Aug 23 05:36:25 2006
@@ -34,6 +34,7 @@
* compiler you can have multiple copies compiling different bits of your project
* at the same time. Which, on a multi-cpu system results in significant speedups.
*
+ * Also, Java1.6 behaves oddly with -XNew, so we switch it on here if needed.
* @since ant1.7
*/
public class ForkingSunRmic extends DefaultRmicAdapter {
@@ -53,7 +54,7 @@
Commandline cmd = setupRmicCommand();
Project project = owner.getProject();
//rely on RMIC being on the path
- cmd.setExecutable(JavaEnvUtils.getJdkExecutable(SunRmic.RMIC_EXECUTABLE));
+ cmd.setExecutable(JavaEnvUtils.getJdkExecutable(getExecutableName()));
//set up the args
String[] args = cmd.getCommandline();
@@ -68,8 +69,16 @@
exe.execute();
return !exe.isFailure();
} catch (IOException exception) {
- throw new BuildException("Error running " + SunRmic.RMIC_EXECUTABLE
+ throw new BuildException("Error running " + getExecutableName()
+ " -maybe it is not on the path", exception);
}
+ }
+
+ /**
+ * Override point.
+ * @return
+ */
+ protected String getExecutableName() {
+ return SunRmic.RMIC_EXECUTABLE;
}
}
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java?rev=434029&r1=434028&r2=434029&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java Wed Aug 23 05:36:25 2006
@@ -19,7 +19,11 @@
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Rmic;
import org.apache.tools.ant.util.ClasspathUtils;
+import org.apache.tools.ant.util.JavaEnvUtils;
+
+import java.util.Locale;
/**
@@ -63,24 +67,27 @@
*/
public static RmicAdapter getRmic(String rmicType, Task task)
throws BuildException {
+ //convert to lower case in the English locale,
+ String compiler = rmicType.toLowerCase(Locale.ENGLISH);
- //handle default specially.
- if (DEFAULT_COMPILER.equalsIgnoreCase(rmicType) || rmicType.length() == 0) {
- String adapter = KaffeRmic.isAvailable()
+ //handle default specially by choosing the sun or kaffe compiler
+ if (DEFAULT_COMPILER.equals(compiler) || compiler.length() == 0) {
+ compiler = KaffeRmic.isAvailable()
? KaffeRmic.COMPILER_NAME
: SunRmic.COMPILER_NAME;
- return getRmic(adapter, task);
}
-
- if (SunRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) {
+ if (SunRmic.COMPILER_NAME.equals(compiler)) {
return new SunRmic();
- } else if (KaffeRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) {
+ } else if (KaffeRmic.COMPILER_NAME.equals(compiler)) {
return new KaffeRmic();
- } else if (WLRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) {
+ } else if (WLRmic.COMPILER_NAME.equals(compiler)) {
return new WLRmic();
- } else if (ForkingSunRmic.COMPILER_NAME.equalsIgnoreCase(rmicType)) {
+ } else if (ForkingSunRmic.COMPILER_NAME.equals(compiler)) {
return new ForkingSunRmic();
+ } else if (XNewRmic.COMPILER_NAME.equals(compiler)) {
+ return new XNewRmic();
}
+ //no match? ask for the non-lower-cased type
return resolveClassName(rmicType);
}
@@ -93,8 +100,8 @@
* isn't an instance of RmicAdapter.
*/
private static RmicAdapter resolveClassName(String className)
- throws BuildException {
- return (RmicAdapter) ClasspathUtils.newInstance(className,
- RmicAdapterFactory.class.getClassLoader(), RmicAdapter.class);
+ throws BuildException {
+ return (RmicAdapter) ClasspathUtils.newInstance(className,
+ RmicAdapterFactory.class.getClassLoader(), RmicAdapter.class);
}
}
Modified: ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java?rev=434029&r1=434028&r2=434029&view=diff
==============================================================================
--- ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java (original)
+++ ant/core/trunk/src/testcases/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java Wed Aug 23 05:36:25 2006
@@ -38,7 +38,8 @@
/**
* The JUnit setup method
*/
- public void setUp() {
+ public void setUp() throws Exception {
+ super.setUp();
configureProject(TASKDEFS_DIR + "rmic.xml");
}
@@ -113,6 +114,13 @@
}
/**
+ * load an adapter by name
+ */
+ public void testExplicitClass() throws Exception {
+ executeTarget("testExplicitClass");
+ }
+
+ /**
* A unit test for JUnit
*/
public void testWrongClass() throws Exception {
@@ -210,6 +218,15 @@
*/
public void testXnewForked() throws Exception {
executeTarget("testXnewForked");
+ }
+
+ /**
+ * test that runs the new xnew compiler adapter.
+ *
+ * @throws Exception
+ */
+ public void testXnewCompiler() throws Exception {
+ executeTarget("testXnewCompiler");
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org