/[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 369 - (show annotations)
Tue May 6 14:19:10 2008 UTC (12 years, 7 months ago) by gerard.lemson
File MIME type: text/xml
File size: 13981 byte(s)


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

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