gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
ant build - task to execute wsl, given the install dir
[mjc2wsl.git] / build.xml
index 4b35a7a..cfd9ea2 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -1,5 +1,7 @@
 <project name="mjc2wsl" default="all">
 <project name="mjc2wsl" default="all">
-
+    <property name="java.encoding" value="utf-8" />
+    <taskdef resource="net/sf/antcontrib/antlib.xml"/>
+    
     <property name="mjc2wsl.class.dir" value="bin" />
     <property name="mjc2wsl.src.dir" value="src" />
     <property name="mjc2wsl.options" value="" />
     <property name="mjc2wsl.class.dir" value="bin" />
     <property name="mjc2wsl.src.dir" value="src" />
     <property name="mjc2wsl.options" value="" />
@@ -7,7 +9,12 @@
     <property name="compiler.class.dir" value="compiler-bin" />
     <property name="compiler.src.dir" value="compiler" />
 
     <property name="compiler.class.dir" value="compiler-bin" />
     <property name="compiler.src.dir" value="compiler" />
 
-    <target name="help">
+    <property name="samples.main.dir" value="samples" />
+    <property name="samples.temp.dir" value="samples-temp" />
+    
+    <property name="fermat.dir" value="/home/donny/d/donny/fermat3" />
+    
+    <target name="help" description="a short help text">
         <echo>Possible options:
         all - build the tool and the compiler and test on the samples
         build - build the mjc2wsl tool
         <echo>Possible options:
         all - build the tool and the compiler and test on the samples
         build - build the mjc2wsl tool
     <target name="init">
         <mkdir dir="${mjc2wsl.class.dir}"/>
         <mkdir dir="${compiler.class.dir}"/>
     <target name="init">
         <mkdir dir="${mjc2wsl.class.dir}"/>
         <mkdir dir="${compiler.class.dir}"/>
+        <mkdir dir="${samples.temp.dir}"/>
+        <copy todir="${samples.temp.dir}">
+            <fileset dir="${samples.main.dir}">
+                <include name="*.mj"/>
+            </fileset>
+        </copy>
     </target>
 
     </target>
 
-    <target name="build" depends="init">
+    <target name="build" depends="init" description="build the mjv2wsl tool">
         <javac srcdir="${mjc2wsl.src.dir}" destdir="${mjc2wsl.class.dir}" includeAntRuntime='no' />
     </target>
 
         <javac srcdir="${mjc2wsl.src.dir}" destdir="${mjc2wsl.class.dir}" includeAntRuntime='no' />
     </target>
 
-    <target name="mj-build" depends="init">
+    <target name="mj-build" depends="init" description="build the mj compiler">
         <javac srcdir="${compiler.src.dir}" destdir="${compiler.class.dir}" includeAntRuntime='no' />
     </target>
     
         <javac srcdir="${compiler.src.dir}" destdir="${compiler.class.dir}" includeAntRuntime='no' />
     </target>
     
         </java>
     </target>
     
         </java>
     </target>
     
-    <target name="mj-samples" depends="mj-build">
+    <target name="mj-samples" depends="build" description="run the mj compiler on the samples">
+        <foreach param="filename" target="mj-compile">
+            <path>
+            <fileset dir='${samples.temp.dir}'>
+                <include name="*.mj"/>
+            </fileset>
+            </path>
+        </foreach>
+    </target>
+
+    <target name="mj-samples1" depends="mj-build">
+    <!-- simplistic version when antlib (foreach) is not available -->
         <antcall target="mj-compile">
         <antcall target="mj-compile">
-            <param name="filename" value="samples/sample.mj" />
+            <param name="filename" value="samples-temp/sample.mj" />
         </antcall>
         <antcall target="mj-compile">
         </antcall>
         <antcall target="mj-compile">
-            <param name="filename" value="samples/sample1.mj" />
+            <param name="filename" value="samples-temp/sample1.mj" />
         </antcall>
         <antcall target="mj-compile">
         </antcall>
         <antcall target="mj-compile">
-            <param name="filename" value="samples/sample0.mj" />
+            <param name="filename" value="samples-temp/sample0.mj" />
         </antcall>
     </target>
     
         </antcall>
     </target>
     
     </target>
     
     <target name="mjc2wsl-samples" depends="build">
     </target>
     
     <target name="mjc2wsl-samples" depends="build">
+        <foreach param="filename" target="mjc2wsl">
+            <path>
+            <fileset dir='${samples.temp.dir}'>
+                <include name="*.obj"/>
+            </fileset>
+            </path>
+        </foreach>
+    </target>
+    
+    <target name="mjc2wsl-samples1" depends="build">
+    <!-- simplistic version when antlib (foreach) is not available -->
         <antcall target="mjc2wsl">
         <antcall target="mjc2wsl">
-            <param name="filename" value="samples/sample0.obj" />
+            <param name="filename" value="samples-temp/sample0.obj" />
         </antcall>
     </target>
     
         </antcall>
     </target>
     
-    <target name="all" depends='mj-samples,mjc2wsl-samples'>
+    <target name="wsl-run" >
+        <exec executable="${fermat.dir}/bin/wsl" >
+            <env key="PATH" path="${env.PATH}:${fermat.dir}/bin"/>
+            <env key="FermaT" path="${fermat.dir}" />
+            <env key="SCHEME_LIBRARY_PATH" path="${fermat.dir}/slib/" />
+            <env key="SCM_INIT_PATH" path="${fermat.dir}/scm/Init5e5.scm" />
+            <arg value="${filename}"/>
+        </exec>
+    </target>
+    
+    <target name="all" depends='mj-samples,mjc2wsl-samples' description="build the tools, run them on the samples to check">
     
     </target>
     
     
     </target>
     
-    <target name="clean" >
+    <target name="clean" description="clean up all the generated content">
         <delete includeemptydirs="true">
             <fileset dir=".">
                 <include name="${mjc2wsl.class.dir}/*.class"/>
                 <include name="${compiler.class.dir}/*.class"/>
         <delete includeemptydirs="true">
             <fileset dir=".">
                 <include name="${mjc2wsl.class.dir}/*.class"/>
                 <include name="${compiler.class.dir}/*.class"/>
+                <include name="${samples.temp.dir}/*"/>
             </fileset>
             <dirset dir=".">
                 <include name="${mjc2wsl.class.dir}"/>
                 <include name="${compiler.class.dir}"/>
             </fileset>
             <dirset dir=".">
                 <include name="${mjc2wsl.class.dir}"/>
                 <include name="${compiler.class.dir}"/>
+                <include name="${samples.temp.dir}"/>
             </dirset>
         </delete>
     </target>
             </dirset>
         </delete>
     </target>
-
+    
+    <!-- jedit specific flags; needs to be the first or the last 10 lines
+    :noTabs=true:
+    -->
 </project>
\ No newline at end of file
 </project>
\ No newline at end of file
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner