<project name="antupdate" default="test" basedir=".">

	<description>Shows how multiple JRXML files can be updated in batch mode using the ANT build tool.</description>

	<path id="classpath">
		<pathelement location="./build/classes"/>
		<pathelement location="../../../build/classes"/>
		<fileset dir="../../../lib">
			<include name="**/*.jar"/>
		</fileset>
		<pathelement location="../../fonts"/>
	</path>
	
	<path id="runClasspath">
		<path refid="classpath"/>
	</path>

	<taskdef name="jru" classname="net.sf.jasperreports.ant.JRAntUpdateTask"> 
		<classpath refid="classpath"/>
	</taskdef>

	<target name="update1" description="Updates report designs specified using the &quot;srcdir&quot; in the &lt;jru&gt; tag."> 
		<mkdir dir="./build/reports"/> 
		<jru 
				srcdir="./reports"
				destdir="./build/reports">
			<classpath refid="runClasspath"/>
			<include name="**/*.jrxml"/>
			<!--
			<updater>com.update.StyleUpdater</updater>
			-->
		</jru>
	</target> 

	<target name="update2" description="Updates report designs specified using a &lt;fileset&gt; in the &lt;src&gt; tag.">
		<mkdir dir="./build/reports"/> 
		<jru destdir="./build/reports">
			<src>
				<fileset dir="./reports">
					<include name="**/*.jrxml"/>
				</fileset>
			</src>
			<classpath refid="runClasspath"/>
			<!--
			<updater>com.update.StyleUpdater</updater>
			-->
		</jru> 
	</target> 

	<taskdef name="jrc" classname="net.sf.jasperreports.ant.JRAntCompileTask"> 
		<classpath refid="classpath"/>
	</taskdef>

	<target name="javac" description="Compiles the Java source files used in the report designs.">
		<mkdir dir="./build/classes"/> 
		<javac srcdir="./src" destdir="./build/classes" debug="true" optimize="false" deprecation="true"
				encoding="ISO-8859-1" includeantruntime="false">
			<compilerarg value="-Xlint:unchecked"/>
			<compilerarg value="-Xlint:-options"/>
			<classpath refid="runClasspath"/>
		</javac>
	</target> 

	<target name="compile" depends="javac" description="Compiles the initial report designs."> 
		<mkdir dir="./build/reports"/> 
		<delete dir="./build">
			<include name="**/*.jasper"/>
		</delete>
		<jrc 
				srcdir="./reports"
				destdir="./build/reports">
			<classpath refid="runClasspath"/>
			<include name="**/*.jrxml"/>
		</jrc>
	</target> 

	<target name="compileUpdated" depends="javac" description="Compiles the updated report designs."> 
		<mkdir dir="./build/reports"/> 
		<delete dir="./build">
			<include name="**/*.jasper"/>
		</delete>
		<jrc 
				srcdir="./build/reports"
				destdir="./build/reports">
			<classpath refid="runClasspath"/>
			<include name="**/*.jrxml"/>
		</jrc>
	</target> 

	<target name="clean" description="Deletes all the generated files.">
		<delete dir="./build" />
	</target>

	<target name="test" description="Runs the sample.">
		<echo message="==================================="/>
		<echo message=" Ant Update Sample"/>
		<echo message="==================================="/>
		<antcall target="clean" />
		<antcall target="javac" />
		<antcall target="update1" />
		<antcall target="update2" />
	</target>

</project>
