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

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