gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
Merge branch 'vars' into work
[mjc2wsl.git] / build.xml
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" />
7 </condition>
9 <condition property="fermat.dir" value="${user.home}/fermat3">
10 <not><os family="windows" /></not>
11 </condition>
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" />
40 <description>
41 Builder script for mjc2wsl and related tools, runs test
42 on given samples.
44 Also gives options to chain the tools on individual files.
45 </description>
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"/>
57 </fileset>
58 </copy>
59 </target>
61 <target name="init-time">
62 <tstamp>
63 <format property="time" pattern="yy-MM-dd--HH-mm-ss"/>
64 </tstamp>
65 </target>
67 <target name="all" depends='mj-samples,mjc2wsl-samples,wsl-transf-samples'
68 description="build the tools, run them on the samples to check">
70 </target>
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}"/>
78 </delete>
79 </target>
82 <!-- mjc2wsl related tasks -->
84 <target name="build" depends="init" description="build the mjc2wsl tool">
85 <javac srcdir="${mjc2wsl.src.dir}" destdir="${mjc2wsl.class.dir}" includeAntRuntime='no' />
86 </target>
88 <target name="mjc2wsl">
89 <echo message="${filename}" />
90 <java classpath="${mjc2wsl.class.dir}:${res.dir}" classname="mjc2wsl">
91 <arg line="${mjc2wsl.options}" />
92 <arg value="${filename}" />
93 </java>
94 </target>
96 <target name="mjc2wsl-samples" depends="build,init-time" description="run the mjc2wsl tool on the samples">
97 <record name="${log.file.mjc2wsl}${time}.txt" emacsmode="true" />
98 <echo>Used options:${mjc2wsl.options}</echo>
99 <foreach param="filename" target="mjc2wsl">
100 <path>
101 <fileset dir='${samples.temp.dir}'>
102 <include name="*.obj"/>
103 </fileset>
104 </path>
105 </foreach>
106 <record name="${log.file.mjc2wsl}${time}.txt" action="stop" />
107 <copy file="${log.file.mjc2wsl}${time}.txt" tofile="${log.file.mjc2wsl}.txt"/>
108 </target>
110 <target name="mjc2wsl-samples1" depends="build">
111 <!-- simplistic version when antlib (foreach) is not available -->
112 <antcall target="mjc2wsl">
113 <param name="filename" value="samples-temp/sample0.obj" />
114 </antcall>
115 </target>
118 <!-- MicroJava related tasks -->
121 <target name="mj-build" depends="init" description="build the mj compiler">
122 <javac srcdir="${compiler.src.dir}" destdir="${compiler.class.dir}" includeAntRuntime='no' />
123 </target>
125 <target name="mj-compile" description="compile a MJ into obj file; given ${filename}">
126 <echo message="${filename}" />
127 <java classpath="${compiler.class.dir}:${compiler.class.jar}" classname="${compiler.classname.compiler}">
128 <arg value="${filename}" />
129 </java>
130 </target>
132 <target name="mj-samples" description="run the mj compiler on the samples">
133 <foreach param="filename" target="mj-compile">
134 <path>
135 <fileset dir='${samples.temp.dir}'>
136 <include name="*.mj"/>
137 </fileset>
138 </path>
139 </foreach>
140 </target>
142 <target name="mj-decode" description="decode a MJ obj file given in ${filename}">
143 <echo message="${filename}" />
144 <java classpath="${compiler.class.dir}:${compiler.class.jar}" classname="${compiler.classname.decoder}">
145 <arg value="${filename}" />
146 </java>
147 </target>
149 <target name="mj-decode-samples" description="decode all of the compiled samples and save into file 'decoded.txt'">
150 <record name="${samples.temp.dir}/decoded.txt" emacsmode="true" loglevel="info"/>
151 <foreach param="filename" target="mj-decode">
152 <path>
153 <fileset dir='${samples.temp.dir}'>
154 <include name="*.obj"/>
155 </fileset>
156 </path>
157 </foreach>
158 <record name="${samples.temp.dir}/decoded.txt" action="stop"/>
159 </target>
161 <target name="mj-run" description="run a MJ obj file given in ${filename} with ${inputstring}">
162 <echo message="${filename}" />
163 <java classpath="${compiler.class.dir}:${compiler.class.jar}" classname="${compiler.classname.interpreter}" inputstring="${inputstring}">
164 <arg value="${filename}" />
165 </java>
166 </target>
168 <target name="mj-samples1" depends="mj-build">
169 <!-- simplistic version when antlib (foreach) is not available -->
170 <antcall target="mj-compile">
171 <param name="filename" value="samples-temp/sample.mj" />
172 </antcall>
173 <antcall target="mj-compile">
174 <param name="filename" value="samples-temp/sample1.mj" />
175 </antcall>
176 <antcall target="mj-compile">
177 <param name="filename" value="samples-temp/sample0.mj" />
178 </antcall>
179 </target>
182 <!-- wsl related tasks -->
184 <target name="wsl-run" >
185 <exec executable="${fermat.dir}/bin/wsl" inputstring="${inputstring}">
186 <env key="PATH" path="${fermat.dir}/bin:${env.PATH}"/>
187 <env key="FermaT" path="${fermat.dir}" />
188 <env key="SCHEME_LIBRARY_PATH" path="${fermat.dir}/slib/" />
189 <env key="SCM_INIT_PATH" path="${fermat.dir}/scm/Init5e7.scm" />
190 <arg value="${filename}"/>
191 </exec>
192 </target>
194 <target name="wsl-transf"
195 description="transform (simplify) a single wsl file generated by mjc2wsl">
196 <delete file="${transf.wsl.ini}"/>
198 <antcall target="wsl-run">
199 <param name="filename" value="${transf.wsl.file}" />
200 <param name="inputstring" value="${transf.filename}" />
201 </antcall>
202 </target>
204 <target name="wsl-transf-samples" depends="init-time,make-transf-ini-samples"
205 description="transform (simplify) the wsl files generated by mjc2wsl">
206 <record name="${log.file.transformations}${time}.txt" emacsmode="true" />
207 <antcall target="wsl-run">
208 <param name="filename" value="${transf.wsl.file}" />
209 </antcall>
210 <record name="${log.file.transformations}${time}.txt" action="stop" />
211 <copy file="${log.file.transformations}${time}.txt" tofile="${log.file.transformations}.txt"/>
212 </target>
214 <target name="make-transf-ini-samples">
215 <fileset dir="${samples.temp.dir}" casesensitive="no" id="generated-wsl-fileset">
216 <patternset id="non.transformed.sources">
217 <include name="**/*.wsl"/>
218 <exclude name="**/*_t.wsl"/>
219 </patternset>
220 </fileset>
221 <pathconvert pathsep="${line.separator}"
222 property="generated-wsl-files" refid="generated-wsl-fileset" />
224 <echo file="${transf.wsl.ini}">${generated-wsl-files}</echo>
225 </target>
227 <!-- Testing tasks -->
229 <target name="test-run"
230 description="run .obj .wsl _t.wsl, given are ${file.dir}, ${file.name} (no extension) and an ${inputstring}">
231 <antcall target="mj-run">
232 <param name="filename" value="${file.dir}/${file.name}.obj" />
233 <param name="inputstring" value="${inputstring}" />
234 </antcall>
235 <antcall target="wsl-run">
236 <param name="filename" value="${file.dir}/${file.name}.wsl" />
237 <param name="inputstring" value="${inputstring}" />
238 </antcall>
239 <antcall target="wsl-run">
240 <param name="filename" value="${file.dir}/${file.name}_t.wsl" />
241 <param name="inputstring" value="${inputstring}" />
242 </antcall>
243 </target>
245 <target name="test-run-samples-dir"
246 description="run .obj .wsl _t.wsl, in the samples-temp directory; given ${file.name} (no extension) and an ${inputstring}">
247 <antcall target="test-run">
248 <param name="file.dir" value="${samples.temp.dir}"/>
249 </antcall>
250 </target>
252 <!-- jedit specific flags; needs to be the first or the last 10 lines
253 :noTabs=true:
254 -->
255 </project>
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner