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

Contents of /trunk/projects/theory/snapdm/build.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: 17888 byte(s)
- updated uptodate conditions
- removed regexp on DDL scripts
- added windows fix for classpath.flat
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!DOCTYPE project [
4 <!ENTITY buildJava SYSTEM "./build_java.xml">
5 <!ENTITY buildDB SYSTEM "./build_db.xml">
6 ]>
7
8 <project name="Data Model Transformer" default="about" basedir=".">
9
10 <description>
11 This build file can be considered as the transformer tool for any Data Model in xmi format to other documents :
12 - XML schemas (xsd)
13 - documentation (html)
14 - java formatted code (JPA / JAXB compliant) + javadoc
15 - DDL script (microsoft sql server / postgresql databases / oracle soon ?)
16 - TAP VOTABLEs
17
18 Authors : laurent.bourges@obspm.fr, gerard.lemson@mpe.mpg.de
19
20 Version : 16/06/2008
21 </description>
22
23
24
25
26 <!-- set global properties for this build -->
27
28 <!-- Get build properties (general) -->
29 <property file="build.properties" />
30 <fail unless="build.by" message="bad configuration in build.properties !" />
31
32
33 <!-- Get pipeline properties (model dependent) -->
34 <property file="pipeline.properties" />
35
36 <fail unless="project.name" message="Must define name for project [project.name] !" />
37 <fail unless="source" message="Must define the source data model file (xmi 2.1) [source] !" />
38 <fail unless="root_package" message="Must define the root package [root_package] !" />
39 <fail unless="model_package" message="Must define the model package [model_package] !" />
40 <fail unless="schemalocation_root" message="Must define the schema location root [schemalocation_root] !" />
41 <fail unless="targetnamespace_root" message="Must define the target namespace root [targetnamespace_root] !" />
42
43
44 <!-- convert target switches to ant conditionnal properties -->
45 <fail unless="target.run.active" message="Must define if run target should run [target.run.active] !" />
46 <fail unless="target.weaving.active" message="Must define if weaving target should run [target.weaving.active] !" />
47
48 <condition property="target.run.do"><equals arg1="${target.run.active}" arg2="true" trim="true"/></condition>
49 <condition property="target.weaving.do"><equals arg1="${target.weaving.active}" arg2="true" trim="true"/></condition>
50
51
52 <!-- output files -->
53 <property name="source_checked" value="${project.name}_CHECK.xml" />
54 <property name="source_filtered" value="${project.name}_FILTER.xml" />
55 <property name="source_intermediate" value="${project.name}_INTERMEDIATE.xml" />
56
57
58 <!-- paths -->
59 <property name="input" location="./input" />
60 <property name="output" location="./output" />
61 <property name="res" location="./res" />
62
63 <property name="outputJava" location="${output}/java" />
64
65
66 <!-- global java paths -->
67 <property name="root" location="."/>
68 <property name="properties" location="./properties"/>
69 <property name="test" location="./test" />
70
71
72 <property name="sources" location="./src" />
73 <property name="sources.gen" location="${outputJava}" />
74 <property name="sources.test" location="${test}/java" />
75
76
77 <property name="libs" location="./libs" />
78
79 <property name="dist" location="./dist" />
80
81 <property name="dist.lib" location="${dist}/lib" />
82 <property name="javadoc" location="${dist}/doc" />
83
84
85 <!-- compile Sources -->
86 <property name="build" location="./build" />
87 <property name="build.src" location="${build}/src" />
88
89 <property name="build.gen" location="${build}/gen" />
90 <property name="build.test" location="${build}/test" />
91
92 <tstamp>
93 <format property="build.date" pattern="dd/MM/yyyy HH:mm:ss" />
94 </tstamp>
95
96 <!-- class path for JDBC drivers -->
97 <path id="jdbc-drivers.class.path">
98 <pathelement location="${libs}/jdbc/postgresql-8.3-603.jdbc3.jar" />
99 <pathelement location="${libs}/jdbc/sqljdbc-2005-1.2.jar" />
100 </path>
101
102 <!-- adds README.txt to default excludes -->
103 <defaultexcludes echo="false" add="**/README.txt"/>
104
105
106 <!-- up to date checks -->
107
108 <!-- checks if input & xslt are modified compare to intermediate document -->
109 <uptodate property="intermediate.notRequired">
110 <srcfiles dir="${input}" includes="${source}" />
111 <srcfiles dir="${res}" includes="xmiCheck.xsl" />
112 <srcfiles dir="${res}" includes="xmiFilter.xsl" />
113 <srcfiles dir="${res}" includes="xmi2intermediate.xsl" />
114 <mapper type="merge" to="${output}/${source_intermediate}" />
115 </uptodate>
116
117 <!-- checks if intermediate & xslt documents are modified compare to xsd-gen.log -->
118 <uptodate property="xsd.notRequired">
119 <srcfiles dir="${output}" includes="${source_intermediate}" />
120 <srcfiles dir="${res}" includes="intermediate2xsd.xsl" />
121 <srcfiles dir="${res}" includes="common.xsl" />
122 <srcfiles dir="${res}" includes="common-xsd.xsl" />
123 <mapper type="merge" to="${output}/schema/xsd-gen.log" />
124 </uptodate>
125
126 <!-- checks if intermediate & xslt documents are modified compare to ddl-gen.log -->
127 <uptodate property="ddl.notRequired">
128 <srcfiles dir="${output}" includes="${source_intermediate}" />
129 <srcfiles dir="${res}" includes="intermediate2ddl.xsl" />
130 <srcfiles dir="${res}" includes="common-ddl.xsl" />
131 <srcfiles dir="${res}" includes="utype.xsl" />
132 <mapper type="merge" to="${output}/ddl/ddl-gen.log" />
133 </uptodate>
134
135 <!-- checks if intermediate & xslt documents are modified compare to tap-gen.log -->
136 <uptodate property="tap.notRequired">
137 <srcfiles dir="${output}" includes="${source_intermediate}" />
138 <srcfiles dir="${res}" includes="intermediate2tap.xsl" />
139 <srcfiles dir="${res}" includes="intermediate2ddl.xsl" />
140 <srcfiles dir="${res}" includes="common-ddl.xsl" />
141 <srcfiles dir="${res}" includes="utype.xsl" />
142 <mapper type="merge" to="${output}/tap/tap-gen.log" />
143 </uptodate>
144
145 <!-- checks if intermediate & xslt documents are modified compare to java-gen.log -->
146 <uptodate property="java.notRequired">
147 <srcfiles dir="${output}" includes="${source_intermediate}" />
148 <srcfiles dir="${res}" includes="intermediate2java.xsl" />
149 <srcfiles dir="${res}" includes="common.xsl" />
150 <srcfiles dir="${res}" includes="common-ddl.xsl" />
151 <srcfiles dir="${res}" includes="common-xsd.xsl" />
152 <srcfiles dir="${res}" includes="jpa.xsl" />
153 <srcfiles dir="${res}" includes="jaxb.xsl" />
154 <srcfiles dir="${res}" includes="persistence.xml" />
155
156 <!-- check if src/ java code has changed -->
157 <srcfiles dir= "${sources}" includes="**/*"/>
158
159 <srcfiles dir="${output}" includes="${source_intermediate}" />
160 <mapper type="merge" to="${sources.gen}/java-gen.log" />
161 </uptodate>
162
163
164 <!-- presets -->
165
166 <!-- Performs an XSL translation of an XML file using the Saxon processor. -->
167 <presetdef name="xslt2">
168 <!-- The processor=SaxonLiaison setting causes our custom XSLTLiaison class to be used. -->
169 <!-- This works around bug #41314: http://issues.apache.org/bugzilla/show_bug.cgi?id=41314 -->
170 <xslt force="true" classpath="${libs}/saxon9.jar:${libs}/anthack/" processor="SaxonLiaison">
171 <outputproperty name="{http://saxon.sf.net/}indent-spaces" value="2" />
172 </xslt>
173
174 </presetdef>
175
176
177
178
179 <!-- targets -->
180
181 <!-- target init : timestamp -->
182 <target name="init">
183 <echo>-------------------------------------------------------------------------------</echo>
184 <echo> ${vendor} </echo>
185 <echo> ${projectTitle} - ${version} </echo>
186 <echo>-------------------------------------------------------------------------------</echo>
187 <echo> Build File </echo>
188 <echo>-------------------------------------------------------------------------------</echo>
189 <echo> Contacts : ${build.by} </echo>
190 <echo> Build date : ${build.date} </echo>
191 <echo>-------------------------------------------------------------------------------</echo>
192 <echo> project name : ${project.name} </echo>
193 <echo> source : ${source} </echo>
194 <echo> root package : ${root_package} </echo>
195 <echo> model package : ${model_package} </echo>
196 <echo> schema location : ${schemalocation_root} </echo>
197 <echo> target namespace : ${targetnamespace_root} </echo>
198 <echo>-------------------------------------------------------------------------------</echo>
199
200 <echo> target.run.active : ${target.run.active} </echo>
201 <echo>-------------------------------------------------------------------------------</echo>
202 </target>
203
204
205
206
207 <!-- target about : -->
208 <target name="about" depends="init" description="show information for public targets">
209 <echo>available ant targets : </echo>
210 <echo>-------------------------------------------------------------------------------</echo>
211 <echo> - makeAll : make all transformations (uml -> metaModel -> others) </echo>
212 <echo> - forceMakeAll : CLEANS outputs and then make all transformations (makeAll) </echo>
213 <echo>-------------------------------------------------------------------------------</echo>
214 </target>
215
216
217
218
219 <!-- main target : generates all documents -->
220 <target name="makeAll" depends="init, process" description="make all transformations">
221 <echo>makeAll : done.</echo>
222 </target>
223
224
225
226
227 <!-- main target : force to generate all documents -->
228 <target name="forceMakeAll" depends="cleanOutput, cleanJava" description="make all transformations (forced)">
229 <ant target="makeAll" inheritAll="false" />
230 <echo>forceMakeAll : done.</echo>
231 </target>
232
233
234
235
236 <!-- target cleanOutput : clean output files (ddl, java, schema ...) -->
237 <target name="cleanOutput">
238
239 <echo>cleaning directory : ${output} ...</echo>
240
241 <!-- do not remove directories to have respect for .svn directories -->
242 <delete includeemptydirs="false" verbose="true">
243 <fileset dir="${output}">
244 <exclude name="java/**/*"/>
245 </fileset>
246 </delete>
247
248 <echo>cleaned directory : ${output} : done.</echo>
249 </target>
250
251
252
253
254 <!-- target cleanOutput : clean java output files -->
255 <target name="cleanJavaOutput">
256
257 <echo>cleaning directory : ${outputJava} ...</echo>
258
259 <!-- do not remove directories to have respect for .svn directories -->
260 <delete includeemptydirs="false" verbose="true">
261 <fileset dir="${outputJava}" />
262 </delete>
263
264 <echo>cleaned directory : ${outputJava} : done.</echo>
265 </target>
266
267
268
269
270 <target name="process">
271 <property name="source" value="${source}" />
272 <property name="source_filtered" value="${source_filtered}" />
273
274 <ant target="processXMI2Intermediate" inheritAll="false">
275 <propertyset>
276 <propertyref prefix="source" />
277 <propertyref prefix="source_filtered" />
278 </propertyset>
279 </ant>
280
281 <ant target="processIntermediate2XSD" inheritAll="false">
282 <propertyset>
283 <propertyref prefix="source" />
284 <propertyref prefix="source_filtered" />
285 </propertyset>
286 </ant>
287
288 <ant target="processIntermediate2DDL" inheritAll="false">
289 <propertyset>
290 <propertyref prefix="source" />
291 <propertyref prefix="source_filtered" />
292 </propertyset>
293 </ant>
294
295 <ant target="processIntermediate2TAP" inheritAll="false">
296 <propertyset>
297 <propertyref prefix="source" />
298 <propertyref prefix="source_filtered" />
299 </propertyset>
300 </ant>
301
302 <ant target="processIntermediate2Java" inheritAll="false">
303 <propertyset>
304 <propertyref prefix="source" />
305 <propertyref prefix="source_filtered" />
306 </propertyset>
307 </ant>
308
309 <ant target="checkDB" />
310
311 <ant target="createDB" />
312
313 <ant target="run" />
314
315 <!-- builds simdb-browser -->
316 <ant antfile="webapp/simdb-browser/build.xml" target="deployTomcat" inheritAll="false" />
317
318 </target>
319
320
321
322
323 <target name="processXMI2Intermediate" unless="intermediate.notRequired">
324 <ant target="checkSource">
325 <property name="source_checked" value="${source_checked}" />
326 </ant>
327 <ant target="filterSource" />
328 <ant target="run_xmi2intermediate" />
329 </target>
330
331
332
333
334 <target name="processIntermediate2XSD" unless="xsd.notRequired">
335 <ant target="run_intermediate2xsd" />
336 <ant target="run_intermediate2html" />
337 </target>
338
339
340
341
342 <target name="processIntermediate2DDL" unless="ddl.notRequired">
343 <ant target="run_intermediate2ddl" />
344 </target>
345
346
347 <target name="processIntermediate2TAP" unless="tap.notRequired">
348 <ant target="run_intermediate2tap" />
349 </target>
350
351
352
353 <target name="processIntermediate2Java" unless="java.notRequired">
354 <ant target="cleanJavaOutput" />
355 <ant target="run_intermediate2java" />
356 <ant target="makeOutput" />
357 </target>
358
359
360
361
362 <!-- generic targets -->
363
364 <!-- target checkSource : check xmi well formed tags in source document -->
365 <target name="checkSource" description="check that xmi is well formed">
366 <echo>checkSource : starting checks on file ${input}/${source}</echo>
367
368 <xslt2 in="${input}/${source}" out="${output}/${source_checked}" style="${res}/xmiCheck.xsl" />
369
370 <echo>checkSource : done.</echo>
371 </target>
372
373
374
375
376 <!-- target filterSource : remove all xmi:Extension tags in source document -->
377 <target name="filterSource" description="remove all xmi:Extension tags in source document">
378 <echo>filterSource : starting filter on file ${input}/${source}</echo>
379
380 <xslt2 in="${input}/${source}" out="${output}/${source_filtered}" style="${res}/xmiFilter.xsl" />
381
382 <echo>filterSource : done.</echo>
383 </target>
384
385
386
387
388 <target name="run_xmi2intermediate" >
389 <ant target="xmi2intermediate">
390 <property name="source" value="${input}/${source}" />
391 <property name="source_filtered" value="${source_intermediate}" />
392 </ant>
393 </target>
394
395
396
397
398 <!-- target xmi2intermediate : GenTool preprocessor generating according to ivoaDMMetamodel.xsd -->
399 <target name="xmi2intermediate" description="transform XMI to intermediate">
400 <echo>xmi2intermediate : starting generate intermediate model from file ${output}/${source}</echo>
401
402 <xslt2 in="${source}" out="${output}/${source_filtered}" style="${res}/xmi2intermediate.xsl">
403 <param name="root_package" expression="${root_package}" />
404 <param name="model_package" expression="${model_package}" />
405 </xslt2>
406
407 <echo>xmi2intermediate : done.</echo>
408 </target>
409
410
411
412
413 <!-- target run_intermediate2xsd : generates XML schemas from intermediate model -->
414 <target name="run_intermediate2xsd">
415 <echo>run_intermediate2xsd : starting generate XSD files from file ${output}/${source_intermediate}</echo>
416
417 <xslt2 in="${output}/${source_intermediate}" out="${output}/schema/xsd-gen.log" style="${res}/intermediate2xsd.xsl">
418 <param name="targetnamespace_root" expression="${targetnamespace_root}" />
419 <param name="schemalocation_root" expression="${schemalocation_root}" />
420 </xslt2>
421
422 <copy verbose="true" todir="${output}/schema" preservelastmodified="true">
423 <fileset file="./xsd/base.xsd" />
424 </copy>
425
426 <echo>run_intermediate2xsd : done.</echo>
427 </target>
428
429
430
431
432 <!-- target run_intermediate2html : generates HTML Documentation from intermediate model -->
433 <target name="run_intermediate2html">
434 <echo>run_intermediate2html : starting generate HTML from file ${output}/${source_intermediate}</echo>
435
436 <xslt2 in="${output}/${source_intermediate}" out="${output}/html/SimDB.html" style="${res}/intermediate2html.xsl">
437 </xslt2>
438
439 <echo>run_intermediate2html : done.</echo>
440 </target>
441
442
443
444
445 <!-- target run_intermediate2ddl : generates DDL script from intermediate model -->
446 <target name="run_intermediate2ddl">
447 <echo>run_intermediate2ddl : starting generate DDL from file ${output}/${source_intermediate}</echo>
448
449 <xslt2 in="${output}/${source_intermediate}" out="${output}/ddl/ddl-gen.log" style="${res}/intermediate2ddl.xsl">
450 <param name="vendor" expression="mssqlserver" />
451 </xslt2>
452
453 <xslt2 in="${output}/${source_intermediate}" out="${output}/ddl/ddl-gen.log" style="${res}/intermediate2ddl.xsl">
454 <param name="vendor" expression="postgres" />
455 </xslt2>
456
457 <echo>run_intermediate2ddl : done.</echo>
458 </target>
459
460
461 <!-- target run_intermediate2tap : generates DDL script from intermediate model -->
462 <target name="run_intermediate2tap">
463 <echo>run_intermediate2tap : starting generate TAP metadata VOTables from file ${output}/${source_intermediate}</echo>
464
465 <xslt2 in="${output}/${source_intermediate}" out="${output}/tap/tap-gen.log" style="${res}/intermediate2tap.xsl">
466 <param name="mode" expression="tableset" />
467 </xslt2>
468
469 <xslt2 in="${output}/${source_intermediate}" out="${output}/tap/mssqlserver/tap-gen.log" style="${res}/intermediate2tap.xsl">
470 <param name="mode" expression="tap_schema" />
471 <param name="vendor" expression="mssqlserver" />
472 </xslt2>
473
474 <xslt2 in="${output}/${source_intermediate}" out="${output}/tap/postgres/tap-gen.log" style="${res}/intermediate2tap.xsl">
475 <param name="mode" expression="tap_schema" />
476 <param name="vendor" expression="postgres" />
477 </xslt2>
478
479 <xslt2 in="${output}/${source_intermediate}" out="${output}/tap/tap-gen.log" style="${res}/intermediate2tap.xsl">
480 <param name="mode" expression="vodataservice" />
481 </xslt2>
482
483
484
485 <echo>run_intermediate2tap : done.</echo>
486 </target>
487
488
489
490
491 <!-- target run_intermediate2java : generates java classes from intermediate model -->
492 <target name="run_intermediate2java">
493 <echo>run_intermediate2java : starting filter on file ${output}/${source}</echo>
494
495 <mkdir dir="${sources.gen}/" />
496
497 <xslt2 in="${output}/${source_intermediate}" out="${sources.gen}/java-gen.log" style="${res}/intermediate2java.xsl">
498 <param name="root_package" expression="${root_package}" />
499 <param name="model_package" expression="${model_package}" />
500 <param name="targetnamespace_root" expression="${targetnamespace_root}" />
501 </xslt2>
502
503 <echo>run_intermediate2java : done.</echo>
504 </target>
505
506
507 <!-- include db targets -->
508
509 &buildDB;
510
511 <!-- include java code targets -->
512
513 &buildJava;
514
515 </project>

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