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 <!-- when using multiple threads there is a problem with logging!-->
18 <property name=
"global.max.threads" value=
"1" />
20 <property name=
"mjc2wsl.class.dir" value=
"bin" />
21 <property name=
"mjc2wsl.src.dir" value=
"src" />
22 <property name=
"mjc2wsl.options" value=
"" />
24 <property name=
"res.dir" value=
"res" />
26 <property name=
"compiler.class.jar" value=
"lib/mj.jar" />
27 <property name=
"compiler.class.dir" value=
"lib/compiler-bin" />
28 <property name=
"compiler.src.dir" value=
"lib/compiler-src" />
29 <property name=
"compiler.classname.compiler" value=
"MJ.Compiler" />
30 <property name=
"compiler.classname.interpreter" value=
"MJ.Run" />
31 <property name=
"compiler.classname.decoder" value=
"MJ.Decode" />
33 <property name=
"samples.main.dir" value=
"samples" />
34 <property name=
"samples.temp.dir" value=
"temp" />
36 <property name=
"transf.wsl.file" value=
"src-wsl/transf-min.wsl" />
37 <property name=
"transf.wsl.ini" value=
"transf.ini" />
38 <property name=
"transf.wsl.ext" value=
"_t.wsl" />
40 <property name=
"tests.dir" value=
"tests" />
42 <property name=
"log.dir" value=
"logs" />
43 <property name=
"log.file.transformations" value=
"${log.dir}/transformations" />
44 <property name=
"log.file.mjc2wsl" value=
"${log.dir}/mjc2wsl" />
47 Builder script for mjc2wsl and related tools, runs test
50 Also gives options to chain the tools on individual files.
53 <patternset id=
"non.transformed.sources">
54 <include name=
"**/*.wsl"/>
55 <exclude name=
"**/*${transf.wsl.ext}"/>
58 <!-- general tasks -->
60 <target name=
"init" depends=
"init-time">
61 <mkdir dir=
"${mjc2wsl.class.dir}"/>
62 <mkdir dir=
"${compiler.class.dir}"/>
63 <mkdir dir=
"${samples.temp.dir}"/>
64 <mkdir dir=
"${log.dir}"/>
65 <copy todir=
"${samples.temp.dir}">
66 <fileset dir=
"${samples.main.dir}">
67 <include name=
"*.mj"/>
72 <target name=
"init-time">
74 <format property=
"time" pattern=
"yy-MM-dd--HH-mm-ss"/>
78 <target name=
"all" depends='mj-samples,mjc2wsl-samples,wsl-transf-samples'
79 description=
"build the tools, run them on the samples to check">
83 <target name=
"clean" description=
"clean up all the generated content">
84 <delete includeemptydirs=
"true">
85 <fileset dir=
"${mjc2wsl.class.dir}"/>
86 <fileset dir=
"${compiler.class.dir}"/>
87 <fileset dir=
"${samples.temp.dir}"/>
88 <fileset dir=
"${log.dir}"/>
93 based on ideas by Jesper Öqvist http://llbit.se/?p=1876 -->
95 <!-- this target is only run if the 'version' property is undefined -->
97 <target name=
"update-version-string" unless=
"version">
98 <!-- get a new version string using git describe if possible -->
99 <echo message=
"Updating version string..."/>
100 <exec executable=
"git" outputproperty=
"version"
101 failifexecutionfails=
"false">
102 <arg value=
"describe"/>
104 <antcall target=
"-store-version-string"/>
105 <!-- ensure version is defined even if git was not available -->
106 <property file=
"${res.dir}/version.properties"/>
109 <target name=
"-store-version-string" if=
"version">
110 <!-- store the new version string in the correct property file -->
111 <echo message=
"version=${version}"/>
112 <propertyfile file=
"${res.dir}/version.properties">
113 <entry key=
"version" value=
"${version}"/>
115 <exec executable=
"git" failifexecutionfails=
"false">
116 <arg value=
"update-index"/>
117 <arg value=
"--assume-unchanged"/>
118 <arg value=
"${res.dir}/version.properties"/>
122 <!-- mjc2wsl related tasks -->
124 <target name=
"build" depends=
"init,update-version-string" description=
"build the mjc2wsl tool">
125 <javac srcdir=
"${mjc2wsl.src.dir}" destdir=
"${mjc2wsl.class.dir}" includeAntRuntime='no'
/>
128 <target name=
"mjc2wsl">
129 <echo message=
"${filename}" />
130 <java classpath=
"${mjc2wsl.class.dir}:${res.dir}" classname=
"com.quemaster.transformations.mjc2wsl.mjc2wsl">
131 <arg line=
"${mjc2wsl.options}" />
132 <arg value=
"${filename}" />
136 <target name=
"mjc2wsl-samples" depends=
"build,init-time" description=
"run the mjc2wsl tool on the samples">
137 <record name=
"${log.file.mjc2wsl}${time}.txt" emacsmode=
"true" />
138 <echo>Used options:${mjc2wsl.options}
</echo>
139 <foreach param=
"filename" target=
"mjc2wsl" parallel=
"true" maxthreads=
"${global.max.threads}">
141 <fileset dir='${samples.temp.dir}'
>
142 <include name=
"*.obj"/>
146 <record name=
"${log.file.mjc2wsl}${time}.txt" action=
"stop" />
147 <copy file=
"${log.file.mjc2wsl}${time}.txt" tofile=
"${log.file.mjc2wsl}.txt"/>
150 <target name=
"mjc2wsl-samples1" depends=
"build">
151 <!-- simplistic version when antlib (foreach) is not available -->
152 <antcall target=
"mjc2wsl">
153 <param name=
"filename" value=
"samples-temp/sample0.obj" />
158 <!-- MicroJava related tasks -->
161 <target name=
"mj-build" depends=
"init" description=
"build the mj compiler">
162 <javac srcdir=
"${compiler.src.dir}" destdir=
"${compiler.class.dir}" includeAntRuntime='no'
/>
165 <target name=
"mj-compile" description=
"compile a MJ into obj file; given ${filename}">
166 <echo message=
"${filename}" />
167 <java classpath=
"${compiler.class.dir}:${compiler.class.jar}" classname=
"${compiler.classname.compiler}">
168 <arg value=
"${filename}" />
172 <target name=
"mj-samples" description=
"run the mj compiler on the samples" depends=
"init">
173 <foreach param=
"filename" target=
"mj-compile" parallel=
"true" maxthreads=
"${global.max.threads}">
175 <fileset dir='${samples.temp.dir}'
>
176 <include name=
"*.mj"/>
182 <target name=
"mj-decode" description=
"decode a MJ obj file given in ${filename}">
183 <echo message=
"${filename}" />
184 <java classpath=
"${compiler.class.dir}:${compiler.class.jar}" classname=
"${compiler.classname.decoder}">
185 <arg value=
"${filename}" />
189 <target name=
"mj-decode-samples" description=
"decode all of the compiled samples and save into file 'decoded.txt'">
190 <record name=
"${samples.temp.dir}/decoded.txt" emacsmode=
"true" loglevel=
"info"/>
191 <foreach param=
"filename" target=
"mj-decode">
193 <fileset dir='${samples.temp.dir}'
>
194 <include name=
"*.obj"/>
198 <record name=
"${samples.temp.dir}/decoded.txt" action=
"stop"/>
201 <target name=
"mj-run" description=
"run a MJ obj file given in ${filename} with ${inputstring}">
202 <echo message=
"${filename}" />
203 <java classpath=
"${compiler.class.dir}:${compiler.class.jar}" classname=
"${compiler.classname.interpreter}" inputstring=
"${inputstring}">
204 <arg value=
"${filename}" />
208 <target name=
"mj-samples1" depends=
"mj-build">
209 <!-- simplistic version when antlib (foreach) is not available -->
210 <antcall target=
"mj-compile">
211 <param name=
"filename" value=
"samples-temp/sample.mj" />
213 <antcall target=
"mj-compile">
214 <param name=
"filename" value=
"samples-temp/sample1.mj" />
216 <antcall target=
"mj-compile">
217 <param name=
"filename" value=
"samples-temp/sample0.mj" />
222 <!-- wsl related tasks -->
224 <target name=
"wsl-run" >
225 <property name=
"args" value=
""/>
226 <exec executable=
"${fermat.dir}/bin/wsl" inputstring=
"${inputstring}">
227 <env key=
"PATH" path=
"${fermat.dir}/bin:${env.PATH}"/>
228 <env key=
"FermaT" path=
"${fermat.dir}" />
229 <env key=
"SCHEME_LIBRARY_PATH" path=
"${fermat.dir}/slib/" />
230 <env key=
"SCM_INIT_PATH" path=
"${fermat.dir}/scm/Init5e7.scm" />
231 <arg line=
"${filename} ${args}"/>
235 <target name=
"wsl-transf"
236 description=
"transform (simplify) a single wsl file generated by mjc2wsl">
238 <antcall target=
"wsl-run">
239 <param name=
"filename" value=
"${transf.wsl.file}" />
240 <param name=
"args" value=
"${transf.filename}" />
244 <target name=
"wsl-transf-samples" depends=
"init"
245 description=
"transform (simplify) the wsl files generated by mjc2wsl" >
246 <record name=
"${log.file.transformations}${time}.txt" emacsmode=
"true" />
247 <foreach param=
"transf.filename" target=
"wsl-transf" parallel=
"true" maxthreads=
"${global.max.threads}">
249 <fileset dir='${samples.temp.dir}'
>
250 <patternset refid=
"non.transformed.sources"/>
254 <record name=
"${log.file.transformations}${time}.txt" action=
"stop" />
255 <copy file=
"${log.file.transformations}${time}.txt" tofile=
"${log.file.transformations}.txt"/>
258 <target name=
"wsl-transf-samples-ini" depends=
"init-time,make-transf-ini-samples"
259 description=
"transform (simplify) the wsl files generated by mjc2wsl - uses ini file">
260 <record name=
"${log.file.transformations}${time}i.txt" emacsmode=
"true" />
261 <antcall target=
"wsl-run">
262 <param name=
"filename" value=
"${transf.wsl.file}" />
264 <record name=
"${log.file.transformations}${time}i.txt" action=
"stop" />
265 <copy file=
"${log.file.transformations}${time}i.txt" tofile=
"${log.file.transformations}.txt"/>
268 <target name=
"make-transf-ini-samples">
269 <fileset dir=
"${samples.temp.dir}" casesensitive=
"no" id=
"generated-wsl-fileset">
270 <patternset refid=
"non.transformed.sources"/>
272 <pathconvert pathsep=
"${line.separator}"
273 property=
"generated-wsl-files" refid=
"generated-wsl-fileset" />
275 <echo file=
"${transf.wsl.ini}">${generated-wsl-files}
</echo>
278 <!-- Testing tasks -->
280 <target name=
"manual-test-run"
281 description=
"run .obj .wsl ${transf.wsl.ext}, given are ${file.dir}, ${file.name} (no extension) and an ${inputstring}">
282 <record name=
"${file.dir}/${file.name}.out1" emacsmode=
"true" />
283 <antcall target=
"mj-run">
284 <param name=
"filename" value=
"${file.dir}/${file.name}.obj" />
285 <param name=
"inputstring" value=
"${inputstring}" />
287 <record name=
"${file.dir}/${file.name}.out1" action=
"stop" />
288 <record name=
"${file.dir}/${file.name}.out2" emacsmode=
"true" />
289 <antcall target=
"wsl-run">
290 <param name=
"filename" value=
"${file.dir}/${file.name}.wsl" />
291 <param name=
"inputstring" value=
"${inputstring}" />
293 <record name=
"${file.dir}/${file.name}.out2" action=
"stop" />
294 <record name=
"${file.dir}/${file.name}.out3" emacsmode=
"true" />
295 <antcall target=
"wsl-run">
296 <param name=
"filename" value=
"${file.dir}/${file.name}${transf.wsl.ext}" />
297 <param name=
"inputstring" value=
"${inputstring}" />
299 <record name=
"${file.dir}/${file.name}.out3" action=
"stop" />
302 <target name=
"manual-test-run-samples-dir"
303 description=
"run .obj .wsl ${transf.wsl.ext}, in the samples-temp directory; given ${file.name} (no extension) and an ${inputstring}">
304 <antcall target=
"manual-test-run">
305 <param name=
"file.dir" value=
"${samples.temp.dir}"/>
309 <target name=
"init-compare">
310 <mkdir dir=
"${samples.temp.dir}/outputs"/>
313 <target name=
"test-m-w">
315 <basename property=
"file.out" file=
"${inputfile}" suffix=
".txt"/>
317 <java classpath=
"${compiler.class.dir}:${compiler.class.jar}"
318 classname=
"${compiler.classname.interpreter}"
320 error=
"${samples.temp.dir}/outputs/${file.out}.errmj"
321 output=
"${samples.temp.dir}/outputs/${file.out}.outmj">
322 <arg value=
"${file.dir}/${file.name}.obj" />
325 <exec executable=
"${fermat.dir}/bin/wsl"
327 error=
"${samples.temp.dir}/outputs/${file.out}.errwsl"
328 output=
"${samples.temp.dir}/outputs/${file.out}.outwsl" >
329 <env key=
"PATH" path=
"${fermat.dir}/bin:${env.PATH}"/>
330 <env key=
"FermaT" path=
"${fermat.dir}" />
331 <env key=
"SCHEME_LIBRARY_PATH" path=
"${fermat.dir}/slib/" />
332 <env key=
"SCM_INIT_PATH" path=
"${fermat.dir}/scm/Init5e7.scm" />
333 <arg value=
"${file.dir}/${file.name}.wsl"/>
336 <exec executable=
"perl" resultproperty=
"ook">
337 <arg value=
"lib/compare-m-w.pl"/>
338 <arg value=
"${file.dir}/outputs"/>
339 <arg value=
"${file.out}"/>
344 <target name=
"test-w-wt">
346 <basename property=
"file.out" file=
"${inputfile}" suffix=
".txt"/>
348 <exec executable=
"${fermat.dir}/bin/wsl"
350 error=
"${samples.temp.dir}/outputs/${file.out}.errwsl"
351 output=
"${samples.temp.dir}/outputs/${file.out}.outwsl" >
352 <env key=
"PATH" path=
"${fermat.dir}/bin:${env.PATH}"/>
353 <env key=
"FermaT" path=
"${fermat.dir}" />
354 <env key=
"SCHEME_LIBRARY_PATH" path=
"${fermat.dir}/slib/" />
355 <env key=
"SCM_INIT_PATH" path=
"${fermat.dir}/scm/Init5e7.scm" />
356 <arg value=
"${file.dir}/${file.name}.wsl"/>
359 <exec executable=
"${fermat.dir}/bin/wsl"
361 error=
"${samples.temp.dir}/outputs/${file.out}.errwslt"
362 output=
"${samples.temp.dir}/outputs/${file.out}.outwslt" >
363 <env key=
"PATH" path=
"${fermat.dir}/bin:${env.PATH}"/>
364 <env key=
"FermaT" path=
"${fermat.dir}" />
365 <env key=
"SCHEME_LIBRARY_PATH" path=
"${fermat.dir}/slib/" />
366 <env key=
"SCM_INIT_PATH" path=
"${fermat.dir}/scm/Init5e7.scm" />
367 <arg value=
"${file.dir}/${file.name}${transf.wsl.ext}"/>
370 <exec executable=
"perl">
371 <arg value=
"lib/compare-w-wt.pl"/>
372 <arg value=
"${file.dir}/outputs"/>
373 <arg value=
"${file.out}"/>
377 <target name=
"test-fn">
378 <basename property=
"file.name" file=
"${filename}" suffix=
".obj"/>
379 <dirname property=
"file.dir" file=
"${filename}"/>
380 <foreach param=
"inputfile" target=
"test-m-w" inheritall=
"true">
382 <fileset dir='${tests.dir}'
>
383 <include name=
"${file.name}*.txt"/>
389 <target name=
"test-fn-t">
390 <basename property=
"file.name" file=
"${filename}" suffix=
"${transf.wsl.ext}"/>
391 <dirname property=
"file.dir" file=
"${filename}"/>
392 <foreach param=
"inputfile" target=
"test-w-wt" inheritall=
"true">
394 <fileset dir='${tests.dir}'
>
395 <include name=
"${file.name}*.txt"/>
401 <target name=
"test-all-m" depends=
"init-compare"
402 description=
"Run all the tests from the test directory to compare MJ and WSL" >
403 <foreach param=
"filename" target=
"test-fn" inheritall=
"true">
405 <fileset dir='${samples.temp.dir}'
>
406 <include name=
"*.obj"/>
412 <target name=
"test-all-t" depends=
"init-compare"
413 description=
"Run all the tests from the test directory to compare WSL and transformations" >
414 <foreach param=
"filename" target=
"test-fn-t">
416 <fileset dir='${samples.temp.dir}'
>
417 <include name=
"*${transf.wsl.ext}"/>
423 <target name=
"q-test">
424 <!-- for quick tests -->
425 <antcall target=
"test-fn">
426 <param name=
"file.name" value=
"Rek1"/>
427 <param name=
"file.dir" value=
"${samples.temp.dir}"/>
431 <!-- output serveral versions of files -->
433 <target name=
"output-all-versions"
434 description=
"generate variations on the translations in the 'local' folder and tar them">
436 <target name=
"mj-samples"/>
437 <target name=
"mjc2wsl-samples"/>
438 <param name=
"samples.temp.dir" value=
"local/out/headTail-proc"/>
439 <param name=
"mjc2wsl.options" value=
""/>
442 <target name=
"mj-samples"/>
443 <target name=
"mjc2wsl-samples"/>
444 <param name=
"samples.temp.dir" value=
"local/out/headTail-inline"/>
445 <param name=
"mjc2wsl.options" value=
"--genInlinePrint"/>
448 <target name=
"mj-samples"/>
449 <target name=
"mjc2wsl-samples"/>
450 <param name=
"samples.temp.dir" value=
"local/out/popPush-inline"/>
451 <param name=
"mjc2wsl.options" value=
"--genPopPush --genInlinePrint"/>
454 <target name=
"mj-samples"/>
455 <target name=
"mjc2wsl-samples"/>
456 <param name=
"samples.temp.dir" value=
"local/out/popPush-proc"/>
457 <param name=
"mjc2wsl.options" value=
"--genPopPush"/>
460 <target name=
"mj-samples"/>
461 <target name=
"mjc2wsl-samples"/>
462 <param name=
"samples.temp.dir" value=
"local/out/popPush-glob"/>
463 <param name=
"mjc2wsl.options" value=
"--genPopPush --genGlobalVars"/>
465 <tar basedir=
"local/out" compression=
"gzip"
466 destfile=
"local/mjc2wsl-samples.tgz"
470 <!-- jedit specific flags; needs to be the first or the last 10 lines