/[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 219 - (show annotations)
Tue Apr 15 06:23:24 2008 UTC (12 years, 7 months ago) by gerard.lemson
File MIME type: text/xml
File size: 12368 byte(s)
Committing resources dealing with generation of intermediate and DDLs.
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 -->
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 <path id="infrastructure.class.path">
71 <pathelement location="${dist}/${build.file}"/>
72 <pathelement location="${libs}/toplink-essentials.jar"/>
73 </path>
74
75
76 <!-- specific properties -->
77 <property name="root_package" value="org.ivoa"/>
78 <property name="model_package" value="org.ivoa.dm.model"/>
79
80 <!-- schema generation parameters -->
81 <property name="schemalocation_root" value="http://volute.googlecode.com/svn/trunk/projects/theory/snapdm/xsd/"/>
82 <property name="targetnamespace_root" value="http://www.ivoa.net/xml/SNAP/v0.1"/>
83
84
85 <!-- checks if input & xslt are modified compare to intermediate document -->
86 <uptodate property="intermediate.notRequired">
87 <srcfiles dir= "${input}" includes="${snap_source}"/>
88 <srcfiles dir= "${res}" includes="xmiCheck.xsl"/>
89 <srcfiles dir= "${res}" includes="xmiFilter.xsl"/>
90 <srcfiles dir= "${res}" includes="xmi2intermediate.xsl"/>
91 <mapper type="merge" to="${output}/${snap_source_intermediate}"/>
92 </uptodate>
93
94 <!-- checks if intermediate & xslt documents are modified compare to snap.xsd -->
95 <uptodate property="xsd.notRequired">
96 <srcfiles dir= "${output}" includes="${snap_source_intermediate}"/>
97 <srcfiles dir= "${res}" includes="intermediate2xsd.xsl"/>
98 <mapper type="merge" to="${output}/schema/snap.xsd"/>
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="intermediate2java.xsl"/>
105 <!-- index-all.html is updated at each javadoc generation -->
106 <mapper type="merge" to="${sources.gen.docs}/index-all.html"/>
107 </uptodate>
108
109
110
111
112 <!-- presets -->
113
114 <!-- Performs an XSL translation of an XML file using the Saxon processor. -->
115 <presetdef name="xslt2">
116 <!-- The processor=SaxonLiaison setting causes our custom XSLTLiaison class to be used. -->
117 <!-- This works around bug #41314: http://issues.apache.org/bugzilla/show_bug.cgi?id=41314 -->
118 <xslt force="true" classpath="${libs}/saxon9.jar:${libs}/anthack/" processor="SaxonLiaison">
119 <outputproperty name="{http://saxon.sf.net/}indent-spaces" value="2" />
120 </xslt>
121
122 </presetdef>
123
124
125
126
127 <!-- targets -->
128
129 <!-- target init : timestamp -->
130 <target name="init">
131 <tstamp>
132 <format property="build.date" pattern="dd/MM/yyyy HH:mm:ss" />
133 </tstamp>
134
135 <echo>-------------------------------------------------------------------------------</echo>
136 <echo> ${vendor} </echo>
137 <echo> ${projectTitle} - ${version} </echo>
138 <echo>-------------------------------------------------------------------------------</echo>
139 <echo> Build File </echo>
140 <echo>-------------------------------------------------------------------------------</echo>
141 <echo> contacts : ${build.by} </echo>
142 <echo> build date : ${build.date} </echo>
143 <echo>-------------------------------------------------------------------------------</echo>
144 </target>
145
146
147
148
149 <!-- target about : -->
150 <target name="about" depends="init" description="show information for public targets">
151 <echo>available ant targets : </echo>
152 <echo>-------------------------------------------------------------------------------</echo>
153 <echo> - makeAll : make all transformations (uml -> metaModel -> others) </echo>
154 <echo> - forceMakeAll : CLEANS outputs and then make all transformations (makeAll) </echo>
155 <echo>-------------------------------------------------------------------------------</echo>
156 </target>
157
158
159
160
161 <!-- main target : generates all documents -->
162 <target name="makeAll" depends="init, processDomain, processSnap" description="make all transformations">
163 <echo>makeAll : done.</echo>
164 </target>
165
166
167
168
169 <!-- main target : force to generate all documents -->
170 <target name="forceMakeAll" depends="cleanOutput" description="make all transformations (forced)">
171 <ant target="makeAll" inheritAll="false" />
172 <echo>forceMakeAll : done.</echo>
173 </target>
174
175
176
177
178 <!-- target cleanOutput : clean output java files -->
179 <target name="cleanOutput">
180
181 <echo>cleaning directory : ${outputJava} ...</echo>
182
183 <!-- do not remove directories to have respect for .svn directories -->
184 <delete includeemptydirs="false" verbose="true">
185 <fileset dir="${outputJava}" includes="**/*"/>
186 </delete>
187
188 <echo>cleaned directory : ${outputJava} : done.</echo>
189 </target>
190
191
192
193
194 <target name="processDomain">
195 <ant target="filterSource">
196 <property name="source" value="${domain_source}" />
197 <property name="source_filtered" value="${domain_source_filtered}" />
198 </ant>
199 </target>
200
201
202
203
204 <target name="processSnap">
205 <property name="source" value="${snap_source}" />
206 <property name="source_filtered" value="${snap_source_filtered}" />
207
208 <ant target="processXMI2Intermediate" />
209
210 <ant target="processIntermediate2XSD" />
211
212 <ant target="processIntermediate2Java"/>
213 </target>
214
215
216
217
218 <target name="processXMI2Intermediate" unless="intermediate.notRequired">
219 <ant target="checkSource">
220 <property name="source_checked" value="${snap_source_checked}" />
221 </ant>
222 <ant target="filterSource" />
223 <ant target="run_xmi2intermediate" />
224 </target>
225
226
227
228
229 <target name="processIntermediate2XSD" unless="xsd.notRequired">
230 <ant target="run_intermediate2xsd" />
231 <ant target="genXHTML" />
232 </target>
233
234
235
236
237 <target name="processIntermediate2Java" unless="java.notRequired">
238 <ant target="cleanOutput"/>
239 <ant target="run_intermediate2java"/>
240 <ant target="makeOutput" />
241 </target>
242
243
244
245
246 <target name="run_xmi2intermediate">
247 <ant target="xmi2intermediate">
248 <property name="source" value="${snap_source_filtered}" />
249 <property name="source_filtered" value="${snap_source_intermediate}" />
250 </ant>
251 </target>
252
253
254
255
256 <target name="run_intermediate2java">
257 <echo>run_intermediate2java : starting filter on file ${output}/${source}</echo>
258
259 <mkdir dir="${sources.gen}/"/>
260
261 <xslt2 in="${output}/${snap_source_intermediate}"
262 out="${sources.gen}/javagen.log"
263 style="${res}/intermediate2java.xsl">
264 <param name="root_package" expression="${root_package}"/>
265 <param name="model_package" expression="${model_package}"/>
266 </xslt2>
267
268 <echo>run_intermediate2java : done.</echo>
269 </target>
270
271
272
273
274 <!-- generic targets -->
275
276 <!-- target checkSource : check xmi well formed tags in source document -->
277 <target name="checkSource" description="check that xmi is well formed">
278 <echo>checkSource : starting checks on file ${input}/${source}</echo>
279
280 <xslt2 in="${input}/${source}"
281 out="${output}/${source_checked}"
282 style="${res}/xmiCheck.xsl" />
283
284 <echo>checkSource : done.</echo>
285 </target>
286
287
288
289
290 <!-- target filterSource : remove all xmi:Extension tags in source document -->
291 <target name="filterSource" description="remove all xmi:Extension tags in source document">
292 <echo>filterSource : starting filter on file ${input}/${source}</echo>
293
294 <xslt2 in="${input}/${source}"
295 out="${output}/${source_filtered}"
296 style="${res}/xmiFilter.xsl" />
297
298 <echo>filterSource : done.</echo>
299 </target>
300
301
302
303
304 <!-- target xmi2intermediate : GenTool preprocessor generating according to ivoaDMMetamodel.xsd -->
305 <target name="xmi2intermediate" description="remove more tags in source document">
306 <echo>xmi2intermediate : starting UML to MetaModel on file ${output}/${source}</echo>
307
308 <xslt2 in="${output}/${source}"
309 out="${output}/${source_filtered}"
310 style="${res}/xmi2intermediate.xsl" >
311 <param name="root_package" expression="${root_package}"/>
312 <param name="model_package" expression="${model_package}"/>
313 </xslt2>
314
315 <echo>xmi2intermediate : done.</echo>
316 </target>
317
318
319
320
321 <!-- target genXSD : generates XML schemas from UML Model as xmi document -->
322 <target name="run_intermediate2xsd">
323 <echo>run_intermediate2xsd : starting generate XSD from file ${output}/${snap_source_intermediate}</echo>
324
325 <xslt2 in="${output}/${snap_source_intermediate}"
326 out="${output}/schema/log.txt"
327 style="${res}/intermediate2xsd.xsl">
328 <param name="targetnamespace_root" expression="${targetnamespace_root}"/>
329 <param name="schemalocation_root" expression="${schemalocation_root}"/>
330 </xslt2>
331
332 <echo>run_intermediate2xsd : done.</echo>
333 </target>
334
335
336
337
338 <!-- target genXSD : generates XML schemas from UML Model as xmi document -->
339 <target name="run_intermediate2ddl">
340 <echo>run_intermediate2xsd : starting generate XSD from file ${output}/${snap_source_intermediate}</echo>
341
342 <xslt2 in="${output}/${snap_source_intermediate}"
343 out="${output}/ddl/SNAP_ddl.sql"
344 style="${res}/intermediate2ddl.xsl">
345 <param name="schema" expression="SNAP"/>
346 </xslt2>
347
348 <echo>run_intermediate2xsd : done.</echo>
349 </target>
350
351
352 <!-- target genXHTML : generates XHTML documentation the XSD file created by genXSD -->
353 <target name="genXHTML" description="generates XHTML documentation">
354 <!-- No longer correct as there is no individual schema but many xml schemas -->
355 <!--
356
357 <echo>genXTHML : starting generate XHTML docs </echo>
358
359 <xslt2 in="${output}/${out_schema}"
360 out="${output}/${out_xhtml}"
361 style="${res}/schema2xhtml.xsl" />
362 <echo>genXHTML : done.</echo>
363 -->
364 </target>
365
366
367 <!-- include java code targets -->
368
369 &buildJava;
370
371 </project>

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