gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
transf-min does not need to explicitly Simplify, it's called anyway
[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.dir" value="lib/compiler-bin" />
24 <property name="compiler.src.dir" value="lib/compiler-src" />
25 <property name="compiler.classname.compiler" value="MJ.Compiler" />
26 <property name="compiler.classname.interpreter" value="MJ.Run" />
27 <property name="compiler.classname.decoder" value="MJ.Decode" />
29 <property name="samples.main.dir" value="samples" />
30 <property name="samples.temp.dir" value="temp" />
32 <property name="transf.wsl.file" value="src-wsl/transf-min.wsl" />
33 <property name="transf.wsl.ini" value="transf.ini" />
35 <property name="log.dir" value="logs" />
36 <property name="log.file.transformations" value="${log.dir}/transformations" />
37 <property name="log.file.mjc2wsl" value="${log.dir}/mjc2wsl" />
39 <description>
40 Builder script for mjc2wsl and related tools, runs test
41 on given samples.
43 Also gives options to chain the tools on individual files.
44 </description>
46 <!-- general tasks -->
48 <target name="init" depends="init-time">
49 <mkdir dir="${mjc2wsl.class.dir}"/>
50 <mkdir dir="${compiler.class.dir}"/>
51 <mkdir dir="${samples.temp.dir}"/>
52 <mkdir dir="${log.dir}"/>
53 <copy todir="${samples.temp.dir}">
54 <fileset dir="${samples.main.dir}">
55 <include name="*.mj"/>
56 </fileset>
57 </copy>
58 </target>
60 <target name="init-time">
61 <tstamp>
62 <format property="time" pattern="yy-MM-dd--HH-mm-ss"/>
63 </tstamp>
64 </target>
66 <target name="all" depends='mj-samples,mjc2wsl-samples,wsl-transf-samples'
67 description="build the tools, run them on the samples to check">
69 </target>
71 <target name="clean" description="clean up all the generated content">
72 <delete includeemptydirs="true">
73 <fileset dir="${mjc2wsl.class.dir}"/>
74 <fileset dir="${compiler.class.dir}"/>
75 <fileset dir="${samples.temp.dir}"/>
76 <fileset dir="${log.dir}"/>
77 </delete>
78 </target>
81 <!-- mjc2wsl related tasks -->
83 <target name="build" depends="init" description="build the mjc2wsl tool">
84 <javac srcdir="${mjc2wsl.src.dir}" destdir="${mjc2wsl.class.dir}" includeAntRuntime='no' />
85 </target>
87 <target name="mjc2wsl">
88 <echo message="${filename}" />
89 <java classpath="${mjc2wsl.class.dir}:${res.dir}" classname="mjc2wsl">
90 <arg line="${mjc2wsl.options}" />
91 <arg value="${filename}" />
92 </java>
93 </target>
95 <target name="mjc2wsl-samples" depends="build,init-time" description="run the mjc2wsl tool on the samples">
96 <record name="${log.file.mjc2wsl}${time}.txt" emacsmode="true" />
97 <echo>Used options:${mjc2wsl.options}</echo>
98 <foreach param="filename" target="mjc2wsl">
99 <path>
100 <fileset dir='${samples.temp.dir}'>
101 <include name="*.obj"/>
102 </fileset>
103 </path>
104 </foreach>
105 <record name="${log.file.mjc2wsl}${time}.txt" action="stop" />
106 <copy file="${log.file.mjc2wsl}${time}.txt" tofile="${log.file.mjc2wsl}.txt"/>
107 </target>
109 <target name="mjc2wsl-samples1" depends="build">
110 <!-- simplistic version when antlib (foreach) is not available -->
111 <antcall target="mjc2wsl">
112 <param name="filename" value="samples-temp/sample0.obj" />
113 </antcall>
114 </target>
117 <!-- MicroJava related tasks -->
120 <target name="mj-build" depends="init" description="build the mj compiler">
121 <javac srcdir="${compiler.src.dir}" destdir="${compiler.class.dir}" includeAntRuntime='no' />
122 </target>
124 <target name="mj-compile" description="compile a MJ into obj file; given ${filename}">
125 <echo message="${filename}" />
126 <java classpath="${compiler.class.dir}" classname="${compiler.classname.compiler}">
127 <arg value="${filename}" />
128 </java>
129 </target>
131 <target name="mj-samples" depends="mj-build" description="run the mj compiler on the samples">
132 <foreach param="filename" target="mj-compile">
133 <path>
134 <fileset dir='${samples.temp.dir}'>
135 <include name="*.mj"/>
136 </fileset>
137 </path>
138 </foreach>
139 </target>
141 <target name="mj-decode" description="decode a MJ obj file given in ${filename}">
142 <echo message="${filename}" />
143 <java classpath="${compiler.class.dir}" classname="${compiler.classname.decoder}">
144 <arg value="${filename}" />
145 </java>
146 </target>
148 <target name="mj-decode-samples" depends="mj-build" description="decode all of the compiled samples and save into file 'decoded.txt'">
149 <record name="${samples.temp.dir}/decoded.txt" emacsmode="true" loglevel="info"/>
150 <foreach param="filename" target="mj-decode">
151 <path>
152 <fileset dir='${samples.temp.dir}'>
153 <include name="*.obj"/>
154 </fileset>
155 </path>
156 </foreach>
157 <record name="${samples.temp.dir}/decoded.txt" action="stop"/>
158 </target>
160 <target name="mj-run" description="run a MJ obj file given in ${filename} with ${inputstring}">
161 <echo message="${filename}" />
162 <java classpath="${compiler.class.dir}" classname="${compiler.classname.interpreter}" inputstring="${inputstring}">
163 <arg value="${filename}" />
164 </java>
165 </target>
167 <target name="mj-samples1" depends="mj-build">
168 <!-- simplistic version when antlib (foreach) is not available -->
169 <antcall target="mj-compile">
170 <param name="filename" value="samples-temp/sample.mj" />
171 </antcall>
172 <antcall target="mj-compile">
173 <param name="filename" value="samples-temp/sample1.mj" />
174 </antcall>
175 <antcall target="mj-compile">
176 <param name="filename" value="samples-temp/sample0.mj" />
177 </antcall>
178 </target>
181 <!-- wsl related tasks -->
183 <target name="wsl-run" >
184 <exec executable="${fermat.dir}/bin/wsl" inputstring="${inputstring}">
185 <env key="PATH" path="${fermat.dir}/bin:${env.PATH}"/>
186 <env key="FermaT" path="${fermat.dir}" />
187 <env key="SCHEME_LIBRARY_PATH" path="${fermat.dir}/slib/" />
188 <env key="SCM_INIT_PATH" path="${fermat.dir}/scm/Init5e7.scm" />
189 <arg value="${filename}"/>
190 </exec>
191 </target>
193 <target name="wsl-transf"
194 description="transform (simplify) a single wsl file generated by mjc2wsl">
195 <delete file="${transf.wsl.ini}"/>
197 <antcall target="wsl-run">
198 <param name="filename" value="${transf.wsl.file}" />
199 <param name="inputstring" value="${transf.filename}" />
200 </antcall>
201 </target>
203 <target name="wsl-transf-samples" depends="init-time,make-transf-ini-samples"
204 description="transform (simplify) the wsl files generated by mjc2wsl">
205 <record name="${log.file.transformations}${time}.txt" emacsmode="true" />
206 <antcall target="wsl-run">
207 <param name="filename" value="${transf.wsl.file}" />
208 </antcall>
209 <record name="${log.file.transformations}${time}.txt" action="stop" />
210 <copy file="${log.file.transformations}${time}.txt" tofile="${log.file.transformations}.txt"/>
211 </target>
213 <target name="make-transf-ini-samples">
214 <fileset dir="${samples.temp.dir}" casesensitive="no" id="generated-wsl-fileset">
215 <patternset id="non.transformed.sources">
216 <include name="**/*.wsl"/>
217 <exclude name="**/*_t.wsl"/>
218 </patternset>
219 </fileset>
220 <pathconvert pathsep="${line.separator}"
221 property="generated-wsl-files" refid="generated-wsl-fileset" />
223 <echo file="${transf.wsl.ini}">${generated-wsl-files}</echo>
224 </target>
226 <!-- Testing tasks -->
228 <target name="test-run"
229 description="run .obj .wsl _t.wsl, given are ${file.dir}, ${file.name} (no extension) and an ${inputstring}">
230 <antcall target="mj-run">
231 <param name="filename" value="${file.dir}/${file.name}.obj" />
232 <param name="inputstring" value="${inputstring}" />
233 </antcall>
234 <antcall target="wsl-run">
235 <param name="filename" value="${file.dir}/${file.name}.wsl" />
236 <param name="inputstring" value="${inputstring}" />
237 </antcall>
238 <antcall target="wsl-run">
239 <param name="filename" value="${file.dir}/${file.name}_t.wsl" />
240 <param name="inputstring" value="${inputstring}" />
241 </antcall>
242 </target>
244 <target name="test-run-samples-dir"
245 description="run .obj .wsl _t.wsl, in the samples-temp directory; given ${file.name} (no extension) and an ${inputstring}">
246 <antcall target="test-run">
247 <param name="file.dir" value="${samples.temp.dir}"/>
248 </antcall>
249 </target>
251 <!-- jedit specific flags; needs to be the first or the last 10 lines
252 :noTabs=true:
253 -->
254 </project>
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner