projekti pod git sistemom za održavanje verzija -- projects under
the git version control system
1 <project name=
"mjc2wsl" default=
"all">
2 <property file=
"custom.properties"/>
3 <property environment=
"env"/>
5 <condition property=
"fermat.dir" value=
"C:\fermat3">
6 <os family=
"windows" />
9 <condition property=
"fermat.dir" value=
"${user.home}/fermat3">
10 <not><os family=
"windows" /></not>
14 <property name=
"java.encoding" value=
"utf-8" />
15 <taskdef resource=
"net/sf/antcontrib/antlib.xml"/>
17 <property name=
"mjc2wsl.class.dir" value=
"bin" />
18 <property name=
"mjc2wsl.src.dir" value=
"src" />
19 <property name=
"mjc2wsl.options" value=
"" />
21 <property name=
"res.dir" value=
"res" />
23 <property name=
"compiler.class.jar" value=
"lib/mj.jar" />
24 <property name=
"compiler.class.dir" value=
"lib/compiler-bin" />
25 <property name=
"compiler.src.dir" value=
"lib/compiler-src" />
26 <property name=
"compiler.classname.compiler" value=
"MJ.Compiler" />
27 <property name=
"compiler.classname.interpreter" value=
"MJ.Run" />
28 <property name=
"compiler.classname.decoder" value=
"MJ.Decode" />
30 <property name=
"samples.main.dir" value=
"samples" />
31 <property name=
"samples.temp.dir" value=
"temp" />
33 <property name=
"transf.wsl.file" value=
"src-wsl/transf-min.wsl" />
34 <property name=
"transf.wsl.ini" value=
"transf.ini" />
35 <property name=
"transf.wsl.ext" value=
"_t.wsl" />
37 <property name=
"tests.dir" value=
"tests" />
39 <property name=
"log.dir" value=
"logs" />
40 <property name=
"log.file.transformations" value=
"${log.dir}/transformations" />
41 <property name=
"log.file.mjc2wsl" value=
"${log.dir}/mjc2wsl" />
44 Builder script for mjc2wsl and related tools, runs test
47 Also gives options to chain the tools on individual files.
50 <patternset id=
"non.transformed.sources">
51 <include name=
"**/*.wsl"/>
52 <exclude name=
"**/*${transf.wsl.ext}"/>
55 <!-- general tasks -->
57 <target name=
"init" depends=
"init-time">
58 <mkdir dir=
"${mjc2wsl.class.dir}"/>
59 <mkdir dir=
"${compiler.class.dir}"/>
60 <mkdir dir=
"${samples.temp.dir}"/>
61 <mkdir dir=
"${log.dir}"/>
62 <copy todir=
"${samples.temp.dir}">
63 <fileset dir=
"${samples.main.dir}">
64 <include name=
"*.mj"/>
69 <target name=
"init-time">
71 <format property=
"time" pattern=
"yy-MM-dd--HH-mm-ss"/>
75 <target name=
"all" depends='mj-samples,mjc2wsl-samples,wsl-transf-samples'
76 description=
"build the tools, run them on the samples to check">
80 <target name=
"clean" description=
"clean up all the generated content">
81 <delete includeemptydirs=
"true">
82 <fileset dir=
"${mjc2wsl.class.dir}"/>
83 <fileset dir=
"${compiler.class.dir}"/>
84 <fileset dir=
"${samples.temp.dir}"/>
85 <fileset dir=
"${log.dir}"/>
90 based on ideas by Jesper Öqvist http://llbit.se/?p=1876 -->
92 <!-- this target is only run if the 'version' property is undefined -->
94 <target name=
"update-version-string" unless=
"version">
95 <!-- get a new version string using git describe if possible -->
96 <echo message=
"Updating version string..."/>
97 <exec executable=
"git" outputproperty=
"version"
98 failifexecutionfails=
"false">
99 <arg value=
"describe"/>
101 <antcall target=
"-store-version-string"/>
102 <!-- ensure version is defined even if git was not available -->
103 <property file=
"${res.dir}/version.properties"/>
106 <target name=
"-store-version-string" if=
"version">
107 <!-- store the new version string in the correct property file -->
108 <echo message=
"version=${version}"/>
109 <propertyfile file=
"${res.dir}/version.properties">
110 <entry key=
"version" value=
"${version}"/>
112 <exec executable=
"git" failifexecutionfails=
"false">
113 <arg value=
"update-index"/>
114 <arg value=
"--assume-unchanged"/>
115 <arg value=
"${res.dir}/version.properties"/>
119 <!-- mjc2wsl related tasks -->
121 <target name=
"build" depends=
"init,update-version-string" description=
"build the mjc2wsl tool">
122 <javac srcdir=
"${mjc2wsl.src.dir}" destdir=
"${mjc2wsl.class.dir}" includeAntRuntime='no'
/>
125 <target name=
"mjc2wsl">
126 <echo message=
"${filename}" />
127 <java classpath=
"${mjc2wsl.class.dir}:${res.dir}" classname=
"com.quemaster.transformations.mjc2wsl.mjc2wsl">
128 <arg line=
"${mjc2wsl.options}" />
129 <arg value=
"${filename}" />
133 <target name=
"mjc2wsl-samples" depends=
"build,init-time" description=
"run the mjc2wsl tool on the samples">
134 <record name=
"${log.file.mjc2wsl}${time}.txt" emacsmode=
"true" />
135 <echo>Used options:${mjc2wsl.options}
</echo>
136 <foreach param=
"filename" target=
"mjc2wsl">
138 <fileset dir='${samples.temp.dir}'
>
139 <include name=
"*.obj"/>
143 <record name=
"${log.file.mjc2wsl}${time}.txt" action=
"stop" />
144 <copy file=
"${log.file.mjc2wsl}${time}.txt" tofile=
"${log.file.mjc2wsl}.txt"/>
147 <target name=
"mjc2wsl-samples1" depends=
"build">
148 <!-- simplistic version when antlib (foreach) is not available -->
149 <antcall target=
"mjc2wsl">
150 <param name=
"filename" value=
"samples-temp/sample0.obj" />
155 <!-- MicroJava related tasks -->
158 <target name=
"mj-build" depends=
"init" description=
"build the mj compiler">
159 <javac srcdir=
"${compiler.src.dir}" destdir=
"${compiler.class.dir}" includeAntRuntime='no'
/>
162 <target name=
"mj-compile" description=
"compile a MJ into obj file; given ${filename}">
163 <echo message=
"${filename}" />
164 <java classpath=
"${compiler.class.dir}:${compiler.class.jar}" classname=
"${compiler.classname.compiler}">
165 <arg value=
"${filename}" />
169 <target name=
"mj-samples" description=
"run the mj compiler on the samples" depends=
"init">
170 <foreach param=
"filename" target=
"mj-compile">
172 <fileset dir='${samples.temp.dir}'
>
173 <include name=
"*.mj"/>
179 <target name=
"mj-decode" description=
"decode a MJ obj file given in ${filename}">
180 <echo message=
"${filename}" />
181 <java classpath=
"${compiler.class.dir}:${compiler.class.jar}" classname=
"${compiler.classname.decoder}">
182 <arg value=
"${filename}" />
186 <target name=
"mj-decode-samples" description=
"decode all of the compiled samples and save into file 'decoded.txt'">
187 <record name=
"${samples.temp.dir}/decoded.txt" emacsmode=
"true" loglevel=
"info"/>
188 <foreach param=
"filename" target=
"mj-decode">
190 <fileset dir='${samples.temp.dir}'
>
191 <include name=
"*.obj"/>
195 <record name=
"${samples.temp.dir}/decoded.txt" action=
"stop"/>
198 <target name=
"mj-run" description=
"run a MJ obj file given in ${filename} with ${inputstring}">
199 <echo message=
"${filename}" />
200 <java classpath=
"${compiler.class.dir}:${compiler.class.jar}" classname=
"${compiler.classname.interpreter}" inputstring=
"${inputstring}">
201 <arg value=
"${filename}" />
205 <target name=
"mj-samples1" depends=
"mj-build">
206 <!-- simplistic version when antlib (foreach) is not available -->
207 <antcall target=
"mj-compile">
208 <param name=
"filename" value=
"samples-temp/sample.mj" />
210 <antcall target=
"mj-compile">
211 <param name=
"filename" value=
"samples-temp/sample1.mj" />
213 <antcall target=
"mj-compile">
214 <param name=
"filename" value=
"samples-temp/sample0.mj" />
219 <!-- wsl related tasks -->
221 <target name=
"wsl-run" >
222 <property name=
"args" value=
""/>
223 <exec executable=
"${fermat.dir}/bin/wsl" inputstring=
"${inputstring}">
224 <env key=
"PATH" path=
"${fermat.dir}/bin:${env.PATH}"/>
225 <env key=
"FermaT" path=
"${fermat.dir}" />
226 <env key=
"SCHEME_LIBRARY_PATH" path=
"${fermat.dir}/slib/" />
227 <env key=
"SCM_INIT_PATH" path=
"${fermat.dir}/scm/Init5e7.scm" />
228 <arg line=
"${filename} ${args}"/>
232 <target name=
"wsl-transf"
233 description=
"transform (simplify) a single wsl file generated by mjc2wsl">
235 <antcall target=
"wsl-run">
236 <param name=
"filename" value=
"${transf.wsl.file}" />
237 <param name=
"args" value=
"${transf.filename}" />
241 <target name=
"wsl-transf-samples" depends=
"init"
242 description=
"transform (simplify) the wsl files generated by mjc2wsl" >
243 <record name=
"${log.file.transformations}${time}.txt" emacsmode=
"true" />
244 <foreach param=
"transf.filename" target=
"wsl-transf">
246 <fileset dir='${samples.temp.dir}'
>
247 <patternset refid=
"non.transformed.sources"/>
251 <record name=
"${log.file.transformations}${time}.txt" action=
"stop" />
252 <copy file=
"${log.file.transformations}${time}.txt" tofile=
"${log.file.transformations}.txt"/>
255 <target name=
"wsl-transf-samples-ini" depends=
"init-time,make-transf-ini-samples"
256 description=
"transform (simplify) the wsl files generated by mjc2wsl - uses ini file">
257 <record name=
"${log.file.transformations}${time}i.txt" emacsmode=
"true" />
258 <antcall target=
"wsl-run">
259 <param name=
"filename" value=
"${transf.wsl.file}" />
261 <record name=
"${log.file.transformations}${time}i.txt" action=
"stop" />
262 <copy file=
"${log.file.transformations}${time}i.txt" tofile=
"${log.file.transformations}.txt"/>
265 <target name=
"make-transf-ini-samples">
266 <fileset dir=
"${samples.temp.dir}" casesensitive=
"no" id=
"generated-wsl-fileset">
267 <patternset refid=
"non.transformed.sources"/>
269 <pathconvert pathsep=
"${line.separator}"
270 property=
"generated-wsl-files" refid=
"generated-wsl-fileset" />
272 <echo file=
"${transf.wsl.ini}">${generated-wsl-files}
</echo>
275 <!-- Testing tasks -->
277 <target name=
"manual-test-run"
278 description=
"run .obj .wsl ${transf.wsl.ext}, given are ${file.dir}, ${file.name} (no extension) and an ${inputstring}">
279 <record name=
"${file.dir}/${file.name}.out1" emacsmode=
"true" />
280 <antcall target=
"mj-run">
281 <param name=
"filename" value=
"${file.dir}/${file.name}.obj" />
282 <param name=
"inputstring" value=
"${inputstring}" />
284 <record name=
"${file.dir}/${file.name}.out1" action=
"stop" />
285 <record name=
"${file.dir}/${file.name}.out2" emacsmode=
"true" />
286 <antcall target=
"wsl-run">
287 <param name=
"filename" value=
"${file.dir}/${file.name}.wsl" />
288 <param name=
"inputstring" value=
"${inputstring}" />
290 <record name=
"${file.dir}/${file.name}.out2" action=
"stop" />
291 <record name=
"${file.dir}/${file.name}.out3" emacsmode=
"true" />
292 <antcall target=
"wsl-run">
293 <param name=
"filename" value=
"${file.dir}/${file.name}${transf.wsl.ext}" />
294 <param name=
"inputstring" value=
"${inputstring}" />
296 <record name=
"${file.dir}/${file.name}.out3" action=
"stop" />
299 <target name=
"manual-test-run-samples-dir"
300 description=
"run .obj .wsl ${transf.wsl.ext}, in the samples-temp directory; given ${file.name} (no extension) and an ${inputstring}">
301 <antcall target=
"manual-test-run">
302 <param name=
"file.dir" value=
"${samples.temp.dir}"/>
306 <target name=
"init-compare">
307 <mkdir dir=
"${samples.temp.dir}/outputs"/>
310 <target name=
"test-m-w">
312 <basename property=
"file.out" file=
"${inputfile}" suffix=
".txt"/>
314 <java classpath=
"${compiler.class.dir}:${compiler.class.jar}"
315 classname=
"${compiler.classname.interpreter}"
317 error=
"${samples.temp.dir}/outputs/${file.out}.errmj"
318 output=
"${samples.temp.dir}/outputs/${file.out}.outmj">
319 <arg value=
"${file.dir}/${file.name}.obj" />
322 <exec executable=
"${fermat.dir}/bin/wsl"
324 error=
"${samples.temp.dir}/outputs/${file.out}.errwsl"
325 output=
"${samples.temp.dir}/outputs/${file.out}.outwsl" >
326 <env key=
"PATH" path=
"${fermat.dir}/bin:${env.PATH}"/>
327 <env key=
"FermaT" path=
"${fermat.dir}" />
328 <env key=
"SCHEME_LIBRARY_PATH" path=
"${fermat.dir}/slib/" />
329 <env key=
"SCM_INIT_PATH" path=
"${fermat.dir}/scm/Init5e7.scm" />
330 <arg value=
"${file.dir}/${file.name}.wsl"/>
333 <exec executable=
"perl" resultproperty=
"ook">
334 <arg value=
"lib/compare-m-w.pl"/>
335 <arg value=
"${file.dir}/outputs"/>
336 <arg value=
"${file.out}"/>
341 <target name=
"test-w-wt">
343 <basename property=
"file.out" file=
"${inputfile}" suffix=
".txt"/>
345 <exec executable=
"${fermat.dir}/bin/wsl"
347 error=
"${samples.temp.dir}/outputs/${file.out}.errwsl"
348 output=
"${samples.temp.dir}/outputs/${file.out}.outwsl" >
349 <env key=
"PATH" path=
"${fermat.dir}/bin:${env.PATH}"/>
350 <env key=
"FermaT" path=
"${fermat.dir}" />
351 <env key=
"SCHEME_LIBRARY_PATH" path=
"${fermat.dir}/slib/" />
352 <env key=
"SCM_INIT_PATH" path=
"${fermat.dir}/scm/Init5e7.scm" />
353 <arg value=
"${file.dir}/${file.name}.wsl"/>
356 <exec executable=
"${fermat.dir}/bin/wsl"
358 error=
"${samples.temp.dir}/outputs/${file.out}.errwslt"
359 output=
"${samples.temp.dir}/outputs/${file.out}.outwslt" >
360 <env key=
"PATH" path=
"${fermat.dir}/bin:${env.PATH}"/>
361 <env key=
"FermaT" path=
"${fermat.dir}" />
362 <env key=
"SCHEME_LIBRARY_PATH" path=
"${fermat.dir}/slib/" />
363 <env key=
"SCM_INIT_PATH" path=
"${fermat.dir}/scm/Init5e7.scm" />
364 <arg value=
"${file.dir}/${file.name}${transf.wsl.ext}"/>
367 <exec executable=
"perl">
368 <arg value=
"lib/compare-w-wt.pl"/>
369 <arg value=
"${file.dir}/outputs"/>
370 <arg value=
"${file.out}"/>
374 <target name=
"test-fn">
375 <basename property=
"file.name" file=
"${filename}" suffix=
".obj"/>
376 <dirname property=
"file.dir" file=
"${filename}"/>
377 <foreach param=
"inputfile" target=
"test-m-w" inheritall=
"true">
379 <fileset dir='${tests.dir}'
>
380 <include name=
"${file.name}*.txt"/>
386 <target name=
"test-fn-t">
387 <basename property=
"file.name" file=
"${filename}" suffix=
"${transf.wsl.ext}"/>
388 <dirname property=
"file.dir" file=
"${filename}"/>
389 <foreach param=
"inputfile" target=
"test-w-wt" inheritall=
"true">
391 <fileset dir='${tests.dir}'
>
392 <include name=
"${file.name}*.txt"/>
398 <target name=
"test-all-m" depends=
"init-compare"
399 description=
"Run all the tests from the test directory to compare MJ and WSL" >
400 <foreach param=
"filename" target=
"test-fn" inheritall=
"true">
402 <fileset dir='${samples.temp.dir}'
>
403 <include name=
"*.obj"/>
409 <target name=
"test-all-t" depends=
"init-compare"
410 description=
"Run all the tests from the test directory to compare WSL and transformations" >
411 <foreach param=
"filename" target=
"test-fn-t">
413 <fileset dir='${samples.temp.dir}'
>
414 <include name=
"*${transf.wsl.ext}"/>
420 <target name=
"q-test">
421 <!-- for quick tests -->
422 <antcall target=
"test-fn">
423 <param name=
"file.name" value=
"Rek1"/>
424 <param name=
"file.dir" value=
"${samples.temp.dir}"/>
428 <!-- output serveral versions of files -->
430 <target name=
"output-all-versions"
431 description=
"generate variations on the translations in the 'local' folder and tar them">
433 <target name=
"mj-samples"/>
434 <target name=
"mjc2wsl-samples"/>
435 <param name=
"samples.temp.dir" value=
"local/out/headTail-proc"/>
436 <param name=
"mjc2wsl.options" value=
""/>
439 <target name=
"mj-samples"/>
440 <target name=
"mjc2wsl-samples"/>
441 <param name=
"samples.temp.dir" value=
"local/out/headTail-inline"/>
442 <param name=
"mjc2wsl.options" value=
"--genInlinePrint"/>
445 <target name=
"mj-samples"/>
446 <target name=
"mjc2wsl-samples"/>
447 <param name=
"samples.temp.dir" value=
"local/out/popPush-inline"/>
448 <param name=
"mjc2wsl.options" value=
"--genPopPush --genInlinePrint"/>
451 <target name=
"mj-samples"/>
452 <target name=
"mjc2wsl-samples"/>
453 <param name=
"samples.temp.dir" value=
"local/out/popPush-proc"/>
454 <param name=
"mjc2wsl.options" value=
"--genPopPush"/>
457 <target name=
"mj-samples"/>
458 <target name=
"mjc2wsl-samples"/>
459 <param name=
"samples.temp.dir" value=
"local/out/popPush-glob"/>
460 <param name=
"mjc2wsl.options" value=
"--genPopPush --genGlobalVars"/>
462 <tar basedir=
"local/out" compression=
"gzip"
463 destfile=
"local/mjc2wsl-samples.tgz"
467 <!-- jedit specific flags; needs to be the first or the last 10 lines