gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
ant build - foreach with samples; samples temp dir that can be cleaned out
authorDoni Pracner <quinnuendo@gmail.com>
Wed, 25 Sep 2013 22:13:44 +0000 (00:13 +0200)
committerDoni Pracner <quinnuendo@gmail.com>
Wed, 25 Sep 2013 22:13:44 +0000 (00:13 +0200)
build.xml

index 4b35a7a6fb9460a3252754839b0b9a3d847b802b..93d03ce1e9b36556349f814fc64cd6b454b28d75 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -1,5 +1,11 @@
 <project name="mjc2wsl" default="all">
-
+    <property name="java.encoding" value="utf-8" />
+    <taskdef resource="net/sf/antcontrib/antlib.xml">
+        <classpath>
+            <pathelement location="/usr/share/java/"/>
+        </classpath>
+    </taskdef>
+    
     <property name="mjc2wsl.class.dir" value="bin" />
     <property name="mjc2wsl.src.dir" value="src" />
     <property name="mjc2wsl.options" value="" />
@@ -7,6 +13,9 @@
     <property name="compiler.class.dir" value="compiler-bin" />
     <property name="compiler.src.dir" value="compiler" />
 
+    <property name="samples.main.dir" value="samples" />
+    <property name="samples.temp.dir" value="samples-temp" />
+    
     <target name="help">
         <echo>Possible options:
         all - build the tool and the compiler and test on the samples
     <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 name="build" depends="init">
         </java>
     </target>
     
-    <target name="mj-samples" depends="mj-build">
-        <antcall target="mj-compile">
-            <param name="filename" value="samples/sample.mj" />
+    <target name="mj-samples" depends="build">
+        <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">
+            <param name="filename" value="samples-temp/sample.mj" />
         </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">
-            <param name="filename" value="samples/sample0.mj" />
+            <param name="filename" value="samples-temp/sample0.mj" />
         </antcall>
     </target>
     
     </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">
-            <param name="filename" value="samples/sample0.obj" />
+            <param name="filename" value="samples-temp/sample0.obj" />
         </antcall>
     </target>
     
             <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>
         </delete>
     </target>
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner