blob: f1b1e5979583c6445286f4659ec9a9ee5a893ce3 [file] [log] [blame]
<?xml version="1.0"?>
<!--
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.
-->
<project name="rmic" default="teardown" basedir=".">
<property name="rmic.dir" location="." />
<property name="src.dir" location="${rmic.dir}/src"/>
<property name="build.dir" location="${rmic.dir}/build"/>
<target name="teardown">
<delete dir="${build.dir}"/>
</target>
<!-- init builds the java source -->
<target name="init" depends="probe-rmic">
<mkdir dir="${build.dir}"/>
<javac
destdir="${build.dir}"
srcdir="${src.dir}"
includes="Remote*.java">
</javac>
<presetdef name="base-rmic">
<rmic
base="${build.dir}"
verify="true"
includes="**/*.class"/>
</presetdef>
<presetdef name="rmic-bad-class">
<rmic
base="${build.dir}"
verify="false"
classname="unimplemented.class"
/>
</presetdef>
<macrodef name="assertFileCreated">
<attribute name="file" />
<sequential>
<fail>Not found : ${build.dir}/@{file}
<condition>
<not><available file="${build.dir}/@{file}"/></not>
</condition>
</fail>
</sequential>
</macrodef>
<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>
<assertFileCreated file="RemoteTimestampImpl_Stub.class" />
</sequential>
</macrodef>
<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>
<assertFileCreated file="AntTimestamp_Stub.class"/>
</sequential>
</macrodef>
<macrodef name="assertAntSkelCompiled">
<sequential>
<assertFileCreated file="AntTimestamp_Skel.class"/>
</sequential>
</macrodef>
<macrodef name="assertAntCompiled">
<sequential>
<assertAntStubCompiled />
<assertAntSkelCompiled />
</sequential>
</macrodef>
</target>
<target name="probe-rmic">
<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"/>
<available classname="java.util.ServiceLoader"/>
</and>
</condition>
</target>
<target name="testDefault" depends="init">
<base-rmic compiler="default"/>
<assertBaseCompiled/>
</target>
<target name="testEmpty" depends="init">
<base-rmic compiler=""/>
<assertBaseCompiled/>
</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">
<base-rmic compiler="sun"/>
<assertBaseCompiled/>
</target>
<target name="testRmicJArg" if="rmic.present" depends="init">
<base-rmic compiler="sun">
<compilerarg value="-J-mx256m" />
</base-rmic>
<assertBaseCompiled/>
</target>
<target name="testKaffe" if="kaffe.present" depends="init">
<base-rmic
compiler="kaffe"
/>
<assertBaseCompiled/>
</target>
<!-- weblogic.rmic doesn't work without a global CLASSPATH
<target name="testWlrmic" if="wlrmic.present" depends="init">
<base-rmic
compiler="weblogic"
/>
</target>
<target name="testWlrmicJArg" if="wlrmic.present" depends="init">
<base-rmic
compiler="weblogic"
>
<compilerarg value="-J-mx256m" />
</base-rmic>
</target>
-->
<target name="testForking" if="rmic.present" depends="init">
<base-rmic
compiler="forking"
/>
<assertBaseCompiled/>
</target>
<target name="testBadName" if="rmic.present" depends="init">
<base-rmic
compiler="no-such-compiler"
/>
</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"
/>
</target>
<target name="testNoBase" depends="init">
<rmic
verify="true"
includes="**/*.class"/>
</target>
<target name="testBaseDoesntExist" depends="init">
<rmic
base="${build.dir}/classes"
verify="true"
includes="**/*.class"/>
</target>
<target name="testBaseIsntDir" depends="init">
<rmic
base="${ant.file}"
verify="true"
includes="**/*.class"/>
</target>
<target name="testFailingAdapter" depends="init">
<base-rmic
compiler="org.apache.tools.ant.taskdefs.rmic.RmicAdvancedTest$FailingRmicAdapter"
/>
</target>
<target name="compileAntTimestamp" depends="init">
<javac
destdir="${build.dir}"
srcdir="${src.dir}"
includes="Ant*.java">
</javac>
</target>
<target name="testAntClasspath" depends="compileAntTimestamp">
<base-rmic
compiler="default"
/>
<assertAntCompiled/>
</target>
<target name="testForkingAntClasspath" if="rmic.present" depends="compileAntTimestamp">
<base-rmic
compiler="forking"
/>
<assertAntCompiled />
</target>
<target name="testDefaultBadClass" depends="init">
<rmic-bad-class compiler="default"/>
</target>
<target name="testMagicProperty" depends="init">
<property name="build.rmic" value="no-such-adapter"/>
<base-rmic
/>
</target>
<target name="testMagicPropertyOverridesEmptyString" depends="init">
<property name="build.rmic" value="no-such-adapter"/>
<base-rmic compiler=""
/>
</target>
<target name="testMagicPropertyIsEmptyString" depends="init">
<property name="build.rmic" value=""/>
<base-rmic />
<assertBaseCompiled/>
</target>
<!--
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">
<base-rmic compiler="sun">
<compilerarg value="-Xnew"/>
</base-rmic>
<assertBaseCompiled/>
</target>
<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>
<target name="testIDL" depends="init">
<base-rmic compiler="default" idl="true"/>
<assertFileCreated file="RemoteTimestamp.idl"/>
</target>
<target name="testIIOP" depends="init">
<base-rmic compiler="default" iiop="true"/>
<assertFileCreated file="_RemoteTimestamp_Stub.class"/>
<assertFileCreated file="_RemoteTimestampImpl_Tie.class"/>
</target>
</project>