<!--
build.xml
Author: Christoph Csallner

2005-07-28 Moved compilation to use.xml
2005-07-15 Added compilation of inferee (test-case used to infer invariants)
2005-06-02 Started

====================================================================
Testee Ant build file, located in testee root directory
Compiles testee, calls cnc.xml to generate, compile, run, and archive tests.
Adapt properties below to your project and environment settings.
====================================================================
-->

<project name="Groovy" default="cnc" basedir=".">
  <description>
		Build and Check 'n Crash testee.
	</description>
	
  <!--Environment-->
	<property name="cnc.version" value="0.8.6"/>
	<property name="cnc.jar" value="c:\lib\cnc-${cnc.version}.jar"/>
	<property name="java.rt.jar" value="c:\bin\jdk-1.4.2_08\jre\lib\rt.jar"/>
  <property name="simplify" value="Simplify-1.5.4.exe"/>
	
  <!--Project-->
	<property name="classpath" value="c:\lib\xml-apis-1.0.b2.jar;c:\lib\commons-logging-1.0.3.jar;c:\lib\asm-1.3.4.jar;c:\lib\asm-util-1.3.4.jar;c:\lib\commons-cli-1.0.jar;c:\lib\mockobjects-core-0.09.jar;c:\lib\junit-3.8.1.jar;c:\lib\servletapi-2.3.jar;c:\lib\ant.jar;c:\lib\bsf-2.3.0-rc1.jar;c:\lib\xerces-2.4.0.jar;c:\lib\classworlds-1.0-rc2.jar;c:\lib\mx4j-2.0-beta-1.jar;c:\lib\openejb-loader-0.9.2.jar;c:\lib\axion-1.0-M3-dev.jar;c:\lib\commons-collections-3.0-dev2.jar;c:\lib\regexp-1.2.jar;c:\lib\ant-optional-1.5.jar"/>		
  <property name="src" value="groovy-1.0-beta-1-src/src/main"/> <!--no backslashes as used as pattern-->
  <property name="bin" value="cnc-bin"/>  <!--generated for classes, which will contain debug information-->
	<property name="test.src" value="cnc-test-src"/>  <!--generated for CnC-generated test case sources-->	
	<property name="test.bin" value="cnc-test-bin"/>  <!--generated for CnC-generated test case sources-->	
	<property name="testee.list.filename" value="testees.txt"/>
	
	<!--Daikon-->
	<!--  -->
	<property name="inferee.exec" value="groovy-1.0-beta-1-src"/>
	<property name="inferee.filename" value="inferee.txt"/>
	<property name="inferee.src" value="groovy-1.0-beta-1-src/src/test"/>
	<property name="modify.pre" value="none"/>
	<property name="modify.post" value="none"/>


	<!---ESC/CnC-->
	<property name="cnc.params" value="-NPE"/>  <!--CnC: -NPE-->
	<property name="esc.params" value="-ea -source 1.4 -loop 1.5"/>	
	<path id="esc.params.classpath">
		<pathelement location="${java.rt.jar}"/>
		<pathelement location="${cnc.jar}"/> 
		<pathelement path="${classpath}"/>
		<pathelement location="${bin}"/>
	</path>
	<path id="esc.params.sourcepath">
		<pathelement location="${src}"/>
	</path>	
	<path id="esc.params.specs">
		<pathelement location="${cnc.jar}"/>  <!--comment out to ignore JDK specs-->	
		<pathelement location="${src}"/>
	</path>	
	
	
	<!--Compile Groovy test case: Use debug switch like use.xml-->
	<target name="groovyc">
		<mkdir dir="${bin}"/>
		<javac classpath="${classpath}" srcdir="${src}" destdir="${bin}" fork="true" debug="true"
				source="1.4" target="1.4"/>  <!--Groovy-->
		<javac classpath="${classpath};${cnc.jar}" srcdir="${inferee.src}" destdir="${bin}"
				excludes="JUnitAll.java" fork="true" debug="true"/>  <!--Test.java-->
		<taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpath="${classpath};${bin}"/>
    <groovyc classpath="${classpath};${bin};${cnc.jar}" srcdir="${inferee.src}" destdir="${bin}"/>  <!--Test.groovy-->
	</target>
	
	<target name="junitall.create">
		<java classname="edu.gatech.cc.junit.CreateJUnitAll" fork="true" classpath="${classpath};${cnc.jar};${bin}"/>
		<move file="${bin}/JUnitAll.java" todir="${inferee.src}"/>
	</target>	
	
	<target name="junitall.compile">  <!--Redundant to inferee.compile in use.xml-->
		<javac classpath="${cnc.jar};${bin}" srcdir="${inferee.src}" destdir="${bin}" fork="true" includes="JUnitAll.java"/>
	</target>
	
	<target name="junitall.run">
		<java classname="edu.gatech.cc.junit.textui.RaGTestRunner" fork="true"			
				dir="${inferee.exec}" output="junit.txt" classpath="${cnc.jar};${classpath};${bin}">
			<arg value="-noreinit"/>
			<arg value="JUnitAll"/>
		</java>
	</target>
	
	
	<!--cnc-->
	<target name="cnc">
		<unjar src="${cnc.jar}" dest=".">
			<patternset includes="use.xml,daikon-config.txt"/>
		</unjar>
		<ant antfile="use.xml" dir=".">
			<reference refid="esc.params.classpath"/>
			<reference refid="esc.params.sourcepath"/>
			<reference refid="esc.params.specs"/>
		</ant>
		<delete>
			<fileset dir="." includes="use.xml,daikon-config.txt"/>
		</delete>
	</target>
	
	<!--clean-->
	<target name="clean"	description="delete all generated files except the archive-bundle">
		<delete dir="${test.bin}"/>
		<delete dir="${test.src}"/>
		<delete dir="groovy-1.0-beta-1-src/target"/>  <!--Groovy ONLY-->
		<delete>
	  	<fileset dir="${basedir}">  <!--deletes . if nested patternsets omitted-->
	  		<patternset includes="*.chicory.txt,*.cnc.txt,*.daikon.txt,*.junit.txt"/>
	  	</fileset>
		</delete>
	</target>			
</project>
