<project name="restlet-jpa" default="help" xmlns:ivy="antlib:org.apache.ivy.ant">
	<!-- Sarugo common ant configuration -->
	<property name="ant.lib.dir" value="ant" />
	<property name="ant.server" value="http://ant.sarugo.org" />
	<property name="build.common.url" value="${ant.server}/build-common.xml" />
	<property name="build.common.file" value="${ant.lib.dir}/build-common.xml" />
	<condition property="download-build.common.required">
		<not>
			<available file="${build.common.file}" type="file" />
		</not>
	</condition>
	<condition property="bootstrap.required">
		<not>
			<available file="${ant.lib.dir}" type="dir" />
		</not>
	</condition>

	<target name="download-build.common">
		<get ignoreerrors="true" src="${build.common.url}" dest="${build.common.file}" usetimestamp="true" />
	</target>

	<import file="${build.common.file}" optional="true" />

	<target name="bootstrap" description="Download build dependencies and libraries">
		<mkdir dir="${ant.lib.dir}" />
		<antcall target="download-build.common" />
		<antcall target="common.bootstrap" />
	</target>

	<target name="project.package">
		<mkdir dir="${dist.dir}" />
		<jar destfile="${dist.dir}/${project.name}-${build.rev}.jar">
			<fileset dir="${build.dir}/main/java">
				<include name="**/*.class" />
				<exclude name="org/sarugo/xtc/restlet/jpa/converter/JSONConverter.class" />
				<exclude name="org/sarugo/xtc/restlet/jpa/converter/XTCConverter.class" />
			</fileset>
			<fileset dir="${build.dir}/main/resources" />
		</jar>
		<jar destfile="${dist.dir}/${project.name}-json-${build.rev}.jar">
			<fileset dir="${build.dir}/main/java">
				<include name="org/sarugo/xtc/restlet/jpa/converter/JSONConverter.class" />
			</fileset>
		</jar>
		<jar destfile="${dist.dir}/${project.name}-xtc-${build.rev}.jar">
			<fileset dir="${build.dir}/main/java">
				<include name="org/sarugo/xtc/restlet/jpa/converter/XTCConverter.class" />
			</fileset>
		</jar>
		<!-- Use ivy to copy the runtime dependencies to distribution directory -->
		<ivy:retrieve pattern="${dist.dir}/[artifact]-[revision].[ext]" conf="default" useOrigin="true" />
		<property name="skip.common.package" value="true" />
	</target>

	<target name="help">
		<echo message="Run ant -p to see a list of targets." />
	</target>

</project>
