/[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 269 - (show annotations)
Thu Apr 24 16:05:55 2008 UTC (12 years, 7 months ago) by bourges.laurent
File MIME type: text/xml
File size: 14294 byte(s)
bugs in :
- uptodate evaluation
- fixed optimize imports jalopy bugs
1 <?xml version="1.0" ?>
2
3 <!DOCTYPE project [
4 <!ENTITY buildJava SYSTEM "./build_java.xml">
5 ]>
6
7 <project name="Snap DM Transformer" default="about" basedir=".">
8
9 <description>
10 Transformer tool for SNAP DM (UML model) in other documents : XML schemas, documentation and code (java ...)
11 </description>
12
13
14 <!-- Get properties -->
15 <property file="build.properties"/>
16 <fail unless="build.by" message="bad configuration in build.properties !" />
17
18
19 <!-- set global properties for this build -->
20
21 <!-- maybe files should be in build.properties ? -->
22 <!-- input files -->
23 <property name="domain_source" value="DomainModelWithTemplate.xml" />
24 <property name="snap_source" value="SNAP_Simulation_DM.xml" />
25
26 <!-- output files -->
27 <property name="domain_source_filtered" value="DomainModelWithTemplate_FILTER.xml" />
28 <property name="snap_source_checked" value="SNAP_Simulation_DM_CHECK.xml" />
29 <property name="snap_source_filtered" value="SNAP_Simulation_DM_FILTER.xml" />
30 <property name="snap_source_intermediate" value="SNAP_Simulation_DM_INTERMEDIATE.xml" />
31
32
33 <!-- paths -->
34 <property name="input" location="./input" />
35 <property name="output" location="./output" />
36 <property name="res" location="./res" />
37
38 <property name="outputJava" location="${output}/java" />
39
40
41 <!-- java props -->
42 <property name="root" location="."/>
43
44 <property name="sources" location="./src"/>
45 <property name="sources.gen" location="${outputJava}/src"/>
46
47 <property name="sources.gen.docs" location="${outputJava}/doc"/>
48 <property name="sources.gen.dist" location="${outputJava}/dist"/>
49
50
51 <property name="libs" location="./libs"/>
52
53 <property name="dist" location="./dist"/>
54
55
56 <!-- compile Sources -->
57 <property name="build" location="./build"/>
58 <property name="build.src" location="${build}/src"/>
59
60 <property name="build.gen" location="${build}/gen"/>
61
62
63 <!-- class paths for base classes -->
64 <path id="project.class.path">
65 <pathelement location="${libs}/commons-logging-1.1.jar"/>
66 <pathelement location="${libs}/log4j-1.2.15.jar"/>
67 <pathelement location="${libs}/toplink-essentials.jar"/>
68 </path>
69
70 <!-- class paths for generated classes -->
71 <path id="infrastructure.class.path">
72 <path refid="project.class.path" />
73 <pathelement location="${dist}/${build.file}"/>
74 </path>
75
76
77 <!-- specific properties -->
78 <property name="root_package" value="org.ivoa"/>
79 <property name="model_package" value="org.ivoa.dm.model"/>
80
81 <!-- schema generation parameters -->
82 <property name="schemalocation_root" value="http://volute.googlecode.com/svn/trunk/projects/theory/snapdm/xsd/"/>
83 <property name="targetnamespace_root" value="http://www.ivoa.net/xml/SNAP/v0.1"/>
84
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 SNAP_ddl.sql -->
96 <uptodate property="xsd.notRequired">
97 <srcfiles dir= "${output}" includes="${snap_source_intermediate}"/>
98 <srcfiles dir= "${res}" includes="intermediate2xsd.xsl"/>
99 <mapper type="merge" to="${output}/schema/snap.xsd"/>
100 </uptodate>
101
102 <!-- checks if intermediate & xslt documents are modified compare to snap.xsd -->
103 <uptodate property="ddl.notRequired">
104 <srcfiles dir= "${output}" includes="${snap_source_intermediate}"/>
105 <srcfiles dir= "${res}" includes="intermediate2ddl.xsl"/>
106 <mapper type="merge" to="${output}/ddl/SNAP_ddl.sql"/>
107 </uptodate>
108
109 <!-- checks if intermediate & xslt documents are modified compare to javadoc -->
110 <uptodate property="java.notRequired">
111 <srcfiles dir= "${output}" includes="${snap_source_intermediate}"/>
112 <srcfiles dir= "${res}" includes="intermediate2java.xsl"/>
113 <!-- index-all.html is updated at each javadoc generation -->
114 <mapper type="merge" to="${sources.gen.docs}/index-all.html"/>
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" 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 </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_intermediate2xhtml" />
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}"
306 out="${output}/${source_checked}"
307 style="${res}/xmiCheck.xsl" />
308
309 <echo>checkSource : done.</echo>
310 </target>
311
312
313
314
315 <!-- target filterSource : remove all xmi:Extension tags in source document -->
316 <target name="filterSource" description="remove all xmi:Extension tags in source document">
317 <echo>filterSource : starting filter on file ${input}/${source}</echo>
318
319 <xslt2 in="${input}/${source}"
320 out="${output}/${source_filtered}"
321 style="${res}/xmiFilter.xsl" />
322
323 <echo>filterSource : done.</echo>
324 </target>
325
326
327
328
329 <target name="run_xmi2intermediate">
330 <ant target="xmi2intermediate">
331 <property name="source" value="${input}/${snap_source}" />
332 <property name="source_filtered" value="${snap_source_intermediate}" />
333 </ant>
334 </target>
335
336
337
338
339 <!-- target xmi2intermediate : GenTool preprocessor generating according to ivoaDMMetamodel.xsd -->
340 <target name="xmi2intermediate" description="transform XMI to intermediate">
341 <echo>xmi2intermediate : starting generate intermediate model from file ${output}/${source}</echo>
342
343 <xslt2 in="${source}"
344 out="${output}/${source_filtered}"
345 style="${res}/xmi2intermediate.xsl" >
346 <param name="root_package" expression="${root_package}"/>
347 <param name="model_package" expression="${model_package}"/>
348 </xslt2>
349
350 <echo>xmi2intermediate : done.</echo>
351 </target>
352
353
354
355
356 <!-- target run_intermediate2xsd : generates XML schemas from intermediate model -->
357 <target name="run_intermediate2xsd">
358 <echo>run_intermediate2xsd : starting generate XSD files from file ${output}/${snap_source_intermediate}</echo>
359
360 <xslt2 in="${output}/${snap_source_intermediate}"
361 out="${output}/schema/log.txt"
362 style="${res}/intermediate2xsd.xsl">
363 <param name="targetnamespace_root" expression="${targetnamespace_root}"/>
364 <param name="schemalocation_root" expression="${schemalocation_root}"/>
365 </xslt2>
366
367 <delete file="${output}/schema/log.txt" />
368
369 <echo>run_intermediate2xsd : done.</echo>
370 </target>
371
372
373
374
375 <!-- target run_intermediate2xhtml : generates DDL script from intermediate model -->
376 <target name="run_intermediate2xhtml">
377 <echo>run_intermediate2xhtml : starting generate XHTML from file ${output}/${snap_source_intermediate}</echo>
378
379 <xslt2 in="${output}/${snap_source_intermediate}"
380 out="${output}/html/SimDB.html"
381 style="${res}/intermediate2xhtml.xsl">
382 </xslt2>
383
384 <echo>run_intermediate2xhtml : done.</echo>
385 </target>
386
387
388
389
390
391 <!-- target run_intermediate2ddl : generates DDL script from intermediate model -->
392 <target name="run_intermediate2ddl">
393 <echo>run_intermediate2ddl : starting generate DDL from file ${output}/${snap_source_intermediate}</echo>
394
395 <xslt2 in="${output}/${snap_source_intermediate}"
396 out="${output}/ddl/SNAP_ddl.sql"
397 style="${res}/intermediate2ddl.xsl">
398 <param name="schema" expression="SNAP"/>
399 </xslt2>
400
401 <echo>run_intermediate2ddl : done.</echo>
402 </target>
403
404
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}"
414 out="${sources.gen}/javagen.log"
415 style="${res}/intermediate2java.xsl">
416 <param name="root_package" expression="${root_package}"/>
417 <param name="model_package" expression="${model_package}"/>
418 </xslt2>
419
420 <delete file="${sources.gen}/javagen.log" />
421
422 <echo>run_intermediate2java : done.</echo>
423 </target>
424
425
426 <!-- include java code targets -->
427
428 &buildJava;
429
430 </project>

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