gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
samples - rekfib1, simplify for now
[mjc2wsl.git] / build.xml
1 <project name="mjc2wsl" default="all">
2 <property file="custom.properties"/>
4 <condition property="fermat.dir" value="C:\fermat3">
5 <os family="windows" />
6 </condition>
8 <condition property="fermat.dir" value="${user.home}/fermat3">
9 <not><os family="windows" /></not>
10 </condition>
13 <property name="java.encoding" value="utf-8" />
14 <taskdef resource="net/sf/antcontrib/antlib.xml"/>
16 <property name="mjc2wsl.class.dir" value="bin" />
17 <property name="mjc2wsl.src.dir" value="src" />
18 <property name="mjc2wsl.options" value="" />
20 <property name="res.dir" value="res" />
22 <property name="compiler.class.dir" value="compiler-bin" />
23 <property name="compiler.src.dir" value="compiler" />
24 <property name="compiler.classname.compiler" value="Compiler" />
25 <property name="compiler.classname.interpreter" value="Run" />
27 <property name="samples.main.dir" value="samples" />
28 <property name="samples.temp.dir" value="samples-temp" />
30 <property name="transf.wsl.file" value="src-wsl/transf-min.wsl" />
31 <property name="transf.wsl.ini" value="transf.ini" />
33 <description>
34 Builder script for mjc2wsl and related tools, runs test
35 on given samples.
37 Also gives options to chain the tools on individual files.
38 </description>
40 <!-- general tasks -->
42 <target name="init">
43 <mkdir dir="${mjc2wsl.class.dir}"/>
44 <mkdir dir="${compiler.class.dir}"/>
45 <mkdir dir="${samples.temp.dir}"/>
46 <copy todir="${samples.temp.dir}">
47 <fileset dir="${samples.main.dir}">
48 <include name="*.mj"/>
49 </fileset>
50 </copy>
51 </target>
53 <target name="all" depends='mj-samples,mjc2wsl-samples,wsl-transf-samples'
54 description="build the tools, run them on the samples to check">
56 </target>
58 <target name="clean" description="clean up all the generated content">
59 <delete includeemptydirs="true">
60 <fileset dir=".">
61 <include name="${mjc2wsl.class.dir}/*.class"/>
62 <include name="${compiler.class.dir}/*.class"/>
63 <include name="${samples.temp.dir}/*"/>
64 </fileset>
65 <dirset dir=".">
66 <include name="${mjc2wsl.class.dir}"/>
67 <include name="${compiler.class.dir}"/>
68 <include name="${samples.temp.dir}"/>
69 </dirset>
70 </delete>
71 </target>
74 <!-- mjc2wsl related tasks -->
76 <target name="build" depends="init" description="build the mjc2wsl tool">
77 <javac srcdir="${mjc2wsl.src.dir}" destdir="${mjc2wsl.class.dir}" includeAntRuntime='no' />
78 </target>
80 <target name="mjc2wsl">
81 <echo message="${filename}" />
82 <java classpath="${mjc2wsl.class.dir}:${res.dir}" classname="mjc2wsl">
83 <arg line="${mjc2wsl.options}" />
84 <arg value="${filename}" />
85 </java>
86 </target>
88 <target name="mjc2wsl-samples" depends="build" description="run the mjc2wsl tool on the samples">
89 <foreach param="filename" target="mjc2wsl">
90 <path>
91 <fileset dir='${samples.temp.dir}'>
92 <include name="*.obj"/>
93 </fileset>
94 </path>
95 </foreach>
96 </target>
98 <target name="mjc2wsl-samples1" depends="build">
99 <!-- simplistic version when antlib (foreach) is not available -->
100 <antcall target="mjc2wsl">
101 <param name="filename" value="samples-temp/sample0.obj" />
102 </antcall>
103 </target>
106 <!-- MicroJava related tasks -->
109 <target name="mj-build" depends="init" description="build the mj compiler">
110 <javac srcdir="${compiler.src.dir}" destdir="${compiler.class.dir}" includeAntRuntime='no' />
111 </target>
113 <target name="mj-compile" description="compile a MJ into obj file; given ${filename}">
114 <echo message="${filename}" />
115 <java classpath="${compiler.class.dir}" classname="${compiler.classname.compiler}">
116 <arg value="${filename}" />
117 </java>
118 </target>
120 <target name="mj-samples" depends="mj-build" description="run the mj compiler on the samples">
121 <foreach param="filename" target="mj-compile">
122 <path>
123 <fileset dir='${samples.temp.dir}'>
124 <include name="*.mj"/>
125 </fileset>
126 </path>
127 </foreach>
128 </target>
130 <target name="mj-run" description="run a MJ obj file given in ${filename} with ${inputstring}">
131 <echo message="${filename}" />
132 <java classpath="${compiler.class.dir}" classname="${compiler.classname.interpreter}" inputstring="${inputstring}">
133 <arg value="${filename}" />
134 </java>
135 </target>
137 <target name="mj-samples1" depends="mj-build">
138 <!-- simplistic version when antlib (foreach) is not available -->
139 <antcall target="mj-compile">
140 <param name="filename" value="samples-temp/sample.mj" />
141 </antcall>
142 <antcall target="mj-compile">
143 <param name="filename" value="samples-temp/sample1.mj" />
144 </antcall>
145 <antcall target="mj-compile">
146 <param name="filename" value="samples-temp/sample0.mj" />
147 </antcall>
148 </target>
151 <!-- wsl related tasks -->
153 <target name="wsl-run" >
154 <exec executable="${fermat.dir}/bin/wsl" inputstring="${inputstring}">
155 <env key="PATH" path="${env.PATH}:${fermat.dir}/bin"/>
156 <env key="FermaT" path="${fermat.dir}" />
157 <env key="SCHEME_LIBRARY_PATH" path="${fermat.dir}/slib/" />
158 <env key="SCM_INIT_PATH" path="${fermat.dir}/scm/Init5e5.scm" />
159 <arg value="${filename}"/>
160 </exec>
161 </target>
163 <target name="wsl-transf"
164 description="transform (simplify) a single wsl file generated by mjc2wsl">
165 <delete file="${transf.wsl.ini}"/>
167 <antcall target="wsl-run">
168 <param name="filename" value="${transf.wsl.file}" />
169 <param name="inputstring" value="${transf.filename}" />
170 </antcall>
171 </target>
173 <target name="wsl-transf-samples" depends="make-transf-ini-samples"
174 description="transform (simplify) the wsl files generated by mjc2wsl">
175 <antcall target="wsl-run">
176 <param name="filename" value="${transf.wsl.file}" />
177 </antcall>
178 </target>
180 <target name="make-transf-ini-samples">
181 <fileset dir="${samples.temp.dir}" casesensitive="no" id="generated-wsl-fileset">
182 <patternset id="non.transformed.sources">
183 <include name="**/*.wsl"/>
184 <exclude name="**/*_t.wsl"/>
185 </patternset>
186 </fileset>
187 <pathconvert pathsep="${line.separator}"
188 property="generated-wsl-files" refid="generated-wsl-fileset" />
190 <echo file="${transf.wsl.ini}">${generated-wsl-files}</echo>
191 </target>
193 <!-- Testing tasks -->
195 <target name="test-run"
196 description="run .obj .wsl _t.wsl, given are ${file.dir}, ${file.name} (no extension) and an ${inputstring}">
197 <antcall target="mj-run">
198 <param name="filename" value="${file.dir}/${file.name}.obj" />
199 <param name="inputstring" value="${inputstring}" />
200 </antcall>
201 <antcall target="wsl-run">
202 <param name="filename" value="${file.dir}/${file.name}.wsl" />
203 <param name="inputstring" value="${inputstring}" />
204 </antcall>
205 <antcall target="wsl-run">
206 <param name="filename" value="${file.dir}/${file.name}_t.wsl" />
207 <param name="inputstring" value="${inputstring}" />
208 </antcall>
209 </target>
211 <target name="test-run-samples-dir"
212 description="run .obj .wsl _t.wsl, in the samples-temp directory; given ${file.name} (no extension) and an ${inputstring}">
213 <antcall target="test-run">
214 <param name="file.dir" value="${samples.temp.dir}"/>
215 </antcall>
216 </target>
218 <!-- jedit specific flags; needs to be the first or the last 10 lines
219 :noTabs=true:
220 -->
221 </project>
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner