gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
Ant - add logging of transformed program testing
[mjc2wsl.git] / build.xml
index c51b2ab..6324755 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -43,6 +43,7 @@
     <property name="log.file.transformations" value="${log.dir}/transformations" />
     <property name="log.file.mjc2wsl" value="${log.dir}/mjc2wsl" />
     <property name="log.file.tests.m" value="${log.dir}/tests-mj" />
+    <property name="log.file.tests.t" value="${log.dir}/tests-wsl" />
 
     <description>
         Builder script for mjc2wsl and related tools, runs test
 
     <target name="mj-decode" description="decode a MJ obj file given in ${filename}">
         <echo message="${filename}" />
-        <java classpath="${compiler.class.dir}:${compiler.class.jar}" classname="${compiler.classname.decoder}">
+        <java classpath="${compiler.class.dir}:${compiler.class.jar}" 
+              classname="${compiler.classname.decoder}"
+              output="${filename}.decoded" >
             <arg value="${filename}" />
         </java>
     </target>
     
-    <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"/>
+    <target name="mj-decode-samples" description="decode all of the obj files in ${samples.temp.dir}">
         <foreach param="filename" target="mj-decode">
             <path>
             <fileset dir='${samples.temp.dir}'>
             </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}">
             </fileset>
             </path>
         </foreach>
-        <record name="${log.file.tests}${time}.txt" action="stop" />
+        <record name="${log.file.tests.m}${time}.txt" action="stop" />
         <move file="${log.file.tests.m}.txt" tofile="${log.file.tests.m}-previous.txt" failonerror="false"/>
         <copy file="${log.file.tests.m}${time}.txt" tofile="${log.file.tests.m}.txt"/>        
     </target>
 
-    <target name="test-all-t" depends="init-compare"
+    <target name="test-all-t" depends="init-compare,init-time"
     description="Run all the tests from the test directory to compare WSL and transformations" >
+        <record name="${log.file.tests.t}${time}.txt" emacsmode="true" />
         <foreach param="filename" target="test-fn-t">
             <path>
             <fileset dir='${samples.temp.dir}'>
             </fileset>
             </path>
         </foreach>
+        <record name="${log.file.tests.t}${time}.txt" action="stop" />
+        <move file="${log.file.tests.t}.txt" tofile="${log.file.tests.t}-previous.txt" failonerror="false"/>
+        <copy file="${log.file.tests.t}${time}.txt" tofile="${log.file.tests.t}.txt"/>
     </target>
     
     <target name="q-test">
             includes="*/*.wsl"/>
     </target>
 
+
+    <!-- output a comparison Latex file and compile it -->
+
+    <target name="output-comparison-pdf-single">
+        <basename property="file.name" file="${filename}" suffix=".obj"/>
+        <echo append='true' file="${samples.temp.dir}/tex/comparison.tex">
+        \section{${file.name}}
+        \begin{paracol}{4}
+        \lstinputlisting[style=mj]{../${file.name}.mj}
+        \switchcolumn
+        \lstinputlisting[style=decoded]{../${file.name}.obj.decoded}
+        \switchcolumn
+        \lstinputlisting[style=wsl,lastline=200]{../${file.name}.wsl}
+        \switchcolumn
+        \lstinputlisting[style=wslt,lastline=200]{../${file.name}${transf.wsl.ext}}
+        \end{paracol}
+        </echo>
+    </target>
+    
+    <target name="output-comparison-pdf"
+        description="Makes a parallel display in Latex and produces a pdf (tex dir in temp dir)" >
+
+        <copy file="lib/tex/comparison-start.tex" overwrite="true" 
+            tofile="${samples.temp.dir}/tex/comparison.tex"/>
+        <foreach param="filename" target="output-comparison-pdf-single" inheritall="true">
+            <path>
+            <fileset dir='${samples.temp.dir}'>
+                <include name="*.obj"/>
+            </fileset>
+            </path>
+        </foreach>
+        <concat destfile="${samples.temp.dir}/tex/comparison.tex" append="true">
+            <filelist dir="lib/tex" files="comparison-end.tex"/>
+        </concat>
+        <antcall target="output-comparison-compile"/>
+    </target>
+    
+    <target name="output-comparison-compile">
+        <exec command="pdflatex comparison.tex"
+              dir="${samples.temp.dir}/tex"/>
+    </target>
+
     <!-- jedit specific flags; needs to be the first or the last 10 lines
     :noTabs=true:
     -->
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner