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=
"log.dir" value=
"logs" />
37 <property name=
"log.file.transformations" value=
"${log.dir}/transformations" />
38 <property name=
"log.file.mjc2wsl" value=
"${log.dir}/mjc2wsl" />
41 Builder script for mjc2wsl and related tools, runs test
44 Also gives options to chain the tools on individual files.
47 <!-- general tasks -->
49 <target name=
"init" depends=
"init-time">
50 <mkdir dir=
"${mjc2wsl.class.dir}"/>
51 <mkdir dir=
"${compiler.class.dir}"/>
52 <mkdir dir=
"${samples.temp.dir}"/>
53 <mkdir dir=
"${log.dir}"/>
54 <copy todir=
"${samples.temp.dir}">
55 <fileset dir=
"${samples.main.dir}">
56 <include name=
"*.mj"/>
61 <target name=
"init-time">
63 <format property=
"time" pattern=
"yy-MM-dd--HH-mm-ss"/>
67 <target name=
"all" depends='mj-samples,mjc2wsl-samples,wsl-transf-samples'
68 description=
"build the tools, run them on the samples to check">
72 <target name=
"clean" description=
"clean up all the generated content">
73 <delete includeemptydirs=
"true">
74 <fileset dir=
"${mjc2wsl.class.dir}"/>
75 <fileset dir=
"${compiler.class.dir}"/>
76 <fileset dir=
"${samples.temp.dir}"/>
77 <fileset dir=
"${log.dir}"/>
82 based on ideas by Jesper Öqvist http://llbit.se/?p=1876 -->
84 <!-- this target is only run if the 'version' property is undefined -->
86 <target name=
"update-version-string" unless=
"version">
87 <!-- get a new version string using git describe if possible -->
88 <echo message=
"Updating version string..."/>
89 <exec executable=
"git" outputproperty=
"version"
90 failifexecutionfails=
"false">
91 <arg value=
"describe"/>
93 <antcall target=
"-store-version-string"/>
94 <!-- ensure version is defined even if git was not available -->
95 <property file=
"${res.dir}/version.properties"/>
98 <target name=
"-store-version-string" if=
"version">
99 <!-- store the new version string in the correct property file -->
100 <echo message=
"version=${version}"/>
101 <propertyfile file=
"${res.dir}/version.properties">
102 <entry key=
"version" value=
"${version}"/>
104 <exec executable=
"git" failifexecutionfails=
"false">
105 <arg value=
"update-index"/>
106 <arg value=
"--assume-unchanged"/>
107 <arg value=
"${res.dir}/version.properties"/>
111 <!-- mjc2wsl related tasks -->
113 <target name=
"build" depends=
"init,update-version-string" description=
"build the mjc2wsl tool">
114 <javac srcdir=
"${mjc2wsl.src.dir}" destdir=
"${mjc2wsl.class.dir}" includeAntRuntime='no'
/>
117 <target name=
"mjc2wsl">
118 <echo message=
"${filename}" />
119 <java classpath=
"${mjc2wsl.class.dir}:${res.dir}" classname=
"com.quemaster.transformations.mjc2wsl.mjc2wsl">
120 <arg line=
"${mjc2wsl.options}" />
121 <arg value=
"${filename}" />
125 <target name=
"mjc2wsl-samples" depends=
"build,init-time" description=
"run the mjc2wsl tool on the samples">
126 <record name=
"${log.file.mjc2wsl}${time}.txt" emacsmode=
"true" />
127 <echo>Used options:${mjc2wsl.options}
</echo>
128 <foreach param=
"filename" target=
"mjc2wsl">
130 <fileset dir='${samples.temp.dir}'
>
131 <include name=
"*.obj"/>
135 <record name=
"${log.file.mjc2wsl}${time}.txt" action=
"stop" />
136 <copy file=
"${log.file.mjc2wsl}${time}.txt" tofile=
"${log.file.mjc2wsl}.txt"/>
139 <target name=
"mjc2wsl-samples1" depends=
"build">
140 <!-- simplistic version when antlib (foreach) is not available -->
141 <antcall target=
"mjc2wsl">
142 <param name=
"filename" value=
"samples-temp/sample0.obj" />
147 <!-- MicroJava related tasks -->
150 <target name=
"mj-build" depends=
"init" description=
"build the mj compiler">
151 <javac srcdir=
"${compiler.src.dir}" destdir=
"${compiler.class.dir}" includeAntRuntime='no'
/>
154 <target name=
"mj-compile" description=
"compile a MJ into obj file; given ${filename}">
155 <echo message=
"${filename}" />
156 <java classpath=
"${compiler.class.dir}:${compiler.class.jar}" classname=
"${compiler.classname.compiler}">
157 <arg value=
"${filename}" />
161 <target name=
"mj-samples" description=
"run the mj compiler on the samples" depends=
"init">
162 <foreach param=
"filename" target=
"mj-compile">
164 <fileset dir='${samples.temp.dir}'
>
165 <include name=
"*.mj"/>
171 <target name=
"mj-decode" description=
"decode a MJ obj file given in ${filename}">
172 <echo message=
"${filename}" />
173 <java classpath=
"${compiler.class.dir}:${compiler.class.jar}" classname=
"${compiler.classname.decoder}">
174 <arg value=
"${filename}" />
178 <target name=
"mj-decode-samples" description=
"decode all of the compiled samples and save into file 'decoded.txt'">
179 <record name=
"${samples.temp.dir}/decoded.txt" emacsmode=
"true" loglevel=
"info"/>
180 <foreach param=
"filename" target=
"mj-decode">
182 <fileset dir='${samples.temp.dir}'
>
183 <include name=
"*.obj"/>
187 <record name=
"${samples.temp.dir}/decoded.txt" action=
"stop"/>
190 <target name=
"mj-run" description=
"run a MJ obj file given in ${filename} with ${inputstring}">
191 <echo message=
"${filename}" />
192 <java classpath=
"${compiler.class.dir}:${compiler.class.jar}" classname=
"${compiler.classname.interpreter}" inputstring=
"${inputstring}">
193 <arg value=
"${filename}" />
197 <target name=
"mj-samples1" depends=
"mj-build">
198 <!-- simplistic version when antlib (foreach) is not available -->
199 <antcall target=
"mj-compile">
200 <param name=
"filename" value=
"samples-temp/sample.mj" />
202 <antcall target=
"mj-compile">
203 <param name=
"filename" value=
"samples-temp/sample1.mj" />
205 <antcall target=
"mj-compile">
206 <param name=
"filename" value=
"samples-temp/sample0.mj" />
211 <!-- wsl related tasks -->
213 <target name=
"wsl-run" >
214 <exec executable=
"${fermat.dir}/bin/wsl" inputstring=
"${inputstring}">
215 <env key=
"PATH" path=
"${fermat.dir}/bin:${env.PATH}"/>
216 <env key=
"FermaT" path=
"${fermat.dir}" />
217 <env key=
"SCHEME_LIBRARY_PATH" path=
"${fermat.dir}/slib/" />
218 <env key=
"SCM_INIT_PATH" path=
"${fermat.dir}/scm/Init5e7.scm" />
219 <arg value=
"${filename}"/>
223 <target name=
"wsl-transf"
224 description=
"transform (simplify) a single wsl file generated by mjc2wsl">
225 <delete file=
"${transf.wsl.ini}"/>
227 <antcall target=
"wsl-run">
228 <param name=
"filename" value=
"${transf.wsl.file}" />
229 <param name=
"inputstring" value=
"${transf.filename}" />
233 <target name=
"wsl-transf-samples" depends=
"init-time,make-transf-ini-samples"
234 description=
"transform (simplify) the wsl files generated by mjc2wsl">
235 <record name=
"${log.file.transformations}${time}.txt" emacsmode=
"true" />
236 <antcall target=
"wsl-run">
237 <param name=
"filename" value=
"${transf.wsl.file}" />
239 <record name=
"${log.file.transformations}${time}.txt" action=
"stop" />
240 <copy file=
"${log.file.transformations}${time}.txt" tofile=
"${log.file.transformations}.txt"/>
243 <target name=
"make-transf-ini-samples">
244 <fileset dir=
"${samples.temp.dir}" casesensitive=
"no" id=
"generated-wsl-fileset">
245 <patternset id=
"non.transformed.sources">
246 <include name=
"**/*.wsl"/>
247 <exclude name=
"**/*_t.wsl"/>
250 <pathconvert pathsep=
"${line.separator}"
251 property=
"generated-wsl-files" refid=
"generated-wsl-fileset" />
253 <echo file=
"${transf.wsl.ini}">${generated-wsl-files}
</echo>
256 <!-- Testing tasks -->
258 <target name=
"test-run"
259 description=
"run .obj .wsl _t.wsl, given are ${file.dir}, ${file.name} (no extension) and an ${inputstring}">
260 <record name=
"${file.dir}/${file.name}.out1" emacsmode=
"true" />
261 <antcall target=
"mj-run">
262 <param name=
"filename" value=
"${file.dir}/${file.name}.obj" />
263 <param name=
"inputstring" value=
"${inputstring}" />
265 <record name=
"${file.dir}/${file.name}.out1" action=
"stop" />
266 <record name=
"${file.dir}/${file.name}.out2" emacsmode=
"true" />
267 <antcall target=
"wsl-run">
268 <param name=
"filename" value=
"${file.dir}/${file.name}.wsl" />
269 <param name=
"inputstring" value=
"${inputstring}" />
271 <record name=
"${file.dir}/${file.name}.out2" action=
"stop" />
272 <record name=
"${file.dir}/${file.name}.out3" emacsmode=
"true" />
273 <antcall target=
"wsl-run">
274 <param name=
"filename" value=
"${file.dir}/${file.name}_t.wsl" />
275 <param name=
"inputstring" value=
"${inputstring}" />
277 <record name=
"${file.dir}/${file.name}.out3" action=
"stop" />
280 <target name=
"test-run-samples-dir"
281 description=
"run .obj .wsl _t.wsl, in the samples-temp directory; given ${file.name} (no extension) and an ${inputstring}">
282 <antcall target=
"test-run">
283 <param name=
"file.dir" value=
"${samples.temp.dir}"/>
287 <!-- jedit specific flags; needs to be the first or the last 10 lines