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" />
36 <property name=
"tests.dir" value=
"tests" />
38 <property name=
"log.dir" value=
"logs" />
39 <property name=
"log.file.transformations" value=
"${log.dir}/transformations" />
40 <property name=
"log.file.mjc2wsl" value=
"${log.dir}/mjc2wsl" />
43 Builder script for mjc2wsl and related tools, runs test
46 Also gives options to chain the tools on individual files.
49 <!-- general tasks -->
51 <target name=
"init" depends=
"init-time">
52 <mkdir dir=
"${mjc2wsl.class.dir}"/>
53 <mkdir dir=
"${compiler.class.dir}"/>
54 <mkdir dir=
"${samples.temp.dir}"/>
55 <mkdir dir=
"${log.dir}"/>
56 <copy todir=
"${samples.temp.dir}">
57 <fileset dir=
"${samples.main.dir}">
58 <include name=
"*.mj"/>
63 <target name=
"init-time">
65 <format property=
"time" pattern=
"yy-MM-dd--HH-mm-ss"/>
69 <target name=
"all" depends='mj-samples,mjc2wsl-samples,wsl-transf-samples'
70 description=
"build the tools, run them on the samples to check">
74 <target name=
"clean" description=
"clean up all the generated content">
75 <delete includeemptydirs=
"true">
76 <fileset dir=
"${mjc2wsl.class.dir}"/>
77 <fileset dir=
"${compiler.class.dir}"/>
78 <fileset dir=
"${samples.temp.dir}"/>
79 <fileset dir=
"${log.dir}"/>
84 based on ideas by Jesper Öqvist http://llbit.se/?p=1876 -->
86 <!-- this target is only run if the 'version' property is undefined -->
88 <target name=
"update-version-string" unless=
"version">
89 <!-- get a new version string using git describe if possible -->
90 <echo message=
"Updating version string..."/>
91 <exec executable=
"git" outputproperty=
"version"
92 failifexecutionfails=
"false">
93 <arg value=
"describe"/>
95 <antcall target=
"-store-version-string"/>
96 <!-- ensure version is defined even if git was not available -->
97 <property file=
"${res.dir}/version.properties"/>
100 <target name=
"-store-version-string" if=
"version">
101 <!-- store the new version string in the correct property file -->
102 <echo message=
"version=${version}"/>
103 <propertyfile file=
"${res.dir}/version.properties">
104 <entry key=
"version" value=
"${version}"/>
106 <exec executable=
"git" failifexecutionfails=
"false">
107 <arg value=
"update-index"/>
108 <arg value=
"--assume-unchanged"/>
109 <arg value=
"${res.dir}/version.properties"/>
113 <!-- mjc2wsl related tasks -->
115 <target name=
"build" depends=
"init,update-version-string" description=
"build the mjc2wsl tool">
116 <javac srcdir=
"${mjc2wsl.src.dir}" destdir=
"${mjc2wsl.class.dir}" includeAntRuntime='no'
/>
119 <target name=
"mjc2wsl">
120 <echo message=
"${filename}" />
121 <java classpath=
"${mjc2wsl.class.dir}:${res.dir}" classname=
"com.quemaster.transformations.mjc2wsl.mjc2wsl">
122 <arg line=
"${mjc2wsl.options}" />
123 <arg value=
"${filename}" />
127 <target name=
"mjc2wsl-samples" depends=
"build,init-time" description=
"run the mjc2wsl tool on the samples">
128 <record name=
"${log.file.mjc2wsl}${time}.txt" emacsmode=
"true" />
129 <echo>Used options:${mjc2wsl.options}
</echo>
130 <foreach param=
"filename" target=
"mjc2wsl">
132 <fileset dir='${samples.temp.dir}'
>
133 <include name=
"*.obj"/>
137 <record name=
"${log.file.mjc2wsl}${time}.txt" action=
"stop" />
138 <copy file=
"${log.file.mjc2wsl}${time}.txt" tofile=
"${log.file.mjc2wsl}.txt"/>
141 <target name=
"mjc2wsl-samples1" depends=
"build">
142 <!-- simplistic version when antlib (foreach) is not available -->
143 <antcall target=
"mjc2wsl">
144 <param name=
"filename" value=
"samples-temp/sample0.obj" />
149 <!-- MicroJava related tasks -->
152 <target name=
"mj-build" depends=
"init" description=
"build the mj compiler">
153 <javac srcdir=
"${compiler.src.dir}" destdir=
"${compiler.class.dir}" includeAntRuntime='no'
/>
156 <target name=
"mj-compile" description=
"compile a MJ into obj file; given ${filename}">
157 <echo message=
"${filename}" />
158 <java classpath=
"${compiler.class.dir}:${compiler.class.jar}" classname=
"${compiler.classname.compiler}">
159 <arg value=
"${filename}" />
163 <target name=
"mj-samples" description=
"run the mj compiler on the samples" depends=
"init">
164 <foreach param=
"filename" target=
"mj-compile">
166 <fileset dir='${samples.temp.dir}'
>
167 <include name=
"*.mj"/>
173 <target name=
"mj-decode" description=
"decode a MJ obj file given in ${filename}">
174 <echo message=
"${filename}" />
175 <java classpath=
"${compiler.class.dir}:${compiler.class.jar}" classname=
"${compiler.classname.decoder}">
176 <arg value=
"${filename}" />
180 <target name=
"mj-decode-samples" description=
"decode all of the compiled samples and save into file 'decoded.txt'">
181 <record name=
"${samples.temp.dir}/decoded.txt" emacsmode=
"true" loglevel=
"info"/>
182 <foreach param=
"filename" target=
"mj-decode">
184 <fileset dir='${samples.temp.dir}'
>
185 <include name=
"*.obj"/>
189 <record name=
"${samples.temp.dir}/decoded.txt" action=
"stop"/>
192 <target name=
"mj-run" description=
"run a MJ obj file given in ${filename} with ${inputstring}">
193 <echo message=
"${filename}" />
194 <java classpath=
"${compiler.class.dir}:${compiler.class.jar}" classname=
"${compiler.classname.interpreter}" inputstring=
"${inputstring}">
195 <arg value=
"${filename}" />
199 <target name=
"mj-samples1" depends=
"mj-build">
200 <!-- simplistic version when antlib (foreach) is not available -->
201 <antcall target=
"mj-compile">
202 <param name=
"filename" value=
"samples-temp/sample.mj" />
204 <antcall target=
"mj-compile">
205 <param name=
"filename" value=
"samples-temp/sample1.mj" />
207 <antcall target=
"mj-compile">
208 <param name=
"filename" value=
"samples-temp/sample0.mj" />
213 <!-- wsl related tasks -->
215 <target name=
"wsl-run" >
216 <exec executable=
"${fermat.dir}/bin/wsl" inputstring=
"${inputstring}">
217 <env key=
"PATH" path=
"${fermat.dir}/bin:${env.PATH}"/>
218 <env key=
"FermaT" path=
"${fermat.dir}" />
219 <env key=
"SCHEME_LIBRARY_PATH" path=
"${fermat.dir}/slib/" />
220 <env key=
"SCM_INIT_PATH" path=
"${fermat.dir}/scm/Init5e7.scm" />
221 <arg value=
"${filename}"/>
225 <target name=
"wsl-transf"
226 description=
"transform (simplify) a single wsl file generated by mjc2wsl">
227 <delete file=
"${transf.wsl.ini}"/>
229 <antcall target=
"wsl-run">
230 <param name=
"filename" value=
"${transf.wsl.file}" />
231 <param name=
"inputstring" value=
"${transf.filename}" />
235 <target name=
"wsl-transf-samples" depends=
"init-time,make-transf-ini-samples"
236 description=
"transform (simplify) the wsl files generated by mjc2wsl">
237 <record name=
"${log.file.transformations}${time}.txt" emacsmode=
"true" />
238 <antcall target=
"wsl-run">
239 <param name=
"filename" value=
"${transf.wsl.file}" />
241 <record name=
"${log.file.transformations}${time}.txt" action=
"stop" />
242 <copy file=
"${log.file.transformations}${time}.txt" tofile=
"${log.file.transformations}.txt"/>
245 <target name=
"make-transf-ini-samples">
246 <fileset dir=
"${samples.temp.dir}" casesensitive=
"no" id=
"generated-wsl-fileset">
247 <patternset id=
"non.transformed.sources">
248 <include name=
"**/*.wsl"/>
249 <exclude name=
"**/*_t.wsl"/>
252 <pathconvert pathsep=
"${line.separator}"
253 property=
"generated-wsl-files" refid=
"generated-wsl-fileset" />
255 <echo file=
"${transf.wsl.ini}">${generated-wsl-files}
</echo>
258 <!-- Testing tasks -->
260 <target name=
"manual-test-run"
261 description=
"run .obj .wsl _t.wsl, given are ${file.dir}, ${file.name} (no extension) and an ${inputstring}">
262 <record name=
"${file.dir}/${file.name}.out1" emacsmode=
"true" />
263 <antcall target=
"mj-run">
264 <param name=
"filename" value=
"${file.dir}/${file.name}.obj" />
265 <param name=
"inputstring" value=
"${inputstring}" />
267 <record name=
"${file.dir}/${file.name}.out1" action=
"stop" />
268 <record name=
"${file.dir}/${file.name}.out2" emacsmode=
"true" />
269 <antcall target=
"wsl-run">
270 <param name=
"filename" value=
"${file.dir}/${file.name}.wsl" />
271 <param name=
"inputstring" value=
"${inputstring}" />
273 <record name=
"${file.dir}/${file.name}.out2" action=
"stop" />
274 <record name=
"${file.dir}/${file.name}.out3" emacsmode=
"true" />
275 <antcall target=
"wsl-run">
276 <param name=
"filename" value=
"${file.dir}/${file.name}_t.wsl" />
277 <param name=
"inputstring" value=
"${inputstring}" />
279 <record name=
"${file.dir}/${file.name}.out3" action=
"stop" />
282 <target name=
"manual-test-run-samples-dir"
283 description=
"run .obj .wsl _t.wsl, in the samples-temp directory; given ${file.name} (no extension) and an ${inputstring}">
284 <antcall target=
"manual-test-run">
285 <param name=
"file.dir" value=
"${samples.temp.dir}"/>
289 <target name=
"init-compare">
290 <mkdir dir=
"${samples.temp.dir}/outputs"/>
293 <target name=
"test-m-w">
295 <basename property=
"file.out" file=
"${inputfile}" suffix=
".txt"/>
297 <java classpath=
"${compiler.class.dir}:${compiler.class.jar}"
298 classname=
"${compiler.classname.interpreter}"
300 error=
"${samples.temp.dir}/outputs/${file.out}.errmj"
301 output=
"${samples.temp.dir}/outputs/${file.out}.outmj">
302 <arg value=
"${file.dir}/${file.name}.obj" />
305 <exec executable=
"${fermat.dir}/bin/wsl"
307 error=
"${samples.temp.dir}/outputs/${file.out}.errwsl"
308 output=
"${samples.temp.dir}/outputs/${file.out}.outwsl" >
309 <env key=
"PATH" path=
"${fermat.dir}/bin:${env.PATH}"/>
310 <env key=
"FermaT" path=
"${fermat.dir}" />
311 <env key=
"SCHEME_LIBRARY_PATH" path=
"${fermat.dir}/slib/" />
312 <env key=
"SCM_INIT_PATH" path=
"${fermat.dir}/scm/Init5e7.scm" />
313 <arg value=
"${file.dir}/${file.name}.wsl"/>
316 <exec executable=
"perl" resultproperty=
"ook">
317 <arg value=
"lib/compare-m-w.pl"/>
318 <arg value=
"${file.dir}/outputs"/>
319 <arg value=
"${file.out}"/>
324 <target name=
"test-w-wt">
326 <basename property=
"file.out" file=
"${inputfile}" suffix=
".txt"/>
328 <exec executable=
"${fermat.dir}/bin/wsl"
330 error=
"${samples.temp.dir}/outputs/${file.out}.errwsl"
331 output=
"${samples.temp.dir}/outputs/${file.out}.outwsl" >
332 <env key=
"PATH" path=
"${fermat.dir}/bin:${env.PATH}"/>
333 <env key=
"FermaT" path=
"${fermat.dir}" />
334 <env key=
"SCHEME_LIBRARY_PATH" path=
"${fermat.dir}/slib/" />
335 <env key=
"SCM_INIT_PATH" path=
"${fermat.dir}/scm/Init5e7.scm" />
336 <arg value=
"${file.dir}/${file.name}.wsl"/>
339 <exec executable=
"${fermat.dir}/bin/wsl"
341 error=
"${samples.temp.dir}/outputs/${file.out}.errwslt"
342 output=
"${samples.temp.dir}/outputs/${file.out}.outwslt" >
343 <env key=
"PATH" path=
"${fermat.dir}/bin:${env.PATH}"/>
344 <env key=
"FermaT" path=
"${fermat.dir}" />
345 <env key=
"SCHEME_LIBRARY_PATH" path=
"${fermat.dir}/slib/" />
346 <env key=
"SCM_INIT_PATH" path=
"${fermat.dir}/scm/Init5e7.scm" />
347 <arg value=
"${file.dir}/${file.name}_t.wsl"/>
350 <exec executable=
"perl">
351 <arg value=
"lib/compare-w-wt.pl"/>
352 <arg value=
"${file.dir}/outputs"/>
353 <arg value=
"${file.out}"/>
357 <target name=
"test-fn">
358 <basename property=
"file.name" file=
"${filename}" suffix=
".obj"/>
359 <dirname property=
"file.dir" file=
"${filename}"/>
360 <foreach param=
"inputfile" target=
"test-m-w" inheritall=
"true">
362 <fileset dir='${tests.dir}'
>
363 <include name=
"${file.name}*.txt"/>
369 <target name=
"test-fn-t">
370 <basename property=
"file.name" file=
"${filename}" suffix=
"_t.wsl"/>
371 <dirname property=
"file.dir" file=
"${filename}"/>
372 <foreach param=
"inputfile" target=
"test-w-wt" inheritall=
"true">
374 <fileset dir='${tests.dir}'
>
375 <include name=
"${file.name}*.txt"/>
381 <target name=
"test-all-m" depends=
"init-compare"
382 description=
"Run all the tests from the test directory to compare MJ and WSL" >
383 <foreach param=
"filename" target=
"test-fn" inheritall=
"true">
385 <fileset dir='${samples.temp.dir}'
>
386 <include name=
"*.obj"/>
392 <target name=
"test-all-t" depends=
"init-compare"
393 description=
"Run all the tests from the test directory to compare WSL and transformations" >
394 <foreach param=
"filename" target=
"test-fn-t">
396 <fileset dir='${samples.temp.dir}'
>
397 <include name=
"*_t.wsl"/>
403 <target name=
"q-test">
404 <!-- for quick tests -->
405 <antcall target=
"test-fn">
406 <param name=
"file.name" value=
"Rek1"/>
407 <param name=
"file.dir" value=
"${samples.temp.dir}"/>
411 <!-- output serveral versions of files -->
413 <target name=
"output-all-versions"
414 description=
"generate variations on the translations in the 'local' folder and tar them">
416 <target name=
"mj-samples"/>
417 <target name=
"mjc2wsl-samples"/>
418 <param name=
"samples.temp.dir" value=
"local/out/headTail-proc"/>
419 <param name=
"mjc2wsl.options" value=
""/>
422 <target name=
"mj-samples"/>
423 <target name=
"mjc2wsl-samples"/>
424 <param name=
"samples.temp.dir" value=
"local/out/headTail-inline"/>
425 <param name=
"mjc2wsl.options" value=
"--genInlinePrint"/>
428 <target name=
"mj-samples"/>
429 <target name=
"mjc2wsl-samples"/>
430 <param name=
"samples.temp.dir" value=
"local/out/popPush-inline"/>
431 <param name=
"mjc2wsl.options" value=
"--genPopPush --genInlinePrint"/>
434 <target name=
"mj-samples"/>
435 <target name=
"mjc2wsl-samples"/>
436 <param name=
"samples.temp.dir" value=
"local/out/popPush-proc"/>
437 <param name=
"mjc2wsl.options" value=
"--genPopPush"/>
440 <target name=
"mj-samples"/>
441 <target name=
"mjc2wsl-samples"/>
442 <param name=
"samples.temp.dir" value=
"local/out/popPush-glob"/>
443 <param name=
"mjc2wsl.options" value=
"--genPopPush --genGlobalVars"/>
445 <tar basedir=
"local/out" compression=
"gzip"
446 destfile=
"local/mjc2wsl-samples.tgz"
450 <!-- jedit specific flags; needs to be the first or the last 10 lines