gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
custom.properties.default - another example of a usefull property
[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-samples1" depends="mj-build">
75 <!-- simplistic version when antlib (foreach) is not available -->
76 <antcall target="mj-compile">
77 <param name="filename" value="samples-temp/sample.mj" />
78 </antcall>
79 <antcall target="mj-compile">
80 <param name="filename" value="samples-temp/sample1.mj" />
81 </antcall>
82 <antcall target="mj-compile">
83 <param name="filename" value="samples-temp/sample0.mj" />
84 </antcall>
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" description="run the mjc2wsl tool on the samples">
96 <foreach param="filename" target="mjc2wsl">
97 <path>
98 <fileset dir='${samples.temp.dir}'>
99 <include name="*.obj"/>
100 </fileset>
101 </path>
102 </foreach>
103 </target>
105 <target name="mjc2wsl-samples1" depends="build">
106 <!-- simplistic version when antlib (foreach) is not available -->
107 <antcall target="mjc2wsl">
108 <param name="filename" value="samples-temp/sample0.obj" />
109 </antcall>
110 </target>
112 <target name="wsl-run" >
113 <exec executable="${fermat.dir}/bin/wsl" inputstring="${inputstring}">
114 <env key="PATH" path="${env.PATH}:${fermat.dir}/bin"/>
115 <env key="FermaT" path="${fermat.dir}" />
116 <env key="SCHEME_LIBRARY_PATH" path="${fermat.dir}/slib/" />
117 <env key="SCM_INIT_PATH" path="${fermat.dir}/scm/Init5e5.scm" />
118 <arg value="${filename}"/>
119 </exec>
120 </target>
122 <target name="wsl-transf"
123 description="transform (simplify) a single wsl file generated by mjc2wsl">
124 <delete file="${transf.wsl.ini}"/>
126 <antcall target="wsl-run">
127 <param name="filename" value="${transf.wsl.file}" />
128 <param name="inputstring" value="${transf.filename}" />
129 </antcall>
130 </target>
132 <target name="wsl-transf-samples" depends="make-transf-ini-samples"
133 description="transform (simplify) the wsl files generated by mjc2wsl">
134 <antcall target="wsl-run">
135 <param name="filename" value="${transf.wsl.file}" />
136 </antcall>
137 </target>
139 <target name="make-transf-ini-samples">
140 <fileset dir="${samples.temp.dir}" casesensitive="no" id="generated-wsl-fileset">
141 <patternset id="non.transformed.sources">
142 <include name="**/*.wsl"/>
143 <exclude name="**/*_t.wsl"/>
144 </patternset>
145 </fileset>
146 <pathconvert pathsep="${line.separator}"
147 property="generated-wsl-files" refid="generated-wsl-fileset" />
149 <echo file="${transf.wsl.ini}">${generated-wsl-files}</echo>
150 </target>
152 <target name="all" depends='mj-samples,mjc2wsl-samples,wsl-transf-samples'
153 description="build the tools, run them on the samples to check">
155 </target>
157 <target name="clean" description="clean up all the generated content">
158 <delete includeemptydirs="true">
159 <fileset dir=".">
160 <include name="${mjc2wsl.class.dir}/*.class"/>
161 <include name="${compiler.class.dir}/*.class"/>
162 <include name="${samples.temp.dir}/*"/>
163 </fileset>
164 <dirset dir=".">
165 <include name="${mjc2wsl.class.dir}"/>
166 <include name="${compiler.class.dir}"/>
167 <include name="${samples.temp.dir}"/>
168 </dirset>
169 </delete>
170 </target>
172 <!-- jedit specific flags; needs to be the first or the last 10 lines
173 :noTabs=true:
174 -->
175 </project>
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner