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

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