gitweb on Svarog

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