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

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