root/trunk/build/buildTools/xjc.xml

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

Some changes that didn't make it through for the last update.

In addition to the below changes to try to get a stack trace out of jsp when rendering fails.

Further changes to the build. Attempt to catch changed libraries and force a rebuild.

Also use outofdate to suppress running of apt when sources have not changed.

Minor but widespread change to remove debug parameter from a number of classes. For those debugging now depends on log4j level.

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     <sequential>
30       <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
31      
32       <var name="sourcedestdir" value="@{module-base}/src" />
33      
34       <dirname property="org.bedework.schema.dir" file="@{schema}"/>
35
36       <if>
37         <and>
38           <available file="${sourcedestdir}" type="dir" />
39           <uptodate targetfile="@{jar-file}" >
40             <srcfiles dir="${org.bedework.schema.dir}" />
41           </uptodate>
42         </and>
43         <then>
44           <noisyMsg message="**** @{jar-file} is up to date" />
45         </then>
46         <else>
47           <noisyMsg message="**** @{jar-file} needs rebuilding" />
48
49           <delete dir="${sourcedestdir}" />
50           <mkdir dir="${sourcedestdir}" />
51      
52           <!--
53           <getJar name="jaxws-tools" version="2.2" />
54           <getJar name="jaxb-xjc" version="2.2" />
55           <getJar name="jaxws-rt" version="2.2" />
56           -->
57           <property name="xjc.lib"
58                     location="${org.bedework.temp.dir}/xjclib" />
59           <mkdir dir="${org.bedework.temp.dir}" />
60           <delete dir="${xjc.lib}" />
61           <mkdir dir="${xjc.lib}" />
62          
63           <getJar lib="${xjc.lib}"
64                   libcache="${org.bedework.libcache.dir}"
65                   name="jaxws-tools" version="2.1.4" />
66           <getJar lib="${xjc.lib}"
67                   libcache="${org.bedework.libcache.dir}"
68                   name="jaxb-xjc" version="2.1.7" />
69           <getJar lib="${xjc.lib}"
70                   libcache="${org.bedework.libcache.dir}"
71                   name="jaxb-impl" version="2.1.8" />
72           <getJar lib="${xjc.lib}"
73                   libcache="${org.bedework.libcache.dir}"
74                   name="jaxws-rt" version="2.1.4" />
75           <getJar lib="${xjc.lib}"
76                   libcache="${org.bedework.libcache.dir}"
77                   name="streambuffer" version="1.0" />
78           <getJar lib="${xjc.lib}"
79                   libcache="${org.bedework.libcache.dir}"
80                   name="stax-ex" version="2.2.1" />
81      
82           <path id="xjc.classpath">
83             <fileset dir="${ant.home}/lib">
84               <include name="jax*.jar"/>
85             </fileset>
86             <!--
87             <pathelement location="${xjc.lib}/jaxws-tools-2.2.jar"/>
88             <pathelement location="${xjc.lib}/jaxb-xjc-2.2.jar"/>
89             <pathelement location="${xjc.lib}/jaxws-rt-2.2.jar"/>
90             -->
91             <pathelement location="${xjc.lib}/jaxws-tools-2.1.4.jar"/>
92             <pathelement location="${xjc.lib}/jaxb-xjc-2.1.7.jar"/>
93             <pathelement location="${xjc.lib}/jaxb-impl-2.1.8.jar"/>
94             <pathelement location="${xjc.lib}/jaxws-rt-2.1.4.jar"/>
95             <!--
96             <pathelement location="${xjc.lib}/tools-1.6.0_21.jar" />
97             -->
98             <pathelement location="${xjc.lib}/streambuffer-1.0.jar" />
99             <pathelement location="${xjc.lib}/stax-ex-2.2.1.jar" />
100             <fileset dir="${ant.home}/lib">
101               <include name="**/*.jar"/>
102             </fileset>
103             <!--
104             <fileset dir="${org.bedework.appserver.dir}/lib/endorsed" >
105               <include name="**/*.jar"/>
106             </fileset>
107             -->
108           </path>
109          
110           <debugCpid idpar="xjc.classpath" />
111      
112           <taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
113             <classpath refid="xjc.classpath" />
114           </taskdef>
115          
116           <!-- We don't want the generated classes but there doesn't appear to be a
117                way to suppress generation -->
118           <property name="xjc.dest"
119                     location="${org.bedework.temp.dir}/xjcclasses" />
120           <mkdir dir="${xjc.dest}" />
121    
122           <if>
123             <equals arg1="@{bindingsdir}" arg2="" />
124             <then>
125               <xjc destdir="${sourcedestdir}"
126                    schema="@{schema}" >
127               </xjc>
128             </then>
129             <else>
130               <xjc destdir="${sourcedestdir}"
131                    schema="@{schema}"
132                    extension="true">
133                 <binding dir="@{bindingsdir}" includes="*.xml">
134                 </binding>
135               </xjc>
136             </else>
137           </if>
138          
139
140           <build-jar module-base="@{module-base}"
141                      jar-file="@{jar-file}" />
142         </else>
143       </if>
144     </sequential>
145   </macrodef>
146 </project>
Note: See TracBrowser for help on using the browser.