bug "rmic always compiles on Java1.5" http://issues.apache.org/bugzilla/show_bug.cgi?id=33862 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277811 13f79535-47bb-0310-9956-ffa450edef68master
@@ -37,26 +37,71 @@ | |||||
<macrodef name="assertFileCreated"> | <macrodef name="assertFileCreated"> | ||||
<attribute name="file" /> | <attribute name="file" /> | ||||
<sequential> | <sequential> | ||||
<property name="file.to.find" location="${build.dir}/@{file}" /> | |||||
<available property="file.found" file="${file.to.find}"/> | |||||
<fail unless="file.found">Not found : ${file.to.find}</fail> | |||||
<fail>Not found : ${build.dir}/@{file} | |||||
<condition> | |||||
<not><available file="${build.dir}/@{file}"/></not> | |||||
</condition> | |||||
</fail> | |||||
</sequential> | </sequential> | ||||
</macrodef> | </macrodef> | ||||
<macrodef name="assertBaseCompiled"> | |||||
<macrodef name="assertFileAbsent"> | |||||
<attribute name="file" /> | |||||
<sequential> | |||||
<fail>Expected to be missing : ${build.dir}/@{file} | |||||
<condition> | |||||
<available file="${build.dir}/@{file}"/> | |||||
</condition> | |||||
</fail> | |||||
</sequential> | |||||
</macrodef> | |||||
<macrodef name="assertStubCompiled"> | |||||
<sequential> | <sequential> | ||||
<assertFileCreated file="RemoteTimestampImpl_Stub.class" /> | <assertFileCreated file="RemoteTimestampImpl_Stub.class" /> | ||||
<assertFileCreated file="RemoteTimestampImpl_Skel.class"/> | |||||
</sequential> | </sequential> | ||||
</macrodef> | </macrodef> | ||||
<macrodef name="assertAntCompiled"> | |||||
<macrodef name="assertSkelCompiled"> | |||||
<sequential> | |||||
<assertFileCreated file="RemoteTimestampImpl_Skel.class" /> | |||||
</sequential> | |||||
</macrodef> | |||||
<macrodef name="assertSkelAbsent"> | |||||
<sequential> | |||||
<assertFileAbsent file="RemoteTimestampImpl_Skel.class" /> | |||||
</sequential> | |||||
</macrodef> | |||||
<macrodef name="assertBaseCompiled"> | |||||
<sequential> | |||||
<assertStubCompiled /> | |||||
<assertSkelCompiled /> | |||||
</sequential> | |||||
</macrodef> | |||||
<macrodef name="assertAntStubCompiled"> | |||||
<sequential> | <sequential> | ||||
<assertFileCreated file="AntTimestamp_Stub.class"/> | <assertFileCreated file="AntTimestamp_Stub.class"/> | ||||
</sequential> | |||||
</macrodef> | |||||
<macrodef name="assertAntSkelCompiled"> | |||||
<sequential> | |||||
<assertFileCreated file="AntTimestamp_Skel.class"/> | <assertFileCreated file="AntTimestamp_Skel.class"/> | ||||
</sequential> | </sequential> | ||||
</macrodef> | </macrodef> | ||||
<macrodef name="assertAntCompiled"> | |||||
<sequential> | |||||
<assertAntStubCompiled /> | |||||
<assertAntSkelCompiled /> | |||||
</sequential> | |||||
</macrodef> | |||||
</target> | </target> | ||||
<target name="probe-rmic"> | <target name="probe-rmic"> | ||||
@@ -75,6 +120,22 @@ | |||||
<assertBaseCompiled/> | <assertBaseCompiled/> | ||||
</target> | </target> | ||||
<target name="testVersion11" depends="init"> | |||||
<base-rmic compiler="default" stubversion="1.1" /> | |||||
<assertBaseCompiled/> | |||||
</target> | |||||
<target name="testVersion12" depends="init"> | |||||
<base-rmic compiler="default" stubversion="1.2" /> | |||||
<assertStubCompiled/> | |||||
<assertSkelAbsent/> | |||||
</target> | |||||
<target name="testVersionCompat" depends="init"> | |||||
<base-rmic compiler="default" stubversion="compat" /> | |||||
<assertBaseCompiled/> | |||||
</target> | |||||
<target name="testRmic" if="rmic.present" depends="init"> | <target name="testRmic" if="rmic.present" depends="init"> | ||||
<base-rmic compiler="sun"/> | <base-rmic compiler="sun"/> | ||||
<assertBaseCompiled/> | <assertBaseCompiled/> | ||||
@@ -1,5 +1,5 @@ | |||||
/* | /* | ||||
* Copyright 2001-2004 The Apache Software Foundation | |||||
* Copyright 2001-2005 The Apache Software Foundation | |||||
* | * | ||||
* Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
* you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
@@ -44,6 +44,9 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { | |||||
public static final String RMI_SKEL_SUFFIX = "_Skel"; | public static final String RMI_SKEL_SUFFIX = "_Skel"; | ||||
/** suffix denoting a tie file */ | /** suffix denoting a tie file */ | ||||
public static final String RMI_TIE_SUFFIX = "_Tie"; | public static final String RMI_TIE_SUFFIX = "_Tie"; | ||||
public static final String STUB_COMPAT = "-vcompat"; | |||||
public static final String STUB_1_1 = "-v1.1"; | |||||
public static final String STUB_1_2 = "-v1.2"; | |||||
/** | /** | ||||
* Default constructor | * Default constructor | ||||
@@ -186,16 +189,24 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { | |||||
cmd.createArgument().setValue("-classpath"); | cmd.createArgument().setValue("-classpath"); | ||||
cmd.createArgument().setPath(classpath); | cmd.createArgument().setPath(classpath); | ||||
//handle the many different stub options. | |||||
String stubVersion = attributes.getStubVersion(); | String stubVersion = attributes.getStubVersion(); | ||||
//default is compatibility | |||||
String stubOption=STUB_COMPAT; | |||||
if (null != stubVersion) { | if (null != stubVersion) { | ||||
if ("1.1".equals(stubVersion)) { | if ("1.1".equals(stubVersion)) { | ||||
cmd.createArgument().setValue("-v1.1"); | |||||
stubOption = STUB_1_1; | |||||
} else if ("1.2".equals(stubVersion)) { | } else if ("1.2".equals(stubVersion)) { | ||||
cmd.createArgument().setValue("-v1.2"); | |||||
stubOption = STUB_1_2; | |||||
} else if ("compat".equals(stubVersion)) { | |||||
stubOption = STUB_COMPAT; | |||||
} else { | } else { | ||||
cmd.createArgument().setValue("-vcompat"); | |||||
//anything else | |||||
attributes.log("Unknown stub option "+stubVersion); | |||||
//do nothing with the value? or go -v+stubVersion?? | |||||
} | } | ||||
} | } | ||||
cmd.createArgument().setValue(stubOption); | |||||
if (null != attributes.getSourceBase()) { | if (null != attributes.getSourceBase()) { | ||||
cmd.createArgument().setValue("-keepgenerated"); | cmd.createArgument().setValue("-keepgenerated"); | ||||
@@ -1,5 +1,5 @@ | |||||
/* | /* | ||||
* Copyright 2004 The Apache Software Foundation | |||||
* Copyright 2004-2005 The Apache Software Foundation | |||||
* | * | ||||
* Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
* you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
@@ -92,7 +92,7 @@ public class RmicAdvancedTest extends BuildFileTest { | |||||
/** | /** | ||||
* test the forking compiler | * test the forking compiler | ||||
*/ | */ | ||||
public void NotestForkingAntClasspath() throws Exception { | |||||
public void testForkingAntClasspath() throws Exception { | |||||
executeTarget("testForkingAntClasspath"); | executeTarget("testForkingAntClasspath"); | ||||
} | } | ||||
@@ -154,7 +154,7 @@ public class RmicAdvancedTest extends BuildFileTest { | |||||
/** | /** | ||||
* test the forking compiler | |||||
* | |||||
*/ | */ | ||||
public void testMagicPropertyIsEmptyString() throws Exception { | public void testMagicPropertyIsEmptyString() throws Exception { | ||||
executeTarget("testMagicPropertyIsEmptyString"); | executeTarget("testMagicPropertyIsEmptyString"); | ||||
@@ -168,6 +168,32 @@ public class RmicAdvancedTest extends BuildFileTest { | |||||
} | } | ||||
/** | |||||
* test that version 1.1 stubs are good | |||||
* @throws Exception | |||||
*/ | |||||
public void testVersion11() throws Exception { | |||||
executeTarget("testVersion11"); | |||||
} | |||||
/** | |||||
* test that version 1.2 stubs are good | |||||
* | |||||
* @throws Exception | |||||
*/ | |||||
public void testVersion12() throws Exception { | |||||
executeTarget("testVersion12"); | |||||
} | |||||
/** | |||||
* test that version compat stubs are good | |||||
* | |||||
* @throws Exception | |||||
*/ | |||||
public void testVersionCompat() throws Exception { | |||||
executeTarget("testVersionCompat"); | |||||
} | |||||
/** | /** | ||||
* this little bunny verifies that we can load stuff, and that | * this little bunny verifies that we can load stuff, and that | ||||
* a failure to execute is turned into a fault | * a failure to execute is turned into a fault | ||||