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

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