root/trunk/build/buildTools/xjc.xml

Revision 3494 (checked in by douglm, 1 year ago)

Another try to avoid Windows build errors

Line 
1 <!-- ===================================================================
2      Run xjc, the JAXB compiler on a schema.
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 schema     Location of the schema
18      @param sourcedestdir     Location for the generated source
19        
20      Authors: Mike Douglass   douglm    rpi.edu
21      =================================================================== -->
22
23 <project name="do.xjc" basedir="." default="">
24   <macrodef name="xjc">
25     <attribute name="schema"/>
26     <attribute name="module-base"/>
27     <attribute name="jar-file"/>
28     <attribute name="bindingsdir" default="" />
29     <attribute name="dependencies" default="empty.fileset" />
30     <sequential>
31       <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
32      
33       <var name="sourcedestdir" value="@{module-base}/src" />
34      
35       <var name="org.bedework.schema.dir" unset="true" />
36       <dirname property="org.bedework.schema.dir" file="@{schema}"/>
37
38       <var name="org.bedework.source.changed" value="false" />
39      
40       <outofdate outputsources="org.bedework,changed.sources">
41         <sourcefiles>
42           <fileset dir="${org.bedework.schema.dir}"/>
43           <fileset refid="@{dependencies}"/>
44         </sourcefiles>
45         <targetfiles>
46           <pathelement path="@{jar-file}"/>
47         </targetfiles>
48         <sequential>
49           <var name="org.bedework.source.changed" value="true" />
50         </sequential>
51       </outofdate>
52      
53       <noisyMsg message="**** org.bedework,changed.sources = ${org.bedework,changed.sources}" />
54       <noisyMsg message="**** org.bedework.source.changed = ${org.bedework.source.changed}" />
55
56       <if>
57         <not>
58           <equals arg1="${org.bedework.source.changed}" arg2="true" />
59         </not>
60         <then>
61           <noisyMsg message="**** @{jar-file} is up to date" />
62         </then>
63         <else>
64           <noisyMsg message="**** @{jar-file} needs rebuilding" />
65
66           <delete dir="${sourcedestdir}" />
67           <mkdir dir="${sourcedestdir}" />
68      
69           <!--
70           <getJar name="jaxws-tools" version="2.2" />
71           <getJar name="jaxb-xjc" version="2.2" />
72           <getJar name="jaxws-rt" version="2.2" />
73           -->
74           <property name="xjc.lib"
75                     location="${org.bedework.temp.dir}/xjclib" />
76        
77           <if>
78             <not>
79               <available file="${xjc.lib}" />
80             </not>
81             <then>
82               <mkdir dir="${org.bedework.temp.dir}" />
83               <mkdir dir="${xjc.lib}" />
84          
85               <getJar lib="${xjc.lib}"
86                       libcache="${org.bedework.libcache.dir}"
87                       name="jaxws-tools" version="2.1.4" />
88               <getJar lib="${xjc.lib}"
89                       libcache="${org.bedework.libcache.dir}"
90                       name="jaxb-xjc" version="2.1.7" />
91               <getJar lib="${xjc.lib}"
92                       libcache="${org.bedework.libcache.dir}"
93                       name="jaxb-impl" version="2.1.8" />
94               <getJar lib="${xjc.lib}"
95                       libcache="${org.bedework.libcache.dir}"
96                       name="jaxws-rt" version="2.1.4" />
97               <getJar lib="${xjc.lib}"
98                       libcache="${org.bedework.libcache.dir}"
99                       name="streambuffer" version="1.0" />
100               <getJar lib="${xjc.lib}"
101                       libcache="${org.bedework.libcache.dir}"
102                       name="stax-ex" version="2.2.1" />
103             </then>
104           </if>
105      
106           <path id="xjc.classpath">
107             <fileset dir="${ant.home}/lib">
108               <include name="jax*.jar"/>
109             </fileset>
110             <!--
111             <pathelement location="${xjc.lib}/jaxws-tools-2.2.jar"/>
112             <pathelement location="${xjc.lib}/jaxb-xjc-2.2.jar"/>
113             <pathelement location="${xjc.lib}/jaxws-rt-2.2.jar"/>
114             -->
115             <pathelement location="${xjc.lib}/jaxws-tools-2.1.4.jar"/>
116             <pathelement location="${xjc.lib}/jaxb-xjc-2.1.7.jar"/>
117             <pathelement location="${xjc.lib}/jaxb-impl-2.1.8.jar"/>
118             <pathelement location="${xjc.lib}/jaxws-rt-2.1.4.jar"/>
119             <!--
120             <pathelement location="${xjc.lib}/tools-1.6.0_21.jar" />
121             -->
122             <pathelement location="${xjc.lib}/streambuffer-1.0.jar" />
123             <pathelement location="${xjc.lib}/stax-ex-2.2.1.jar" />
124             <fileset dir="${ant.home}/lib">
125               <include name="**/*.jar"/>
126             </fileset>
127             <!--
128             <fileset dir="${org.bedework.appserver.dir}/lib/endorsed" >
129               <include name="**/*.jar"/>
130             </fileset>
131             -->
132           </path>
133          
134           <debugCpid idpar="xjc.classpath" />
135      
136           <taskdef name="xjctask" classname="com.sun.tools.xjc.XJCTask">
137             <classpath refid="xjc.classpath" />
138           </taskdef>
139          
140           <!-- We don't want the generated classes but there doesn't appear to be a
141                way to suppress generation -->
142           <property name="xjc.dest"
143                     location="${org.bedework.temp.dir}/xjcclasses" />
144           <mkdir dir="${xjc.dest}" />
145    
146           <infoMsg message="* =========== Compiling @{schema}" />
147          
148           <if>
149             <equals arg1="@{bindingsdir}" arg2="" />
150             <then>
151               <xjctask destdir="${sourcedestdir}"
152                        schema="@{schema}" >
153               </xjctask>
154             </then>
155             <else>
156               <xjctask destdir="${sourcedestdir}"
157                        schema="@{schema}"
158                        extension="true">
159                 <binding dir="@{bindingsdir}" includes="*.xml">
160                 </binding>
161               </xjctask>
162             </else>
163           </if>
164          
165
166           <build-jar module-base="@{module-base}"
167                      jar-file="@{jar-file}" />
168         </else>
169       </if>
170     </sequential>
171   </macrodef>
172 </project>
Note: See TracBrowser for help on using the browser.