gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
ant - microjava run task
[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 <target name="init">
39 <mkdir dir="${mjc2wsl.class.dir}"/>
40 <mkdir dir="${compiler.class.dir}"/>
41 <mkdir dir="${samples.temp.dir}"/>
42 <copy todir="${samples.temp.dir}">
43 <fileset dir="${samples.main.dir}">
44 <include name="*.mj"/>
45 </fileset>
46 </copy>
47 </target>
49 <target name="build" depends="init" description="build the mjc2wsl tool">
50 <javac srcdir="${mjc2wsl.src.dir}" destdir="${mjc2wsl.class.dir}" includeAntRuntime='no' />
51 </target>
53 <target name="mj-build" depends="init" description="build the mj compiler">
54 <javac srcdir="${compiler.src.dir}" destdir="${compiler.class.dir}" includeAntRuntime='no' />
55 </target>
57 <target name="mj-compile">
58 <echo message="${filename}" />
59 <java classpath="${compiler.class.dir}" classname="Compiler">
60 <arg value="${filename}" />
61 </java>
62 </target>
64 <target name="mj-samples" depends="mj-build" description="run the mj compiler on the samples">
65 <foreach param="filename" target="mj-compile">
66 <path>
67 <fileset dir='${samples.temp.dir}'>
68 <include name="*.mj"/>
69 </fileset>
70 </path>
71 </foreach>
72 </target>
74 <target name="mj-run">
75 <echo message="${filename}" />
76 <java classpath="${compiler.class.dir}" classname="Run">
77 <arg value="${filename}" />
78 </java>
79 </target>
81 <target name="mj-samples1" depends="mj-build">
82 <!-- simplistic version when antlib (foreach) is not available -->
83 <antcall target="mj-compile">
84 <param name="filename" value="samples-temp/sample.mj" />
85 </antcall>
86 <antcall target="mj-compile">
87 <param name="filename" value="samples-temp/sample1.mj" />
88 </antcall>
89 <antcall target="mj-compile">
90 <param name="filename" value="samples-temp/sample0.mj" />
91 </antcall>
92 </target>
94 <target name="mjc2wsl">
95 <echo message="${filename}" />
96 <java classpath="${mjc2wsl.class.dir}:${res.dir}" classname="mjc2wsl">
97 <arg line="${mjc2wsl.options}" />
98 <arg value="${filename}" />
99 </java>
100 </target>
102 <target name="mjc2wsl-samples" depends="build" description="run the mjc2wsl tool on the samples">
103 <foreach param="filename" target="mjc2wsl">
104 <path>
105 <fileset dir='${samples.temp.dir}'>
106 <include name="*.obj"/>
107 </fileset>
108 </path>
109 </foreach>
110 </target>
112 <target name="mjc2wsl-samples1" depends="build">
113 <!-- simplistic version when antlib (foreach) is not available -->
114 <antcall target="mjc2wsl">
115 <param name="filename" value="samples-temp/sample0.obj" />
116 </antcall>
117 </target>
119 <target name="wsl-run" >
120 <exec executable="${fermat.dir}/bin/wsl" inputstring="${inputstring}">
121 <env key="PATH" path="${env.PATH}:${fermat.dir}/bin"/>
122 <env key="FermaT" path="${fermat.dir}" />
123 <env key="SCHEME_LIBRARY_PATH" path="${fermat.dir}/slib/" />
124 <env key="SCM_INIT_PATH" path="${fermat.dir}/scm/Init5e5.scm" />
125 <arg value="${filename}"/>
126 </exec>
127 </target>
129 <target name="wsl-transf"
130 description="transform (simplify) a single wsl file generated by mjc2wsl">
131 <delete file="${transf.wsl.ini}"/>
133 <antcall target="wsl-run">
134 <param name="filename" value="${transf.wsl.file}" />
135 <param name="inputstring" value="${transf.filename}" />
136 </antcall>
137 </target>
139 <target name="wsl-transf-samples" depends="make-transf-ini-samples"
140 description="transform (simplify) the wsl files generated by mjc2wsl">
141 <antcall target="wsl-run">
142 <param name="filename" value="${transf.wsl.file}" />
143 </antcall>
144 </target>
146 <target name="make-transf-ini-samples">
147 <fileset dir="${samples.temp.dir}" casesensitive="no" id="generated-wsl-fileset">
148 <patternset id="non.transformed.sources">
149 <include name="**/*.wsl"/>
150 <exclude name="**/*_t.wsl"/>
151 </patternset>
152 </fileset>
153 <pathconvert pathsep="${line.separator}"
154 property="generated-wsl-files" refid="generated-wsl-fileset" />
156 <echo file="${transf.wsl.ini}">${generated-wsl-files}</echo>
157 </target>
159 <target name="all" depends='mj-samples,mjc2wsl-samples,wsl-transf-samples'
160 description="build the tools, run them on the samples to check">
162 </target>
164 <target name="clean" description="clean up all the generated content">
165 <delete includeemptydirs="true">
166 <fileset dir=".">
167 <include name="${mjc2wsl.class.dir}/*.class"/>
168 <include name="${compiler.class.dir}/*.class"/>
169 <include name="${samples.temp.dir}/*"/>
170 </fileset>
171 <dirset dir=".">
172 <include name="${mjc2wsl.class.dir}"/>
173 <include name="${compiler.class.dir}"/>
174 <include name="${samples.temp.dir}"/>
175 </dirset>
176 </delete>
177 </target>
179 <!-- jedit specific flags; needs to be the first or the last 10 lines
180 :noTabs=true:
181 -->
182 </project>
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner