root/trunk/build/buildTools/wsimport.xml

Revision 3113 (checked in by douglm, 2 years ago)

Changes to allow conditional building of schema based classes - otherwise we always rebuild everything.

Line 
1 <!-- ===================================================================
2      Run wsimport on web service definitions.
3      
4      The jaxb released with java6 is version 2.1. However, to resolve some
5      issues we have to use version 2.2. This requires either placing the
6      jaxb jars in the endorsed directory or setting xendorsed="true" when
7      running wsimport and adding the 2.2 jars to the classpath.
8      
9      The version of jboss in the quickstart has the 2.2 jars in its
10      endorsed directory. For the moment we point at that.
11      
12      Hold that: Unfortunately eclipse doesn't appear to have a way to set
13      an endorsed directory for a single project. The generated 2.2 classes
14      don't compile. Managed to get 2.1 wsimport to run - the generated code
15      appears to run OK on 2.2
16      
17      @param wsdl     Location of the wsdl
18      @param sourcedestdir     Location for the generated source
19        
20      Authors: Mike Douglass   douglm    rpi.edu
21      =================================================================== -->
22
23 <project name="do.wsimport" basedir="." default="">
24   <macrodef name="wsimport">
25     <attribute name="wsdl"/>
26     <attribute name="module-base"/>
27     <attribute name="jar-file"/>
28     <attribute name="bindingsdir" default="" />
29     <sequential>
30       <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
31      
32       <property name="sourcedestdir" location="@{module-base}/src" />
33
34      
35       <dirname property="org.bedework.wsdl.dir" file="@{wsdl}"/>
36
37       <if>
38         <available file="${sourcedestdir}" type="dir" />
39         <then>
40           <uptodate property="org.bedework.wsimport.uptodate"
41                     targetfile="@{jar-file}" >
42             <srcfiles dir="${org.bedework.wsdl.dir}" />
43           </uptodate>
44         </then>
45       </if>
46
47       <if>
48         <isset property="org.bedework.wsimport.uptodate"/>
49         <then>
50           <noisyMsg message="**** @{jar.file} is up to date" />
51         </then>
52         <else>
53           <noisyMsg message="**** @{jar.file} needs rebuilding" />
54
55           <delete dir="${sourcedestdir}" />
56           <mkdir dir="${sourcedestdir}" />
57      
58           <!--
59           <getJar name="jaxws-tools" version="2.2" />
60           <getJar name="jaxb-xjc" version="2.2" />
61           <getJar name="jaxws-rt" version="2.2" />
62           -->
63           <property name="wsimport.lib"
64                     location="${org.bedework.temp.dir}/wsimportlib" />
65           <delete dir="${wsimport.lib}" />
66           <mkdir dir="${wsimport.lib}" />
67          
68           <getJar lib="${wsimport.lib}"
69                   libcache="${org.bedework.libcache.dir}"
70                   name="jaxws-tools" version="2.1.4" />
71           <getJar lib="${wsimport.lib}"
72                   libcache="${org.bedework.libcache.dir}"
73                   name="jaxb-xjc" version="2.1.7" />
74           <getJar lib="${wsimport.lib}"
75                   libcache="${org.bedework.libcache.dir}"
76                   name="jaxb-impl" version="2.1.8" />
77           <getJar lib="${wsimport.lib}"
78                   libcache="${org.bedework.libcache.dir}"
79                   name="jaxws-rt" version="2.1.4" />
80           <getJar lib="${wsimport.lib}"
81                   libcache="${org.bedework.libcache.dir}"
82                   name="streambuffer" version="1.0" />
83           <getJar lib="${wsimport.lib}"
84                   libcache="${org.bedework.libcache.dir}"
85                   name="stax-ex" version="2.2.1" />
86      
87           <path id="wsimport.classpath">
88             <fileset dir="${ant.home}/lib">
89               <include name="jax*.jar"/>
90             </fileset>
91             <!--
92             <pathelement location="${wsimport.lib}/jaxws-tools-2.2.jar"/>
93             <pathelement location="${wsimport.lib}/jaxb-xjc-2.2.jar"/>
94             <pathelement location="${wsimport.lib}/jaxws-rt-2.2.jar"/>
95             -->
96             <pathelement location="${wsimport.lib}/jaxws-tools-2.1.4.jar"/>
97             <pathelement location="${wsimport.lib}/jaxb-xjc-2.1.7.jar"/>
98             <pathelement location="${wsimport.lib}/jaxb-impl-2.1.8.jar"/>
99             <pathelement location="${wsimport.lib}/jaxws-rt-2.1.4.jar"/>
100             <pathelement location="${wsimport.lib}/tools-1.6.0_21.jar" />
101             <pathelement location="${wsimport.lib}/streambuffer-1.0.jar" />
102             <pathelement location="${wsimport.lib}/stax-ex-2.2.1.jar" />
103             <fileset dir="${ant.home}/lib">
104               <include name="**/*.jar"/>
105             </fileset>
106             <!--
107             <fileset dir="${org.bedework.appserver.dir}/lib/endorsed" >
108               <include name="**/*.jar"/>
109             </fileset>
110             -->
111           </path>
112          
113           <debugCpid idpar="wsimport.classpath" />
114      
115           <taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
116             <classpath refid="wsimport.classpath" />
117           </taskdef>
118          
119           <!-- We don't want the generated classes but there doesn't appear to be a
120                way to suppress generation -->
121           <property name="wsimport.dest"
122                     location="${org.bedework.temp.dir}/wsclasses" />
123           <mkdir dir="${wsimport.dest}" />
124    
125           <if>
126             <equals arg1="@{bindingsdir}" arg2="" />
127             <then>
128               <wsimport keep="true"
129                         sourcedestdir="${sourcedestdir}"
130                         destdir="${wsimport.dest}"
131                         wsdl="@{wsdl}"
132                         xendorsed="true" >
133               </wsimport>
134             </then>
135             <else>
136               <wsimport keep="true"
137                         sourcedestdir="${sourcedestdir}"
138                         destdir="${wsimport.dest}"
139                         wsdl="@{wsdl}"
140                         xendorsed="true" >
141                 <binding dir="@{bindingsdir}" includes="*.xml">
142                 </binding>
143               </wsimport>
144             </else>
145           </if>
146          
147
148           <build-jar module-base="@{module-base}"
149                      jar-file="@{jar-file}" />
150         </else>
151       </if>
152     </sequential>
153   </macrodef>
154 </project>
Note: See TracBrowser for help on using the browser.