/[volute]/trunk/projects/theory/snapdm/build_java.xml
ViewVC logotype

Contents of /trunk/projects/theory/snapdm/build_java.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 465 - (show annotations)
Mon May 12 16:19:59 2008 UTC (12 years, 6 months ago) by bourges.laurent
File MIME type: text/xml
File size: 12370 byte(s)
- updated build
- update jdbc jpa
- identity class in MetaDataObject
- javadoc moved to /dist/doc
1 <!--
2 build_java.xml file : specific targets for java code
3 -->
4 <property name="jalopyConvention" location="${libs}/ant/jalopy-java-laurent.xml" />
5
6 <!-- class paths for base classes -->
7 <!-- apache logging + Log4J -->
8 <!-- eclipselink JPA 1.0 reference implementation -->
9 <!-- JAXB 2.16 reference implementation -->
10 <path id="project.class.path">
11 <pathelement location="${libs}/commons-logging-1.1.jar" />
12 <pathelement location="${libs}/commons-httpclient-3.1.jar" />
13 <pathelement location="${libs}/log4j-1.2.15.jar" />
14 <pathelement location="${libs}/eclipselink.jar" />
15 <pathelement location="${libs}/persistence.jar" />
16 <pathelement location="${libs}/jaxb-api-2.1.jar" />
17 <pathelement location="${libs}/jaxb-impl-2.1.6.jar" />
18 <pathelement location="${libs}/jaxb-xjc-2.1.6.jar" />
19 </path>
20
21 <!-- class paths for generated classes -->
22 <path id="infrastructure.class.path">
23 <path refid="project.class.path" />
24 <pathelement location="${dist}/${build.file}" />
25 <pathelement location="${libs}/jdbc/postgresql-8.3-603.jdbc3.jar" />
26 <pathelement location="${libs}/jdbc/sqljdbc-2005-1.2.jar" />
27 </path>
28
29 <!-- class paths for runtime -->
30 <path id="runtime.class.path">
31 <pathelement location="${dist}/${build.file}" />
32 <pathelement location="${dist}/${build.gen.file}" />
33 <pathelement path="${properties}" />
34 </path>
35
36
37 <!-- checks if build is necessary : java source code & libraries -->
38 <uptodate property="build.base.notRequired">
39 <srcfiles dir= "${root}" includes="build.properties"/>
40 <srcfiles dir= "${sources}" includes="**/*"/>
41 <srcfiles dir= "${libs}" includes="**/*.jar"/>
42 <mapper type="merge" to="${dist}/${build.file}"/>
43 </uptodate>
44
45
46 <!-- defines Jalopy task -->
47 <taskdef name="jalopy"
48 classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
49 <classpath>
50 <pathelement location="${libs}/ant/jalopy.jar" />
51 <pathelement location="${libs}/ant/jalopy-ant.jar" />
52 <pathelement location="${libs}/log4j-1.2.15.jar"/>
53 </classpath>
54 </taskdef>
55
56
57
58
59 <!-- target cleanJava : clean build files -->
60 <target name="cleanJava" depends="init, cleanDist">
61 <echo>cleaning directory : ${build} ...</echo>
62
63 <delete includeemptydirs="false" verbose="true">
64 <fileset dir="${build}">
65 <exclude name="*.jdbc" />
66 </fileset>
67 </delete>
68
69 <echo>cleaned directory : ${build} : done.</echo>
70 </target>
71
72
73
74
75 <!-- target cleanDist : clean build files -->
76 <target name="cleanDist" depends="init">
77 <echo>cleaning directory : ${dist} ...</echo>
78
79 <delete includeemptydirs="false" verbose="true">
80 <fileset dir="${dist}">
81 <exclude name="doc/**/*" />
82 </fileset>
83 </delete>
84
85 <echo>cleaned directory : ${dist} : done.</echo>
86 </target>
87
88
89
90
91
92 <!-- compiles java files and jar them and compiles MetaModel generated by JAXB 2.1 -->
93 <target name="compile" depends="cleanJava">
94 <echo>compile ${base.title} ...</echo>
95 <echo>compile from : ${sources}</echo>
96 <echo>compile to : ${build.src}</echo>
97
98 <mkdir dir="${build.src}"/>
99
100 <copy verbose="true" todir="${build.src}" preservelastmodified="true">
101 <fileset file="${output}/${snap_source_intermediate}" />
102 </copy>
103
104 <!-- adds namespace to intermediateModel instance with m: prefix -->
105 <replace file="${build.src}/${snap_source_intermediate}" encoding="UTF-8">
106 <replacetoken>&lt;model</replacetoken>
107 <replacevalue>
108 &lt;m:model xmlns:m="http://ivoa.org/theory/datamodel/generationmetadata/v0.1"
109 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
110 xsi:schemaLocation="http://ivoa.org/theory/datamodel/generationmetadata/v0.1 http://volute.googlecode.com/svn/trunk/projects/theory/snapdm/input/intermediateModel.xsd"</replacevalue>
111 </replace>
112 <replace file="${build.src}/${snap_source_intermediate}" encoding="UTF-8">
113 <replacetoken>&lt;/model</replacetoken>
114 <replacevalue>&lt;/m:model</replacevalue>
115 </replace>
116
117 <javac sourcepath="" srcdir="${sources}" destdir="${build.src}" listfiles="false"
118 fork="true" verbose="false" encoding="UTF-8"
119 debug="on" deprecation="on" optimize="on" casesensitive="true"
120 source="1.5" target="1.5">
121
122 <classpath refid="project.class.path" />
123
124 <include name="**/*.java"/>
125 </javac>
126
127 <pathconvert pathsep=" " property="jar.classpath">
128 <path refid="project.class.path"/>
129 <map from="${root}${file.separator}" to="..${file.separator}"/>
130 </pathconvert>
131
132 <jar jarfile="${dist}/${build.file}" compress="true">
133 <fileset dir="${build.src}" />
134 <fileset dir="${properties}">
135 <include name="global.properties"/>
136 <include name="log4j.*"/>
137 </fileset>
138
139 <manifest>
140 <attribute name="Built-By" value="${build.by}"/>
141 <attribute name="Built-Date" value="${build.date}"/>
142
143 <attribute name="Build-Jdk" value="${java.vm.version}"/>
144 <attribute name="Build-Os" value="${os.name} ${os.version} - ${os.arch}"/>
145
146 <attribute name="Class-Path" value="${jar.classpath}"/>
147
148 <section name="Common">
149 <attribute name="Specification-Title" value="${base.title}"/>
150 <attribute name="Specification-Version" value="${version}"/>
151 <attribute name="Specification-Vendor" value="${vendor}"/>
152 <attribute name="Implementation-Title" value="${base.title}"/>
153 <attribute name="Implementation-Version" value="${version} - ${build.date}"/>
154 </section>
155 </manifest>
156
157 </jar>
158
159 <delete dir="${build.src}"/>
160
161 <echo>compile ${base.title} : done.</echo>
162 </target>
163
164
165
166
167 <!-- target makeOutput : compiles generated java code and javadoc -->
168 <target name="makeOutput" depends="compile, compileOutput, format, compileTest, makeJavaDoc">
169 <echo>makeOutput : done.</echo>
170 </target>
171
172
173
174
175 <!-- Compile generated java files -->
176 <target name="compileOutput">
177 <echo>compile ${gen.title} ...</echo>
178 <echo>compile from : ${sources.gen}/src</echo>
179 <echo>compile to : ${build.gen}</echo>
180
181 <mkdir dir="${build.gen}"/>
182
183 <javac sourcepath="" srcdir="${sources.gen}/src" destdir="${build.gen}" listfiles="false"
184 fork="true" verbose="false" encoding="UTF-8"
185 debug="on" deprecation="on" optimize="on" casesensitive="true"
186 source="1.5" target="1.5">
187
188 <classpath refid="infrastructure.class.path" />
189
190 <include name="**/*.java"/>
191 </javac>
192
193 <pathconvert pathsep=" " property="jar.gen.classpath">
194 <path refid="infrastructure.class.path"/>
195 <map from="${root}${file.separator}" to="..${file.separator}"/>
196 </pathconvert>
197
198 <jar jarfile="${dist}/${build.gen.file}" compress="true">
199 <fileset dir="${build.gen}" />
200 <fileset dir="${outputJava}">
201 <include name="META-INF/persistence.xml" />
202 </fileset>
203
204 <manifest>
205 <attribute name="Built-By" value="${build.by}"/>
206 <attribute name="Built-Date" value="${build.date}"/>
207
208 <attribute name="Build-Jdk" value="${java.vm.version}"/>
209 <attribute name="Build-Os" value="${os.name} ${os.version} - ${os.arch}"/>
210
211 <attribute name="Class-Path" value="${jar.gen.classpath}"/>
212
213 <section name="Common">
214 <attribute name="Specification-Title" value="${gen.title}"/>
215 <attribute name="Specification-Version" value="${version}"/>
216 <attribute name="Specification-Vendor" value="${vendor}"/>
217 <attribute name="Implementation-Title" value="${gen.title}"/>
218 <attribute name="Implementation-Version" value="${version} - ${build.date}"/>
219 </section>
220 </manifest>
221
222 </jar>
223
224 <!-- remove to avoid classes in svn -->
225 <delete dir="${build.gen}"/>
226
227 <echo>compile ${gen.title} : done.</echo>
228 </target>
229
230
231
232
233 <!-- target makeJavaDoc : creates javadoc from source code -->
234 <target name="makeJavaDoc">
235 <echo>making generated Java classes javadoc ...</echo>
236
237 <mkdir dir="${javadoc}"/>
238
239 <javadoc additionalparam="-notimestamp"
240 destdir="${javadoc}"
241 access="private"
242 author="true"
243 encoding="UTF-8"
244 source="1.5"
245 use="true"
246 windowtitle="${source} : ${gen.title}" >
247
248 <classpath>
249 <path refid="project.class.path" />
250 </classpath>
251
252 <fileset dir="${sources}">
253 <include name="**/*.java"/>
254 </fileset>
255 <fileset dir="${sources.gen}/src">
256 <include name="**/*.java"/>
257 </fileset>
258 <fileset dir="${sources.test}">
259 <include name="**/*.java"/>
260 </fileset>
261
262 </javadoc>
263
264 <echo>generated Java classes javadoc : done.</echo>
265 </target>
266
267
268
269
270 <!-- target format : formats all generated java sources -->
271 <target name="format">
272 <!--
273 Invokes Jalopy as follows:
274
275 - All formatted files will have unix fileformat (\n)
276 - Load your code convention from the given url
277 - Override the convention to use loglevel "info"
278 - Override the convention to use 2 threads
279 - The import optimization feature will work (if enabled in the active
280 convention), because a classpath reference is specified
281
282 Don't forget to setup an include pattern as Jalopy truly expects
283 valid Java source files as input!
284 -->
285 <jalopy fileformat="unix"
286 convention="${jalopyConvention}"
287 encoding="UTF-8"
288 failonerror="false"
289 history="NONE"
290 loglevel="warn"
291 threads="1"
292 classpathref="infrastructure.class.path">
293 <fileset dir="${sources.gen}/src">
294 <include name="**/*.java" />
295 </fileset>
296 </jalopy>
297 </target>
298
299
300
301
302 <!-- Compile Unit Tests -->
303 <target name="compileTest">
304 <echo>compile tests ...</echo>
305 <echo>compile from : ${sources.test}</echo>
306 <echo>compile to : ${build.test}</echo>
307
308 <mkdir dir="${build.test}"/>
309
310 <javac sourcepath="" srcdir="${sources.test}" destdir="${build.test}" listfiles="false"
311 fork="true" verbose="false" encoding="UTF-8"
312 debug="on" deprecation="on" optimize="on" casesensitive="true"
313 source="1.5" target="1.5">
314
315 <classpath refid="runtime.class.path" />
316
317 <include name="**/*.java"/>
318 </javac>
319
320 <pathconvert pathsep=" " property="jar.test.classpath">
321 <path refid="runtime.class.path"/>
322 <map from="${root}${file.separator}" to="..${file.separator}"/>
323 </pathconvert>
324
325 <jar jarfile="${dist}/${build.test.file}" compress="true">
326 <fileset dir="${build.test}" />
327
328 <manifest>
329 <attribute name="Built-By" value="${build.by}"/>
330 <attribute name="Built-Date" value="${build.date}"/>
331
332 <attribute name="Build-Jdk" value="${java.vm.version}"/>
333 <attribute name="Build-Os" value="${os.name} ${os.version} - ${os.arch}"/>
334
335 <attribute name="Class-Path" value="${build.file} ${build.gen.file} ${build.meta.gen.file} ../properties/"/>
336
337 <attribute name="Main-Class" value="org.ivoa.test.Main"/>
338
339 <section name="Common">
340 <attribute name="Specification-Title" value="${gen.title}"/>
341 <attribute name="Specification-Version" value="${version}"/>
342 <attribute name="Specification-Vendor" value="${vendor}"/>
343 <attribute name="Implementation-Title" value="${gen.title}"/>
344 <attribute name="Implementation-Version" value="${version} - ${build.date}"/>
345 </section>
346 </manifest>
347
348 </jar>
349
350 <!-- remove to avoid classes in svn -->
351 <delete dir="${build.test}"/>
352
353 <echo>compile tests : done.</echo>
354 </target>
355
356
357
358
359 <!-- target run : launches deployed application on Unix environment (bash used) -->
360 <target name="run">
361 <echo message="running ${gen.title} ..."/>
362
363 <delete file="${build}/root.log" />
364
365 <java jar="${dist}/${build.test.file}" dir="${build}" fork="true" failonerror="true">
366 <jvmarg value="-Xms64m"/>
367 <jvmarg value="-Xmx256m"/>
368 <!-- eclipse weaving support -->
369 <jvmarg value="-javaagent:../libs/eclipselink.jar"/>
370
371 </java>
372
373 <echo message="run ${gen.title} : terminated."/>
374 </target>
375
376
377 <!-- end of build_java.xml -->

msdemlei@ari.uni-heidelberg.de
ViewVC Help
Powered by ViewVC 1.1.26