gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
ant - minor: reorder the task in the file into groups
[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" />
25 <property name="samples.main.dir" value="samples" />
26 <property name="samples.temp.dir" value="samples-temp" />
28 <property name="transf.wsl.file" value="src-wsl/transf-min.wsl" />
29 <property name="transf.wsl.ini" value="transf.ini" />
31 <description>
32 Builder script for mjc2wsl and related tools, runs test
33 on given samples.
35 Also gives options to chain the tools on individual files.
36 </description>
38 <!-- general tasks -->
40 <target name="init">
41 <mkdir dir="${mjc2wsl.class.dir}"/>
42 <mkdir dir="${compiler.class.dir}"/>
43 <mkdir dir="${samples.temp.dir}"/>
44 <copy todir="${samples.temp.dir}">
45 <fileset dir="${samples.main.dir}">
46 <include name="*.mj"/>
47 </fileset>
48 </copy>
49 </target>
51 <target name="all" depends='mj-samples,mjc2wsl-samples,wsl-transf-samples'
52 description="build the tools, run them on the samples to check">
54 </target>
56 <target name="clean" description="clean up all the generated content">
57 <delete includeemptydirs="true">
58 <fileset dir=".">
59 <include name="${mjc2wsl.class.dir}/*.class"/>
60 <include name="${compiler.class.dir}/*.class"/>
61 <include name="${samples.temp.dir}/*"/>
62 </fileset>
63 <dirset dir=".">
64 <include name="${mjc2wsl.class.dir}"/>
65 <include name="${compiler.class.dir}"/>
66 <include name="${samples.temp.dir}"/>
67 </dirset>
68 </delete>
69 </target>
72 <!-- mjc2wsl related tasks -->
74 <target name="build" depends="init" description="build the mjc2wsl tool">
75 <javac srcdir="${mjc2wsl.src.dir}" destdir="${mjc2wsl.class.dir}" includeAntRuntime='no' />
76 </target>
78 <target name="mjc2wsl">
79 <echo message="${filename}" />
80 <java classpath="${mjc2wsl.class.dir}:${res.dir}" classname="mjc2wsl">
81 <arg line="${mjc2wsl.options}" />
82 <arg value="${filename}" />
83 </java>
84 </target>
86 <target name="mjc2wsl-samples" depends="build" description="run the mjc2wsl tool on the samples">
87 <foreach param="filename" target="mjc2wsl">
88 <path>
89 <fileset dir='${samples.temp.dir}'>
90 <include name="*.obj"/>
91 </fileset>
92 </path>
93 </foreach>
94 </target>
96 <target name="mjc2wsl-samples1" depends="build">
97 <!-- simplistic version when antlib (foreach) is not available -->
98 <antcall target="mjc2wsl">
99 <param name="filename" value="samples-temp/sample0.obj" />
100 </antcall>
101 </target>
104 <!-- MicroJava related tasks -->
107 <target name="mj-build" depends="init" description="build the mj compiler">
108 <javac srcdir="${compiler.src.dir}" destdir="${compiler.class.dir}" includeAntRuntime='no' />
109 </target>
111 <target name="mj-compile">
112 <echo message="${filename}" />
113 <java classpath="${compiler.class.dir}" classname="Compiler">
114 <arg value="${filename}" />
115 </java>
116 </target>
118 <target name="mj-samples" depends="mj-build" description="run the mj compiler on the samples">
119 <foreach param="filename" target="mj-compile">
120 <path>
121 <fileset dir='${samples.temp.dir}'>
122 <include name="*.mj"/>
123 </fileset>
124 </path>
125 </foreach>
126 </target>
128 <target name="mj-run">
129 <echo message="${filename}" />
130 <java classpath="${compiler.class.dir}" classname="Run">
131 <arg value="${filename}" />
132 </java>
133 </target>
135 <target name="mj-samples1" depends="mj-build">
136 <!-- simplistic version when antlib (foreach) is not available -->
137 <antcall target="mj-compile">
138 <param name="filename" value="samples-temp/sample.mj" />
139 </antcall>
140 <antcall target="mj-compile">
141 <param name="filename" value="samples-temp/sample1.mj" />
142 </antcall>
143 <antcall target="mj-compile">
144 <param name="filename" value="samples-temp/sample0.mj" />
145 </antcall>
146 </target>
149 <!-- wsl related tasks -->
151 <target name="wsl-run" >
152 <exec executable="${fermat.dir}/bin/wsl" inputstring="${inputstring}">
153 <env key="PATH" path="${env.PATH}:${fermat.dir}/bin"/>
154 <env key="FermaT" path="${fermat.dir}" />
155 <env key="SCHEME_LIBRARY_PATH" path="${fermat.dir}/slib/" />
156 <env key="SCM_INIT_PATH" path="${fermat.dir}/scm/Init5e5.scm" />
157 <arg value="${filename}"/>
158 </exec>
159 </target>
161 <target name="wsl-transf"
162 description="transform (simplify) a single wsl file generated by mjc2wsl">
163 <delete file="${transf.wsl.ini}"/>
165 <antcall target="wsl-run">
166 <param name="filename" value="${transf.wsl.file}" />
167 <param name="inputstring" value="${transf.filename}" />
168 </antcall>
169 </target>
171 <target name="wsl-transf-samples" depends="make-transf-ini-samples"
172 description="transform (simplify) the wsl files generated by mjc2wsl">
173 <antcall target="wsl-run">
174 <param name="filename" value="${transf.wsl.file}" />
175 </antcall>
176 </target>
178 <target name="make-transf-ini-samples">
179 <fileset dir="${samples.temp.dir}" casesensitive="no" id="generated-wsl-fileset">
180 <patternset id="non.transformed.sources">
181 <include name="**/*.wsl"/>
182 <exclude name="**/*_t.wsl"/>
183 </patternset>
184 </fileset>
185 <pathconvert pathsep="${line.separator}"
186 property="generated-wsl-files" refid="generated-wsl-fileset" />
188 <echo file="${transf.wsl.ini}">${generated-wsl-files}</echo>
189 </target>
191 <!-- jedit specific flags; needs to be the first or the last 10 lines
192 :noTabs=true:
193 -->
194 </project>
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner