Salome HOME
Readers section is improved.
[tools/siman.git] / Workspace / Siman-Stub / build.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <project basedir="." default="jar.client" name="SIMAN Web Services Client Stub and tests">
3     <!--Auto generated ant build file-->
4     <property environment="env"/>
5     <property file="build.properties" description="set the build parameters"/>
6     <!--    <property name="axis2.home" value="${env.AXIS2_HOME}"/> -->
7     <property name="axis2.home" value="${axis2.home.dir}"/>
8     <property name="project.base.dir" value="."/>
9     <property name="maven.class.path" value=""/>
10     <property name="name" value="${siman-stub.ws}"/>
11     <property name="src" value="${project.base.dir}/src"/>
12     <property name="test" value="${project.base.dir}/test"/>
13     <property name="build" value="${project.base.dir}/build"/>
14     <property name="classes" value="${build}/classes"/>
15     <property name="lib" value="${build}/lib"/>
16     <property name="resources" value="${project.base.dir}/resources"/>
17     <property name="jars.ok" value=""/>
18     <path id="axis2.class.path">
19         <pathelement path="${java.class.path}"/>
20         <pathelement path="${maven.class.path}"/>
21         <fileset dir="${axis2.home}">
22             <include name="lib/*.jar"/>
23         </fileset>
24     </path>
25     <target name="init">
26         <mkdir dir="${build}"/>
27         <mkdir dir="${classes}"/>
28         <mkdir dir="${lib}"/>
29         <mkdir dir="${siman-stub.dist.dir}"/>
30         <mkdir dir="${test}"/>
31     </target>
32     <target name="pre.compile.test" depends="init">
33         <!--Test the classpath for the availability of necesary classes-->
34         <available classname="javax.xml.stream.XMLStreamReader" property="stax.available" classpathref="axis2.class.path"/>
35         <available classname="org.apache.axis2.engine.AxisEngine" property="axis2.available" classpathref="axis2.class.path"/>
36         <condition property="jars.ok">
37             <and>
38                 <isset property="stax.available"/>
39                 <isset property="axis2.available"/>
40             </and>
41         </condition>
42         <!--Print out the availabilities-->
43         <echo message="Stax Availability= ${stax.available}"/>
44         <echo message="Axis2 Availability= ${axis2.available}"/>
45     </target>
46     <target name="compile.src" depends="pre.compile.test" if="jars.ok">
47         <javac fork="true" memoryInitialSize="256m" memoryMaximumSize="256m" debug="on" destdir="${classes}" srcdir="${src}">
48             <classpath refid="axis2.class.path"/>
49         </javac>
50     </target>
51     <target name="compile.test" depends="compile.src" if="jars.ok">
52         <javac fork="true" memoryInitialSize="256m" memoryMaximumSize="256m" debug="on" destdir="${classes}">
53             <src path="${test}"/>
54             <classpath refid="axis2.class.path"/>
55         </javac>
56     </target>
57     <target name="echo.classpath.problem" depends="pre.compile.test" unless="jars.ok">
58         <echo message="The class path is not set right!                                Please make sure the following classes are in the classpath                                1. XmlBeans                                2. Stax                                3. Axis2                 "/>
59     </target>
60     <target name="jar.all" depends="jar.server, jar.client"/>
61     <target name="jar.server" depends="compile.src,echo.classpath.problem" if="jars.ok">
62         <copy toDir="${classes}/META-INF" failonerror="false">
63             <fileset dir="${resources}">
64                 <include name="*.xml"/>
65                 <include name="*.wsdl"/>
66                 <include name="*.xsd"/>
67             </fileset>
68         </copy>
69         <jar destfile="${lib}/${name}.aar">
70             <fileset excludes="**/Test.class" dir="${classes}"/>
71         </jar>
72     </target>
73     <target name="jar.client" if="jars.ok" depends="compile.test">
74         <jar destfile="${lib}/${siman-stub.jarname}">
75             <fileset dir="${classes}">
76                 <exclude name="**/META-INF/*.*"/>
77                 <exclude name="**/lib/*.*"/>
78                 <exclude name="**/*MessageReceiver.class"/>
79                 <exclude name="**/*Skeleton.class"/>
80                 <!--                
81                 <exclude name="**/org/splat/ws_server/**"/> 
82 -->
83             </fileset>
84         </jar>
85         <copy file="${lib}/${siman-stub.jarname}" toDir="${siman-stub.dist.dir}"/>
86     </target>
87     <target name="make.repo" depends="jar.server" if="jars.ok">
88         <mkdir dir="${build}/repo/"/>
89         <mkdir dir="${build}/repo/services"/>
90         <copy file="${build}/lib/${name}.aar" toDir="${build}/repo/services/"/>
91     </target>
92     <target name="start.server" depends="make.repo" if="jars.ok">
93         <java classname="org.apache.axis2.transport.http.SimpleHTTPServer" fork="true">
94             <arg value="${build}/repo"/>
95             <classpath refid="axis2.class.path"/>
96         </java>
97     </target>
98     <target name="run.test" depends="compile.test" if="jars.ok">
99         <path id="test.class.path">
100             <pathelement location="${siman-stub.dist.dir}/${siman-stub.jarname}"/>
101             <path refid="axis2.class.path"/>
102             <pathelement location="${classes}"/>
103         </path>
104         <mkdir dir="${build}/test-reports/"/>
105         <junit printsummary="yes" haltonfailure="yes">
106             <classpath refid="test.class.path"/>
107             <formatter type="plain"/>
108             <batchtest fork="yes" toDir="${build}/test-reports/">
109                 <fileset dir="${test}">
110                     <include name="**/*Test*.java"/>
111                 </fileset>
112             </batchtest>
113         </junit>
114     </target>
115     <target name="clean">
116         <delete dir="${build}"/>
117         <delete dir="${siman-stub.dist.dir}"/>
118     </target>
119 </project>