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

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