/[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 646 - (show annotations)
Mon Jun 30 10:45:22 2008 UTC (12 years, 4 months ago) by bourges.laurent
File MIME type: text/xml
File size: 15440 byte(s)
- updated uptodate conditions
- removed regexp on DDL scripts
- added windows fix for classpath.flat
1 <!--
2 build_java.xml file : specific targets for java code
3 -->
4
5 <!-- jalopy code formatter configuration -->
6 <property name="jalopyConvention" location="${libs}/ant/jalopy-java-laurent.xml" />
7
8
9 <!-- classpath for base module -->
10 <!-- class paths for base classes -->
11 <!-- apache logging + Log4J -->
12 <!-- eclipselink JPA 1.0 reference implementation -->
13 <!-- JAXB 2.1.6 reference implementation -->
14 <path id="project.class.path">
15 <pathelement location="${libs}/commons-logging-1.1.jar" />
16 <pathelement location="${libs}/log4j-1.2.15.jar" />
17 <pathelement location="${libs}/commons-httpclient-3.1.jar" />
18 <!-- jaxb 2.1.6 RI -->
19 <pathelement location="${libs}/jaxb-api-2.1.jar" />
20 <pathelement location="${libs}/jaxb-impl-2.1.6.jar" />
21 <pathelement location="${libs}/jaxb-xjc-2.1.6.jar" />
22 <!-- jaxb 2.1.6 RI dependencies -->
23 <pathelement location="${libs}/activation.jar" />
24 <pathelement location="${libs}/jsr173_1.0_api.jar" />
25 <!-- eclipselink 1.0M8 -->
26 <pathelement location="${libs}/eclipselink.jar" />
27 <pathelement location="${libs}/javax.persistence_1.0.0.jar" />
28 </path>
29
30 <!-- class paths for generated classes -->
31 <path id="infrastructure.class.path">
32 <pathelement location="${dist}/${build.file}" />
33 <path refid="jdbc-drivers.class.path" />
34 </path>
35
36 <!-- class paths for runtime -->
37 <path id="runtime.class.path">
38 <pathelement location="${dist}/${build.file}" />
39 <!-- dynamic weaving -->
40 <pathelement location="${dist}/${build.gen.file}" />
41 <!-- static weaving -->
42 <!-- <pathelement location="${dist}/${build.gen.weave.file}" /> -->
43 <pathelement path="${properties}" />
44 </path>
45
46
47 <!-- up to date checks -->
48
49 <!-- checks if build is necessary : java source code & libraries -->
50 <uptodate property="build.base.notRequired">
51 <srcfiles dir= "${root}" includes="build.properties"/>
52 <srcfiles dir= "${sources}" includes="**/*"/>
53 <srcfiles dir= "${libs}" includes="**/*.jar"/>
54 <mapper type="merge" to="${dist}/${build.file}"/>
55 </uptodate>
56
57
58 <!-- presets -->
59
60 <!-- defines Jalopy task -->
61 <taskdef name="jalopy"
62 classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
63 <classpath>
64 <pathelement location="${libs}/ant/jalopy.jar" />
65 <pathelement location="${libs}/ant/jalopy-ant.jar" />
66 <pathelement location="${libs}/log4j-1.2.15.jar"/>
67 </classpath>
68 </taskdef>
69
70 <!-- defines eclipselink static weaving task -->
71 <taskdef name="weave" classname="org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask">
72 <classpath>
73 <pathelement location="${libs}/eclipselink.jar" />
74 <pathelement location="${libs}/javax.persistence_1.0.0.jar" />
75 </classpath>
76 </taskdef>
77
78
79
80 <!-- targets -->
81
82 <!-- target cleanJava : clean build files -->
83 <target name="cleanJava" depends="cleanDist">
84 <echo>cleaning directory : ${build} ...</echo>
85
86 <delete includeemptydirs="false" verbose="true">
87 <fileset dir="${build}">
88 <exclude name="*.jdbc" />
89 </fileset>
90 </delete>
91
92 <echo>cleaned directory : ${build} : done.</echo>
93 </target>
94
95
96
97
98 <!-- target cleanDist : clean build files -->
99 <target name="cleanDist">
100 <echo>cleaning directory : ${dist} ...</echo>
101
102 <delete includeemptydirs="false" verbose="true">
103 <fileset dir="${dist}">
104 <exclude name="doc/**/*" />
105 </fileset>
106 </delete>
107
108 <echo>cleaned directory : ${dist} : done.</echo>
109 </target>
110
111
112
113
114
115 <!-- compiles java files and jar them and compiles MetaModel generated by JAXB 2.1 -->
116 <target name="compile" depends="cleanJava">
117 <echo>compile ${base.title} ...</echo>
118 <echo>compile from : ${sources}</echo>
119 <echo>compile to : ${build.src}</echo>
120
121 <mkdir dir="${build.src}"/>
122
123 <javac sourcepath="" srcdir="${sources}" destdir="${build.src}" listfiles="false"
124 fork="true" verbose="false" encoding="UTF-8"
125 debug="on" deprecation="on" optimize="on" casesensitive="true"
126 source="1.5" target="1.5">
127
128 <classpath refid="project.class.path" />
129
130 <include name="**/*.java"/>
131 </javac>
132
133 <pathconvert pathsep=" " property="jar.classpath">
134 <path refid="project.class.path"/>
135 <map from="${root}${file.separator}" to="..${file.separator}"/>
136 </pathconvert>
137
138 <pathconvert property="jar.classpath.flat" dirsep="/">
139 <path refid="project.class.path"/>
140 </pathconvert>
141
142 <!-- write a flattened classpath -->
143 <echo file="${dist}/${build.file}.classpath">module.classpath=${jar.classpath.flat}</echo>
144
145 <jar jarfile="${dist}/${build.file}" compress="true" roundup="true">
146 <fileset dir="${build.src}" />
147 <fileset dir="${properties}">
148 <include name="global.properties"/>
149 <include name="log4j.*"/>
150 </fileset>
151 <fileset dir="${sources}">
152 <include name="**/jaxb.index" />
153 </fileset>
154
155 <manifest>
156 <attribute name="Built-By" value="${build.by}"/>
157 <attribute name="Built-Date" value="${build.date}"/>
158
159 <attribute name="Build-Jdk" value="${java.vm.version}"/>
160 <attribute name="Build-Os" value="${os.name} ${os.version} - ${os.arch}"/>
161
162 <attribute name="Class-Path" value="${jar.classpath}"/>
163
164 <section name="Common">
165 <attribute name="Specification-Title" value="${base.title}"/>
166 <attribute name="Specification-Version" value="${version}"/>
167 <attribute name="Specification-Vendor" value="${vendor}"/>
168 <attribute name="Implementation-Title" value="${base.title}"/>
169 <attribute name="Implementation-Version" value="${version} - ${build.date}"/>
170 </section>
171 </manifest>
172
173 </jar>
174
175 <delete dir="${build.src}"/>
176
177 <echo>compile ${base.title} : done.</echo>
178 </target>
179
180
181
182
183 <!-- target makeOutput : compiles generated java code and javadoc : -->
184 <target name="makeOutput" depends="compile, compileOutput, format, weaving, compileTest, makeJavaDoc">
185 <echo>makeOutput : done.</echo>
186 </target>
187
188
189
190
191 <!-- Compile generated java files -->
192 <target name="compileOutput">
193 <echo>compile ${gen.title} ...</echo>
194 <echo>compile from : ${sources.gen}/src</echo>
195 <echo>compile to : ${build.gen}</echo>
196
197 <mkdir dir="${build.gen}"/>
198
199 <!-- jar includes intermediate model instance -->
200 <copy verbose="true" todir="${build.gen}" preservelastmodified="true">
201 <fileset file="${output}/${source_intermediate}" />
202 </copy>
203
204 <!-- adds namespace to intermediateModel instance with m: prefix -->
205 <replace file="${build.gen}/${source_intermediate}" encoding="UTF-8">
206 <replacetoken>&lt;model</replacetoken>
207 <replacevalue>
208 &lt;m:model xmlns:m="http://ivoa.org/theory/datamodel/generationmetadata/v0.1"
209 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
210 xsi:schemaLocation="http://ivoa.org/theory/datamodel/generationmetadata/v0.1 http://volute.googlecode.com/svn/trunk/projects/theory/snapdm/input/intermediateModel.xsd"</replacevalue>
211 </replace>
212 <replace file="${build.gen}/${source_intermediate}" encoding="UTF-8">
213 <replacetoken>&lt;/model</replacetoken>
214 <replacevalue>&lt;/m:model</replacevalue>
215 </replace>
216
217 <javac sourcepath="" srcdir="${sources.gen}/src" destdir="${build.gen}" listfiles="false"
218 fork="true" verbose="false" encoding="UTF-8"
219 debug="on" deprecation="on" optimize="on" casesensitive="true"
220 source="1.5" target="1.5">
221
222 <classpath refid="infrastructure.class.path" />
223
224 <include name="**/*.java"/>
225 </javac>
226
227 <pathconvert pathsep=" " property="jar.gen.classpath">
228 <path refid="infrastructure.class.path"/>
229 <map from="${dist}/" to=""/>
230 <map from="${root}${file.separator}" to="..${file.separator}"/>
231 </pathconvert>
232
233 <pathconvert property="jar.gen.classpath.flat" dirsep="/">
234 <path refid="infrastructure.class.path"/>
235 </pathconvert>
236
237 <!-- write a flattened classpath -->
238 <echo file="${dist}/${build.gen.file}.classpath">module.classpath=${jar.gen.classpath.flat}</echo>
239
240 <jar jarfile="${dist}/${build.gen.file}" compress="true" roundup="true">
241 <fileset dir="${build.gen}" />
242 <fileset dir="${outputJava}">
243 <include name="META-INF/persistence.xml" />
244 </fileset>
245 <fileset dir="${outputJava}/src">
246 <include name="**/jaxb.index" />
247 </fileset>
248
249 <manifest>
250 <attribute name="Built-By" value="${build.by}"/>
251 <attribute name="Built-Date" value="${build.date}"/>
252
253 <attribute name="Build-Jdk" value="${java.vm.version}"/>
254 <attribute name="Build-Os" value="${os.name} ${os.version} - ${os.arch}"/>
255
256 <attribute name="Class-Path" value="${jar.gen.classpath}"/>
257
258 <section name="Common">
259 <attribute name="Specification-Title" value="${gen.title}"/>
260 <attribute name="Specification-Version" value="${version}"/>
261 <attribute name="Specification-Vendor" value="${vendor}"/>
262 <attribute name="Implementation-Title" value="${gen.title}"/>
263 <attribute name="Implementation-Version" value="${version} - ${build.date}"/>
264 </section>
265 </manifest>
266
267 </jar>
268
269 <!-- remove to avoid classes in svn -->
270 <delete dir="${build.gen}"/>
271
272 <echo>compile ${gen.title} : done.</echo>
273 </target>
274
275
276
277 <!--
278 EclipseLink weave Ant Task Attributes
279 Attribute Description Default Required or Optional
280
281 - source
282 Specifies the location of the Java source files to weave: either a directory or a JAR file.
283 If the persistence.xml file is not in this location, you must specify the location of the persistence.xml using the persistenceinfo attribute.
284
285 Required
286
287 - target
288 Specifies the output location: either a directory or a JAR file.
289
290 Required
291
292 - persistenceinfo
293 Specifies the location of the persistence.xml file if it is not in the same location as the source.
294
295 Optional
296
297 - log
298 Specifies a logging file.
299 See Logging.
300 Optional
301 loglevel
302 Specifies the amount and detail of log output.
303 Valid java.util.logging.Level values are the following:
304 OFF
305 SEVERE
306 WARNING
307 INFO
308 CONFIG
309 FINE
310 FINER
311 FINEST
312 For more information, see Logging.
313 Level.OFF
314 Optional
315 -->
316 <target name="weaving" description="perform static weaving" if="target.weaving.do">
317 <weave source="${dist}/${build.gen.file}"
318 target="${dist}/${build.gen.weave.file}"
319 loglevel="FINE">
320 <classpath>
321 <path refid="project.class.path" />
322 <path refid="infrastructure.class.path" />
323 </classpath>
324 </weave>
325 </target>
326
327
328
329
330 <!-- target makeJavaDoc : creates javadoc from source code -->
331 <target name="makeJavaDoc">
332 <echo>making generated Java classes javadoc ...</echo>
333
334 <mkdir dir="${javadoc}"/>
335
336 <javadoc additionalparam="-notimestamp"
337 destdir="${javadoc}"
338 access="private"
339 author="true"
340 encoding="UTF-8"
341 source="1.5"
342 use="true"
343 windowtitle="${source} : ${gen.title}" >
344
345 <classpath>
346 <path refid="project.class.path" />
347 </classpath>
348
349 <fileset dir="${sources}">
350 <include name="**/*.java"/>
351 </fileset>
352 <fileset dir="${sources.gen}/src">
353 <include name="**/*.java"/>
354 </fileset>
355 <fileset dir="${sources.test}">
356 <include name="**/*.java"/>
357 </fileset>
358
359 </javadoc>
360
361 <echo>generated Java classes javadoc : done.</echo>
362 </target>
363
364
365
366
367 <!-- target format : formats all generated java sources -->
368 <target name="format">
369 <!--
370 Invokes Jalopy as follows:
371
372 - All formatted files will have unix fileformat (\n)
373 - Load your code convention from the given url
374 - Override the convention to use loglevel "info"
375 - Override the convention to use 2 threads
376 - The import optimization feature will work (if enabled in the active
377 convention), because a classpath reference is specified
378
379 Don't forget to setup an include pattern as Jalopy truly expects
380 valid Java source files as input!
381 -->
382
383 <!--
384 note : formatting causes problems with annotations for enumerations but allows people to read code ...
385 Solution : compile first then formats for read only purposes.
386 -->
387
388 <jalopy fileformat="unix"
389 convention="${jalopyConvention}"
390 encoding="UTF-8"
391 failonerror="false"
392 history="NONE"
393 loglevel="warn"
394 threads="1"
395 classpathref="infrastructure.class.path">
396 <fileset dir="${sources.gen}/src">
397 <include name="**/*.java" />
398 </fileset>
399 </jalopy>
400 </target>
401
402
403
404
405 <!-- Compile Unit Tests -->
406 <target name="compileTest">
407 <echo>compile tests ...</echo>
408 <echo>compile from : ${sources.test}</echo>
409 <echo>compile to : ${build.test}</echo>
410
411 <mkdir dir="${build.test}"/>
412
413 <javac sourcepath="" srcdir="${sources.test}" destdir="${build.test}" listfiles="false"
414 fork="true" verbose="false" encoding="UTF-8"
415 debug="on" deprecation="on" optimize="on" casesensitive="true"
416 source="1.5" target="1.5">
417
418 <classpath refid="runtime.class.path" />
419
420 <include name="**/*.java"/>
421 </javac>
422
423 <pathconvert pathsep=" " property="jar.test.classpath">
424 <path refid="runtime.class.path"/>
425 <map from="${dist}/" to=""/>
426 <map from="${root}${file.separator}" to="..${file.separator}"/>
427 </pathconvert>
428
429 <jar jarfile="${dist}/${build.test.file}" compress="true" roundup="true">
430 <fileset dir="${build.test}" />
431
432 <manifest>
433 <attribute name="Built-By" value="${build.by}"/>
434 <attribute name="Built-Date" value="${build.date}"/>
435
436 <attribute name="Build-Jdk" value="${java.vm.version}"/>
437 <attribute name="Build-Os" value="${os.name} ${os.version} - ${os.arch}"/>
438
439 <!-- last / is used to consider property directory correctly : properties/ to load configuration files -->
440 <attribute name="Class-Path" value="${jar.test.classpath}/"/>
441
442 <attribute name="Main-Class" value="org.ivoa.test.Main"/>
443
444 <section name="Common">
445 <attribute name="Specification-Title" value="${gen.title}"/>
446 <attribute name="Specification-Version" value="${version}"/>
447 <attribute name="Specification-Vendor" value="${vendor}"/>
448 <attribute name="Implementation-Title" value="${gen.title}"/>
449 <attribute name="Implementation-Version" value="${version} - ${build.date}"/>
450 </section>
451 </manifest>
452
453 </jar>
454
455 <!-- remove to avoid classes in svn -->
456 <delete dir="${build.test}"/>
457
458 <echo>compile tests : done.</echo>
459 </target>
460
461
462
463
464 <!-- target run : launches deployed application on Unix environment (bash used) -->
465 <target name="run" if="target.run.do">
466 <echo message="running ${gen.title} ..."/>
467
468 <delete file="${build}/root.log" />
469
470 <java jar="${dist}/${build.test.file}" dir="${build}" fork="true" failonerror="true">
471 <jvmarg value="-Xms64m"/>
472 <jvmarg value="-Xmx256m"/>
473 <!-- eclipse weaving support -->
474 <jvmarg value="-javaagent:../libs/eclipselink.jar"/>
475
476 </java>
477
478 <echo message="run ${gen.title} : terminated."/>
479 </target>
480
481
482 <!-- end of build_java.xml -->

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