gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
ant setup - added an option for a custom.properties file
[mjc2wsl.git] / build.xml
1 <project name="mjc2wsl" default="all">
2 <property file="custom.properties"/>
3 <property name="java.encoding" value="utf-8" />
4 <taskdef resource="net/sf/antcontrib/antlib.xml"/>
6 <property name="mjc2wsl.class.dir" value="bin" />
7 <property name="mjc2wsl.src.dir" value="src" />
8 <property name="mjc2wsl.options" value="" />
10 <property name="compiler.class.dir" value="compiler-bin" />
11 <property name="compiler.src.dir" value="compiler" />
13 <property name="samples.main.dir" value="samples" />
14 <property name="samples.temp.dir" value="samples-temp" />
16 <property name="fermat.dir" value="${user.home}/fermat3" />
18 <property name="transf.wsl.file" value="src-wsl/transf-min.wsl" />
19 <property name="transf.wsl.ini" value="transf.ini" />
21 <description>
22 Builder script for mjc2wsl and related tools, runs test
23 on given samples.
25 Also gives options to chain the tools on individual files.
26 </description>
28 <target name="init">
29 <mkdir dir="${mjc2wsl.class.dir}"/>
30 <mkdir dir="${compiler.class.dir}"/>
31 <mkdir dir="${samples.temp.dir}"/>
32 <copy todir="${samples.temp.dir}">
33 <fileset dir="${samples.main.dir}">
34 <include name="*.mj"/>
35 </fileset>
36 </copy>
37 </target>
39 <target name="build" depends="init" description="build the mjc2wsl tool">
40 <javac srcdir="${mjc2wsl.src.dir}" destdir="${mjc2wsl.class.dir}" includeAntRuntime='no' />
41 </target>
43 <target name="mj-build" depends="init" description="build the mj compiler">
44 <javac srcdir="${compiler.src.dir}" destdir="${compiler.class.dir}" includeAntRuntime='no' />
45 </target>
47 <target name="mj-compile">
48 <echo message="${filename}" />
49 <java classpath="${compiler.class.dir}" classname="Compiler">
50 <arg value="${filename}" />
51 </java>
52 </target>
54 <target name="mj-samples" depends="mj-build" description="run the mj compiler on the samples">
55 <foreach param="filename" target="mj-compile">
56 <path>
57 <fileset dir='${samples.temp.dir}'>
58 <include name="*.mj"/>
59 </fileset>
60 </path>
61 </foreach>
62 </target>
64 <target name="mj-samples1" depends="mj-build">
65 <!-- simplistic version when antlib (foreach) is not available -->
66 <antcall target="mj-compile">
67 <param name="filename" value="samples-temp/sample.mj" />
68 </antcall>
69 <antcall target="mj-compile">
70 <param name="filename" value="samples-temp/sample1.mj" />
71 </antcall>
72 <antcall target="mj-compile">
73 <param name="filename" value="samples-temp/sample0.mj" />
74 </antcall>
75 </target>
77 <target name="mjc2wsl">
78 <echo message="${filename}" />
79 <java classpath="${mjc2wsl.class.dir}" classname="mjc2wsl">
80 <arg line="${mjc2wsl.options}" />
81 <arg value="${filename}" />
82 </java>
83 </target>
85 <target name="mjc2wsl-samples" depends="build" description="run the mjc2wsl tool on the samples">
86 <foreach param="filename" target="mjc2wsl">
87 <path>
88 <fileset dir='${samples.temp.dir}'>
89 <include name="*.obj"/>
90 </fileset>
91 </path>
92 </foreach>
93 </target>
95 <target name="mjc2wsl-samples1" depends="build">
96 <!-- simplistic version when antlib (foreach) is not available -->
97 <antcall target="mjc2wsl">
98 <param name="filename" value="samples-temp/sample0.obj" />
99 </antcall>
100 </target>
102 <target name="wsl-run" >
103 <exec executable="${fermat.dir}/bin/wsl" inputstring="${inputstring}">
104 <env key="PATH" path="${env.PATH}:${fermat.dir}/bin"/>
105 <env key="FermaT" path="${fermat.dir}" />
106 <env key="SCHEME_LIBRARY_PATH" path="${fermat.dir}/slib/" />
107 <env key="SCM_INIT_PATH" path="${fermat.dir}/scm/Init5e5.scm" />
108 <arg value="${filename}"/>
109 </exec>
110 </target>
112 <target name="wsl-transf"
113 description="transform (simplify) a single wsl file generated by mjc2wsl">
114 <delete file="${transf.wsl.ini}"/>
116 <antcall target="wsl-run">
117 <param name="filename" value="${transf.wsl.file}" />
118 <param name="inputstring" value="${transf.filename}" />
119 </antcall>
120 </target>
122 <target name="wsl-transf-samples" depends="make-transf-ini-samples"
123 description="transform (simplify) the wsl files generated by mjc2wsl">
124 <antcall target="wsl-run">
125 <param name="filename" value="${transf.wsl.file}" />
126 </antcall>
127 </target>
129 <target name="make-transf-ini-samples">
130 <fileset dir="${samples.temp.dir}" casesensitive="no" id="generated-wsl-fileset">
131 <patternset id="non.transformed.sources">
132 <include name="**/*.wsl"/>
133 <exclude name="**/*_t.wsl"/>
134 </patternset>
135 </fileset>
136 <pathconvert pathsep="${line.separator}"
137 property="generated-wsl-files" refid="generated-wsl-fileset" />
139 <echo file="${transf.wsl.ini}">${generated-wsl-files}</echo>
140 </target>
142 <target name="all" depends='mj-samples,mjc2wsl-samples,wsl-transf-samples'
143 description="build the tools, run them on the samples to check">
145 </target>
147 <target name="clean" description="clean up all the generated content">
148 <delete includeemptydirs="true">
149 <fileset dir=".">
150 <include name="${mjc2wsl.class.dir}/*.class"/>
151 <include name="${compiler.class.dir}/*.class"/>
152 <include name="${samples.temp.dir}/*"/>
153 </fileset>
154 <dirset dir=".">
155 <include name="${mjc2wsl.class.dir}"/>
156 <include name="${compiler.class.dir}"/>
157 <include name="${samples.temp.dir}"/>
158 </dirset>
159 </delete>
160 </target>
162 <!-- jedit specific flags; needs to be the first or the last 10 lines
163 :noTabs=true:
164 -->
165 </project>
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner