gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
ant script - mj-samples needs to depend on init to create the temp folder
[mjc2wsl.git] / build.xml
index d03ecff..0b12de1 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -1,5 +1,6 @@
 <project name="mjc2wsl" default="all">
     <property file="custom.properties"/>
 <project name="mjc2wsl" default="all">
     <property file="custom.properties"/>
+    <property environment="env"/>
     
      <condition property="fermat.dir" value="C:\fermat3">
        <os family="windows" />
     
      <condition property="fermat.dir" value="C:\fermat3">
        <os family="windows" />
@@ -19,6 +20,7 @@
 
     <property name="res.dir" value="res" />
     
 
     <property name="res.dir" value="res" />
     
+    <property name="compiler.class.jar" value="lib/mj.jar" />
     <property name="compiler.class.dir" value="lib/compiler-bin" />
     <property name="compiler.src.dir" value="lib/compiler-src" />
     <property name="compiler.classname.compiler" value="MJ.Compiler" />
     <property name="compiler.class.dir" value="lib/compiler-bin" />
     <property name="compiler.src.dir" value="lib/compiler-src" />
     <property name="compiler.classname.compiler" value="MJ.Compiler" />
     <property name="transf.wsl.file" value="src-wsl/transf-min.wsl" />
     <property name="transf.wsl.ini" value="transf.ini" />
 
     <property name="transf.wsl.file" value="src-wsl/transf-min.wsl" />
     <property name="transf.wsl.ini" value="transf.ini" />
 
+    <property name="log.dir" value="logs" />
+    <property name="log.file.transformations" value="${log.dir}/transformations" />
+    <property name="log.file.mjc2wsl" value="${log.dir}/mjc2wsl" />
+
     <description>
         Builder script for mjc2wsl and related tools, runs test
         on given samples.
     <description>
         Builder script for mjc2wsl and related tools, runs test
         on given samples.
 
     <!-- general tasks -->
 
 
     <!-- general tasks -->
 
-    <target name="init">
+    <target name="init" depends="init-time">
         <mkdir dir="${mjc2wsl.class.dir}"/>
         <mkdir dir="${compiler.class.dir}"/>
         <mkdir dir="${samples.temp.dir}"/>
         <mkdir dir="${mjc2wsl.class.dir}"/>
         <mkdir dir="${compiler.class.dir}"/>
         <mkdir dir="${samples.temp.dir}"/>
+        <mkdir dir="${log.dir}"/>
         <copy todir="${samples.temp.dir}">
             <fileset dir="${samples.main.dir}">
                 <include name="*.mj"/>
             </fileset>
         </copy>
     </target>
         <copy todir="${samples.temp.dir}">
             <fileset dir="${samples.main.dir}">
                 <include name="*.mj"/>
             </fileset>
         </copy>
     </target>
-    
+
+    <target name="init-time">
+        <tstamp>
+          <format property="time" pattern="yy-MM-dd--HH-mm-ss"/>
+        </tstamp>
+    </target>
+
     <target name="all" depends='mj-samples,mjc2wsl-samples,wsl-transf-samples'
         description="build the tools, run them on the samples to check">
     
     <target name="all" depends='mj-samples,mjc2wsl-samples,wsl-transf-samples'
         description="build the tools, run them on the samples to check">
     
     
     <target name="clean" description="clean up all the generated content">
         <delete includeemptydirs="true">
     
     <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"/>
-                <include name="${samples.temp.dir}/*"/>
-            </fileset>
-            <dirset dir=".">
-                <include name="${mjc2wsl.class.dir}"/>
-                <include name="${compiler.class.dir}"/>
-                <include name="${samples.temp.dir}"/>
-            </dirset>
+            <fileset dir="${mjc2wsl.class.dir}"/>
+            <fileset dir="${compiler.class.dir}"/>
+            <fileset dir="${samples.temp.dir}"/>
+            <fileset dir="${log.dir}"/>
         </delete>
     </target>
     
         </delete>
     </target>
     
@@ -86,7 +93,9 @@
         </java>
     </target>
     
         </java>
     </target>
     
-    <target name="mjc2wsl-samples" depends="build" description="run the mjc2wsl tool on the samples">
+    <target name="mjc2wsl-samples" depends="build,init-time" description="run the mjc2wsl tool on the samples">
+        <record name="${log.file.mjc2wsl}${time}.txt" emacsmode="true" />
+        <echo>Used options:${mjc2wsl.options}</echo>
         <foreach param="filename" target="mjc2wsl">
             <path>
             <fileset dir='${samples.temp.dir}'>
         <foreach param="filename" target="mjc2wsl">
             <path>
             <fileset dir='${samples.temp.dir}'>
             </fileset>
             </path>
         </foreach>
             </fileset>
             </path>
         </foreach>
+        <record name="${log.file.mjc2wsl}${time}.txt" action="stop" />
+        <copy file="${log.file.mjc2wsl}${time}.txt" tofile="${log.file.mjc2wsl}.txt"/>
     </target>
     
     <target name="mjc2wsl-samples1" depends="build">
     </target>
     
     <target name="mjc2wsl-samples1" depends="build">
     
     <target name="mj-compile" description="compile a MJ into obj file; given ${filename}">
         <echo message="${filename}" />
     
     <target name="mj-compile" description="compile a MJ into obj file; given ${filename}">
         <echo message="${filename}" />
-        <java classpath="${compiler.class.dir}" classname="${compiler.classname.compiler}">
+        <java classpath="${compiler.class.dir}:${compiler.class.jar}" classname="${compiler.classname.compiler}">
             <arg value="${filename}" />
         </java>
     </target>
     
             <arg value="${filename}" />
         </java>
     </target>
     
-    <target name="mj-samples" depends="mj-build" description="run the mj compiler on the samples">
+    <target name="mj-samples" description="run the mj compiler on the samples" depends="init">
         <foreach param="filename" target="mj-compile">
             <path>
             <fileset dir='${samples.temp.dir}'>
         <foreach param="filename" target="mj-compile">
             <path>
             <fileset dir='${samples.temp.dir}'>
 
     <target name="mj-decode" description="decode a MJ obj file given in ${filename}">
         <echo message="${filename}" />
 
     <target name="mj-decode" description="decode a MJ obj file given in ${filename}">
         <echo message="${filename}" />
-        <java classpath="${compiler.class.dir}" classname="${compiler.classname.decoder}">
+        <java classpath="${compiler.class.dir}:${compiler.class.jar}" classname="${compiler.classname.decoder}">
             <arg value="${filename}" />
         </java>
     </target>
     
             <arg value="${filename}" />
         </java>
     </target>
     
-    <target name="mj-decode-samples" depends="mj-build" description="decode all of the compiled samples">
+    <target name="mj-decode-samples" description="decode all of the compiled samples and save into file 'decoded.txt'">
+        <record name="${samples.temp.dir}/decoded.txt" emacsmode="true" loglevel="info"/>
         <foreach param="filename" target="mj-decode">
             <path>
             <fileset dir='${samples.temp.dir}'>
         <foreach param="filename" target="mj-decode">
             <path>
             <fileset dir='${samples.temp.dir}'>
             </fileset>
             </path>
         </foreach>
             </fileset>
             </path>
         </foreach>
+        <record name="${samples.temp.dir}/decoded.txt" action="stop"/>
     </target>
     
     <target name="mj-run" description="run a MJ obj file given in ${filename} with ${inputstring}">
         <echo message="${filename}" />
     </target>
     
     <target name="mj-run" description="run a MJ obj file given in ${filename} with ${inputstring}">
         <echo message="${filename}" />
-        <java classpath="${compiler.class.dir}" classname="${compiler.classname.interpreter}" inputstring="${inputstring}">
+        <java classpath="${compiler.class.dir}:${compiler.class.jar}" classname="${compiler.classname.interpreter}" inputstring="${inputstring}">
             <arg value="${filename}" />
         </java>
     </target>
             <arg value="${filename}" />
         </java>
     </target>
 
     <target name="wsl-run" >
         <exec executable="${fermat.dir}/bin/wsl" inputstring="${inputstring}">
 
     <target name="wsl-run" >
         <exec executable="${fermat.dir}/bin/wsl" inputstring="${inputstring}">
-            <env key="PATH" path="${env.PATH}:${fermat.dir}/bin"/>
+            <env key="PATH" path="${fermat.dir}/bin:${env.PATH}"/>
             <env key="FermaT" path="${fermat.dir}" />
             <env key="SCHEME_LIBRARY_PATH" path="${fermat.dir}/slib/" />
             <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" />
+            <env key="SCM_INIT_PATH" path="${fermat.dir}/scm/Init5e7.scm" />
             <arg value="${filename}"/>
         </exec>
     </target>
             <arg value="${filename}"/>
         </exec>
     </target>
         </antcall>
     </target>
     
         </antcall>
     </target>
     
-    <target name="wsl-transf-samples" depends="make-transf-ini-samples"
+    <target name="wsl-transf-samples" depends="init-time,make-transf-ini-samples"
         description="transform (simplify) the wsl files generated by mjc2wsl">
         description="transform (simplify) the wsl files generated by mjc2wsl">
+        <record name="${log.file.transformations}${time}.txt" emacsmode="true" />
         <antcall target="wsl-run">
             <param name="filename" value="${transf.wsl.file}" />
         </antcall>
         <antcall target="wsl-run">
             <param name="filename" value="${transf.wsl.file}" />
         </antcall>
+       <record name="${log.file.transformations}${time}.txt" action="stop" />
+        <copy file="${log.file.transformations}${time}.txt" tofile="${log.file.transformations}.txt"/>
     </target>
     
     <target name="make-transf-ini-samples">
     </target>
     
     <target name="make-transf-ini-samples">
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner