/[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 257 - (show annotations)
Wed Apr 23 05:37:22 2008 UTC (12 years, 7 months ago) by gerard.lemson
File MIME type: text/xml
File size: 14126 byte(s)
added intermediate2xhtml
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" />
233
234 <ant target="processIntermediate2XSD" />
235
236 <ant target="processIntermediate2DDL"/>
237
238 <ant target="processIntermediate2Java"/>
239 </target>
240
241
242
243
244 <target name="processXMI2Intermediate" unless="intermediate.notRequired">
245 <ant target="checkSource">
246 <property name="source_checked" value="${snap_source_checked}" />
247 </ant>
248 <ant target="filterSource" />
249 <ant target="run_xmi2intermediate" />
250 </target>
251
252
253
254
255 <target name="processIntermediate2XSD" unless="xsd.notRequired">
256 <ant target="run_intermediate2xsd" />
257 <ant target="genXHTML" />
258 </target>
259
260
261
262
263 <target name="processIntermediate2DDL" unless="ddl.notRequired">
264 <ant target="run_intermediate2ddl" />
265 </target>
266
267
268
269
270 <target name="processIntermediate2Java" unless="java.notRequired">
271 <ant target="cleanJavaOutput"/>
272 <ant target="run_intermediate2java"/>
273 <ant target="makeOutput" />
274 </target>
275
276
277
278
279 <!-- generic targets -->
280
281 <!-- target checkSource : check xmi well formed tags in source document -->
282 <target name="checkSource" description="check that xmi is well formed">
283 <echo>checkSource : starting checks on file ${input}/${source}</echo>
284
285 <xslt2 in="${input}/${source}"
286 out="${output}/${source_checked}"
287 style="${res}/xmiCheck.xsl" />
288
289 <echo>checkSource : done.</echo>
290 </target>
291
292
293
294
295 <!-- target filterSource : remove all xmi:Extension tags in source document -->
296 <target name="filterSource" description="remove all xmi:Extension tags in source document">
297 <echo>filterSource : starting filter on file ${input}/${source}</echo>
298
299 <xslt2 in="${input}/${source}"
300 out="${output}/${source_filtered}"
301 style="${res}/xmiFilter.xsl" />
302
303 <echo>filterSource : done.</echo>
304 </target>
305
306
307
308
309 <target name="run_xmi2intermediate">
310 <ant target="xmi2intermediate">
311 <property name="source" value="${input}/${snap_source}" />
312 <property name="source_filtered" value="${snap_source_intermediate}" />
313 </ant>
314 </target>
315
316
317
318
319 <!-- target xmi2intermediate : GenTool preprocessor generating according to ivoaDMMetamodel.xsd -->
320 <target name="xmi2intermediate" description="transform XMI to intermediate">
321 <echo>xmi2intermediate : starting generate intermediate model from file ${output}/${source}</echo>
322
323 <xslt2 in="${source}"
324 out="${output}/${source_filtered}"
325 style="${res}/xmi2intermediate.xsl" >
326 <param name="root_package" expression="${root_package}"/>
327 <param name="model_package" expression="${model_package}"/>
328 </xslt2>
329
330 <echo>xmi2intermediate : done.</echo>
331 </target>
332
333
334
335
336 <!-- target run_intermediate2xsd : generates XML schemas from intermediate model -->
337 <target name="run_intermediate2xsd">
338 <echo>run_intermediate2xsd : starting generate XSD files from file ${output}/${snap_source_intermediate}</echo>
339
340 <xslt2 in="${output}/${snap_source_intermediate}"
341 out="${output}/schema/log.txt"
342 style="${res}/intermediate2xsd.xsl">
343 <param name="targetnamespace_root" expression="${targetnamespace_root}"/>
344 <param name="schemalocation_root" expression="${schemalocation_root}"/>
345 </xslt2>
346
347 <delete file="${output}/schema/log.txt" />
348
349 <echo>run_intermediate2xsd : done.</echo>
350 </target>
351
352
353
354
355 <!-- target genXHTML : generates XHTML documentation -->
356 <target name="genXHTML" description="generates XHTML documentation">
357 <!-- No longer correct as there is no individual schema but many xml schemas -->
358 <!--
359
360 <echo>genXTHML : starting generate XHTML docs </echo>
361
362 <xslt2 in="${output}/${out_schema}"
363 out="${output}/${out_xhtml}"
364 style="${res}/schema2xhtml.xsl" />
365 <echo>genXHTML : done.</echo>
366 -->
367 </target>
368
369
370
371 <!-- target run_intermediate2xhtml : generates DDL script from intermediate model -->
372 <target name="run_intermediate2xhtml">
373 <echo>run_intermediate2xhtml : starting generate XHTML from file ${output}/${snap_source_intermediate}</echo>
374
375 <xslt2 in="${output}/${snap_source_intermediate}"
376 out="${output}/html/SimDB.html"
377 style="${res}/intermediate2xhtml.xsl">
378 </xslt2>
379
380 <echo>run_intermediate2xhtml : done.</echo>
381 </target>
382
383
384
385
386
387 <!-- target run_intermediate2ddl : generates DDL script from intermediate model -->
388 <target name="run_intermediate2ddl">
389 <echo>run_intermediate2ddl : starting generate DDL from file ${output}/${snap_source_intermediate}</echo>
390
391 <xslt2 in="${output}/${snap_source_intermediate}"
392 out="${output}/ddl/SNAP_ddl.sql"
393 style="${res}/intermediate2ddl.xsl">
394 <param name="schema" expression="SNAP"/>
395 </xslt2>
396
397 <echo>run_intermediate2ddl : done.</echo>
398 </target>
399
400
401
402
403 <!-- target run_intermediate2java : generates java classes from intermediate model -->
404 <target name="run_intermediate2java">
405 <echo>run_intermediate2java : starting filter on file ${output}/${source}</echo>
406
407 <mkdir dir="${sources.gen}/"/>
408
409 <xslt2 in="${output}/${snap_source_intermediate}"
410 out="${sources.gen}/javagen.log"
411 style="${res}/intermediate2java.xsl">
412 <param name="root_package" expression="${root_package}"/>
413 <param name="model_package" expression="${model_package}"/>
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