<?xml version="1.0"?>
<project name="org.wikipathways.client" default="jar" basedir=".">

	<import file="../../build-common.xml" />

	<!-- WikiPathways client -->
	<property name="axis.wpclient.dir" value="gen-src"/>
	<property name="lib.axis.dir" value="../../tools/cytoscape-gpml/lib" />

	<path id="project.class.path">
		<fileset dir="${lib.axis.dir}" includes="*.jar" />
		<fileset dir="../../lib">
			<include name="com.springsource.org.jdom-1.1.0.jar" />
			<include name="derby.jar" />
			<include name="org.bridgedb.jar" />
			<include name="org.bridgedb.rdb.jar" />
			<include name="org.bridgedb.bio.jar" />
		</fileset>
		<fileset dir="${bundle.dest}">
			<include name="org.pathvisio.core.jar"/>
		</fileset>
	</path>

	<target name="compile" depends="wpclient-axis,prepare-common,prepare-jar-name">
		<javac srcdir="${axis.wpclient.dir}" debug="${debug.mode}" destdir="build">
			<classpath refid="project.class.path" />
		</javac>
		<javac srcdir="src" debug="${debug.mode}" destdir="build">
			<classpath refid="project.class.path" />
		</javac>
	</target>
	
	<target name="wpclient-axis" depends="prepare">
        <condition property="wsdl.url" value="http://www.wikipathways.org/wpi/webservice/webservice.php?wsdl">
            <not> <isset property="wsdl.url"/> </not>
        </condition>
		<java classpathref="project.class.path" fork="true" failonerror="true" classname="org.apache.axis.wsdl.WSDL2Java">
			<arg value="-o" />
			<arg value="${axis.wpclient.dir}" />
			<arg value="-p" />
			<arg value="org.pathvisio.wikipathways.webservice" />
			<arg value="${wsdl.url}" />
		</java>
	</target>
	
	<target name="wp-bots">
		<mkdir dir="build/bot"/>
		<unjar src="../org.pathvisio.core.jar" dest="build/bot"/>
		<unjar src="../org.wikipathways.client.jar" dest="build/bot"/>
		
		<unjar src="../../lib/com.springsource.org.jdom-1.1.0.jar" dest="build/bot"/>
		<unjar src="../../lib/derby.jar" dest="build/bot"/>
		<unjar src="../../lib/org.bridgedb.jar" dest="build/bot"/>
		<unjar src="../../lib/org.bridgedb.rdb.jar" dest="build/bot"/>
		<unjar src="../../lib/org.bridgedb.bio.jar" dest="build/bot"/>

		<unjar src="${lib.axis.dir}/axis.jar" dest="build/bot"/>
		<unjar src="${lib.axis.dir}/axis-ant.jar" dest="build/bot"/>
		<unjar src="${lib.axis.dir}/commons-discovery-0.2.jar" dest="build/bot"/>
		<unjar src="${lib.axis.dir}/commons-logging-1.0.4.jar" dest="build/bot"/>
		<unjar src="${lib.axis.dir}/jaxrpc.jar" dest="build/bot"/>
		<unjar src="${lib.axis.dir}/log4j-1.2.8.jar" dest="build/bot"/>
		<unjar src="${lib.axis.dir}/saaj.jar" dest="build/bot"/>
		<unjar src="${lib.axis.dir}/wsdl4j-1.5.1.jar" dest="build/bot"/>
		
		<jar file="org.wikipathways.bots-${pathvisio.version}.jar" basedir="build/bot"/>
		<delete dir="build/bots"/>
	</target>

</project>
