<?xml version="1.0" encoding="UTF-8"?>
<!-- ====================================================================== 
     Ant build file for PDFlib Java sample programs.
     
     Requires Ant 1.6 or newer.
     
     $Id: build.xml,v 1.4 2009/09/21 12:48:33 stm Exp $                    
     ====================================================================== -->
<project name="pdflib-java-samples" default="run">
	
	<description>Ant build file for PDFlib Java sample programs</description>

	<property name="bin.dir" value="bin" />
	<property name="src.dir" value="${basedir}" />

	<path id="project.class.path">
		<pathelement location="pdflib.jar" />
		<pathelement path="${bin.dir}" />
	</path>

	<macrodef name="runsample" description="Execute the PDFlib sample program specified in attribute 'name'">
		<attribute name="name" />
		<sequential>
			<echo message="@{name}" />
			<java classname="@{name}" fork="true">
				<classpath refid="project.class.path" />
				<sysproperty key="java.library.path" path="${basedir}:${basedir}/.libs" />
			</java>
		</sequential>
	</macrodef>

	<target name="run" depends="compile">
		<runsample name="businesscard" />
		<runsample name="chartab" />
		<runsample name="hello" />
		<runsample name="image" />
		<runsample name="invoice" />
		<runsample name="pdfclock" />
		<runsample name="quickreference" />
		<runsample name="starter_3d" />
		<runsample name="starter_basic" />
		<runsample name="starter_block" />
		<runsample name="starter_color" />
		<runsample name="starter_fallback" />
		<runsample name="starter_geospatial" />
		<runsample name="starter_graphics" />
		<runsample name="starter_image" />
		<runsample name="starter_layer" />
		<runsample name="starter_opentype" />
		<runsample name="starter_path" />
		<runsample name="starter_pcos" />
		<runsample name="starter_pdfa1b" />
		<runsample name="starter_pdfmerge" />
		<runsample name="starter_pdfx3" />
		<runsample name="starter_pdfx4" />
		<runsample name="starter_pdfx5g" />
		<runsample name="starter_portfolio" />
		<runsample name="starter_pvf" />
		<runsample name="starter_shaping" />
		<runsample name="starter_table" />
		<runsample name="starter_tagged" />
		<runsample name="starter_textflow" />
		<runsample name="starter_textline" />
		<runsample name="starter_type3font" />
		<runsample name="starter_webform" />
	</target>

	<target name="compile">
		<mkdir dir="${bin.dir}" />
		<javac destdir="${bin.dir}">
			<classpath refid="project.class.path" />
			<src path="${src.dir}" />
			<exclude name="j2ee/**" />
		</javac>
	</target>
	
	<target name="clean">
		<delete dir="${bin.dir}" />
		<delete file="*.pdf" />
	</target>

</project>
