projekti pod git sistemom za održavanje verzija -- projects under
the git version control system
1 <project name=
"asm2wsl" default=
"all">
3 Builder script for asm2wsl and related tools
6 <!-- use this file for any custom local needs -->
7 <property file=
"custom.properties"/>
8 <property environment=
"env"/>
9 <!-- try and detect the fermat.dir based on the operating system
10 should be set as a custom value in "custom.properties"
11 if it's in a non default location.
13 <condition property=
"fermat.dir" value=
"C:\fermat3">
14 <os family=
"windows" />
17 <condition property=
"fermat.dir" value=
"${user.home}/fermat3">
18 <not><os family=
"windows" /></not>
21 <property name=
"java.encoding" value=
"utf-8" />
22 <taskdef resource=
"net/sf/antcontrib/antlib.xml"/>
24 <!-- **************************************** -->
25 <!-- main variables that can be altered in the
26 properties file or through command line switches.
28 <!-- **************************************** -->
30 <!-- when using multiple threads there is a problem with logging!-->
31 <property name=
"global.max.threads" value=
"1" />
33 <property name=
"asm2wsl.class.dir" value=
"bin" />
34 <property name=
"asm2wsl.src.dir" value=
"src" />
35 <property name=
"asm2wsl.options" value=
"" />
37 <property name=
"asm.extension" value=
"asm" />
39 <property name=
"res.dir" value=
"res" />
40 <property name=
"dist.dir" value=
"dist" />
42 <property name=
"samples.main.dir" value=
"samples" />
43 <property name=
"samples.temp.dir" value=
"temp" />
45 <property name=
"transf.wsl.file" value=
"src-wsl/transf-min.wsl" />
46 <property name=
"transf.wsl.ext" value=
"_t.wsl" />
47 <!-- args can be used to send additional arguments to a script -->
48 <property name=
"transf.wsl.args" value=
"" />
50 <property name=
"metrics.wsl.file" value=
"src-wsl/metrics_csv.wsl" />
51 <property name=
"metrics.extension" value=
".met" />
53 <property name=
"tests.dir" value=
"tests" />
55 <property name=
"log.dir" value=
"${basedir}/logs" />
56 <property name=
"log.file.transformations" value=
"${log.dir}/transformations" />
57 <property name=
"log.file.asm2wsl" value=
"${log.dir}/asm2wsl" />
58 <property name=
"log.file.tests.t" value=
"${log.dir}/tests-wsl" />
60 <!-- **************************************** -->
62 <!-- **************************************** -->
64 <patternset id=
"non.transformed.sources">
65 <include name=
"**/*.wsl"/>
66 <exclude name=
"**/*${transf.wsl.ext}"/>
69 <patternset id=
"transformed.sources">
70 <include name=
"**/*${transf.wsl.ext}"/>
73 <!-- **************************************** -->
74 <!-- general tasks -->
75 <!-- **************************************** -->
77 <target name=
"init" depends=
"init-time">
78 <mkdir dir=
"${asm2wsl.class.dir}"/>
79 <mkdir dir=
"${samples.temp.dir}"/>
80 <mkdir dir=
"${log.dir}"/>
81 <mkdir dir=
"${dist.dir}"/>
82 <copy todir=
"${samples.temp.dir}">
83 <fileset dir=
"${samples.main.dir}">
84 <include name=
"*.${asm.extension}"/>
89 <target name=
"init-time">
91 <format property=
"time" pattern=
"yy-MM-dd--HH-mm-ss"/>
95 <target name=
"all" depends='asm2wsl-samples,wsl-transf-samples'
96 description=
"build the tools, run them on the samples to check">
100 <target name=
"clean" description=
"clean up all the generated content">
101 <delete includeemptydirs=
"true">
102 <fileset dir=
"${asm2wsl.class.dir}"/>
103 <fileset dir=
"${samples.temp.dir}"/>
104 <fileset dir=
"${log.dir}"/>
108 <!-- **************************************** -->
109 <!-- asm2wsl related tasks -->
110 <!-- **************************************** -->
113 <target name=
"build" depends=
"init" description=
"build the asm2wsl tool">
114 <javac srcdir=
"${asm2wsl.src.dir}" destdir=
"${asm2wsl.class.dir}" includeAntRuntime='no' debug='on'
/>
115 <copy todir=
"${asm2wsl.class.dir}">
116 <fileset dir=
"${res.dir}"/>
120 <target name=
"asm2wsl">
121 <echo message=
"${filename}" />
122 <java classpath=
"${asm2wsl.class.dir}:${res.dir}" classname=
"asm2wsl">
123 <arg line=
"${asm2wsl.options}" />
124 <arg value=
"${filename}" />
128 <target name=
"asm2wsl-samples" depends=
"build,init-time" description=
"run the asm2wsl tool on the samples">
129 <record name=
"${log.file.asm2wsl}${time}.txt" emacsmode=
"true" />
130 <echo>Used options:${asm2wsl.options}
</echo>
131 <foreach param=
"filename" target=
"asm2wsl" parallel=
"true" maxthreads=
"${global.max.threads}">
133 <fileset dir='${samples.temp.dir}'
>
134 <include name=
"*.${asm.extension}"/>
138 <record name=
"${log.file.asm2wsl}${time}.txt" action=
"stop" />
139 <copy file=
"${log.file.asm2wsl}${time}.txt" tofile=
"${log.file.asm2wsl}.txt"/>
142 <!-- **************************************** -->
143 <!-- wsl related tasks -->
144 <!-- **************************************** -->
146 <target name=
"wsl-run" >
147 <property name=
"args" value=
""/>
148 <property name=
"wslrun.workdir" value=
""/>
149 <exec executable=
"${fermat.dir}/bin/wsl" inputstring=
"${inputstring}"
150 dir=
"${wslrun.workdir}" >
151 <env key=
"PATH" path=
"${fermat.dir}/bin:${env.PATH}"/>
152 <env key=
"FermaT" path=
"${fermat.dir}" />
153 <env key=
"SCHEME_LIBRARY_PATH" path=
"${fermat.dir}/slib/" />
154 <env key=
"SCM_INIT_PATH" path=
"${fermat.dir}/scm/Init5e7.scm" />
155 <arg line=
"${filename} ${args}"/>
159 <target name=
"wsl-transf"
160 description=
"transform (simplify) a single wsl file generated by mjc2wsl">
161 <stopwatch name=
"transf-${transf.filename}" action=
"start"/>
162 <antcall target=
"wsl-run">
163 <param name=
"filename" value=
"${transf.wsl.file}" />
164 <param name=
"args" value=
"${transf.wsl.args} ${transf.filename}" />
166 <record name=
"${transf.filename}-time.txt" action=
"start" emacsmode=
"true"/>
167 <stopwatch name=
"transf-${transf.filename}" action=
"total"/>
168 <record name=
"${transf.filename}-time.txt" action=
"stop"/>
171 <target name=
"wsl-transf-samples" depends=
"init"
172 description=
"transform (simplify) the wsl files generated by mjc2wsl" >
173 <record name=
"${log.file.transformations}${time}.txt" emacsmode=
"true" />
174 <foreach param=
"transf.filename" target=
"wsl-transf" parallel=
"true" maxthreads=
"${global.max.threads}">
176 <fileset dir='${samples.temp.dir}'
>
177 <patternset refid=
"non.transformed.sources"/>
182 <record name=
"${log.file.transformations}${time}.txt" action=
"stop" />
183 <copy file=
"${log.file.transformations}${time}.txt" tofile=
"${log.file.transformations}.txt"/>
186 <!-- **************************************** -->
188 <!-- **************************************** -->
190 <target name=
"metrics-compare-wsl">
191 <basename property=
"metrics.temp.name" file=
"${metrics.run.filename}" suffix=
"${transf.wsl.ext}"/>
192 <dirname property=
"metrics.temp.dir" file=
"${metrics.run.filename}"/>
193 <antcall target=
"wsl-run">
194 <param name=
"filename" value=
"${metrics.wsl.file}" />
195 <param name=
"args" value=
"-o ${metrics.temp.dir}/${metrics.temp.name}${metrics.extension} -c ${metrics.temp.dir}/${metrics.temp.name}.wsl ${metrics.temp.dir}/${metrics.temp.name}${transf.wsl.ext}" />
201 <target name=
"metrics-samples-compare-wsl" depends=
"init"
202 description=
"metrics on transformed wsl files (csv file)" >
204 <antcall target=
"wsl-run">
205 <param name=
"filename" value=
"${metrics.wsl.file}" />
206 <param name=
"args" value=
"-o ${samples.temp.dir}/0000-header${metrics.extension} -HC" />
210 <foreach param=
"metrics.run.filename" target=
"metrics-compare-wsl" parallel=
"true" maxthreads=
"${global.max.threads}">
212 <fileset dir='${samples.temp.dir}'
>
213 <patternset refid=
"transformed.sources"/>
218 <concat destfile=
"${samples.temp.dir}/metrics-wsl-compare.csv">
219 <fileset dir=
"${samples.temp.dir}" includes=
"*${metrics.extension}"/>
223 <!-- **************************************** -->
224 <!-- Testing tasks -->
225 <!-- **************************************** -->
227 <target name=
"init-compare">
228 <mkdir dir=
"${samples.temp.dir}/outputs"/>
231 <target name=
"test-w-wt">
233 <basename property=
"file.out" file=
"${inputfile}" suffix=
".txt"/>
235 <exec executable=
"${fermat.dir}/bin/wsl"
237 error=
"${samples.temp.dir}/outputs/${file.out}.errwsl"
238 output=
"${samples.temp.dir}/outputs/${file.out}.outwsl" >
239 <env key=
"PATH" path=
"${fermat.dir}/bin:${env.PATH}"/>
240 <env key=
"FermaT" path=
"${fermat.dir}" />
241 <env key=
"SCHEME_LIBRARY_PATH" path=
"${fermat.dir}/slib/" />
242 <env key=
"SCM_INIT_PATH" path=
"${fermat.dir}/scm/Init5e7.scm" />
243 <arg value=
"${file.dir}/${file.name}.wsl"/>
246 <exec executable=
"${fermat.dir}/bin/wsl"
248 error=
"${samples.temp.dir}/outputs/${file.out}.errwslt"
249 output=
"${samples.temp.dir}/outputs/${file.out}.outwslt" >
250 <env key=
"PATH" path=
"${fermat.dir}/bin:${env.PATH}"/>
251 <env key=
"FermaT" path=
"${fermat.dir}" />
252 <env key=
"SCHEME_LIBRARY_PATH" path=
"${fermat.dir}/slib/" />
253 <env key=
"SCM_INIT_PATH" path=
"${fermat.dir}/scm/Init5e7.scm" />
254 <arg value=
"${file.dir}/${file.name}${transf.wsl.ext}"/>
257 <exec executable=
"perl">
258 <arg value=
"lib/compare-w-wt.pl"/>
259 <arg value=
"${file.dir}/outputs"/>
260 <arg value=
"${file.out}"/>
264 <target name=
"test-fn-t">
265 <basename property=
"file.name" file=
"${filename}" suffix=
"${transf.wsl.ext}"/>
266 <dirname property=
"file.dir" file=
"${filename}"/>
267 <foreach param=
"inputfile" target=
"test-w-wt" inheritall=
"true">
269 <fileset dir='${tests.dir}'
>
270 <include name=
"${file.name}*.txt"/>
276 <target name=
"test-all-t" depends=
"init-compare,init-time"
277 description=
"Run all the tests from the test directory to compare WSL and transformations" >
278 <record name=
"${log.file.tests.t}${time}.txt" emacsmode=
"true" />
279 <foreach param=
"filename" target=
"test-fn-t">
281 <fileset dir='${samples.temp.dir}'
>
282 <include name=
"*${transf.wsl.ext}"/>
286 <record name=
"${log.file.tests.t}${time}.txt" action=
"stop" />
287 <move file=
"${log.file.tests.t}.txt" tofile=
"${log.file.tests.t}-previous.txt" failonerror=
"false"/>
288 <copy file=
"${log.file.tests.t}${time}.txt" tofile=
"${log.file.tests.t}.txt"/>