<?xml version="1.0" encoding="UTF-8"?>
<project name="session" basedir="." default="wsgen">
	<property environment="env" />
	<property name="java.home" value="C:\Program Files\Java\jdk1.6.0_11" />
	<property name="jaxws.lib.home" value="D:\Book\jaxws-ri\lib" />
	<property name="tomcat.home" value="D:\Book\apache-tomcat-7.0.26" />
	<property name="build.dir" value="build" />
	<property name="jar.dir" value="jar" />
	<property name="jar.name" value="meteo" />
	<property name="war.name" value="services.war" />
	<property name="resources.home" value="${basedir}/resources" />


	<path id="jaxws.classpath">
		<fileset dir="${jaxws.lib.home}">
			<include name="*.jar" />
		</fileset>
	</path>

	<target name="compile.serveur">
		<delete dir="${jar.dir}" />
		<mkdir dir="${jar.dir}" />
		<mkdir dir="${jar.dir}/classes" />
		<javac debug="on" fork="true" destdir="${jar.dir}/classes" srcdir="${basedir}/src">
		</javac>
		<jar destfile="${jar.dir}/${jar.name}.jar">
			<fileset excludes="**/Test.class" dir="${jar.dir}/classes" />
		</jar>
	</target>
	<!-- il faut un jar pour wsgen-->
	<path id="wsgen.path">
		<pathelement location="${jar.dir}/${jar.name}.jar" />
	</path>

	<target name="wsgen">
		<taskdef name="wsgen" classname="com.sun.tools.ws.ant.WsGen">
			<classpath path="jaxws.classpath" />
		</taskdef>
		<mkdir dir="${basedir}/resources" />
		<mkdir dir="${build.dir}/classes" />
		<wsgen destdir="${build.dir}/classes" sourcedestdir="${basedir}/src" genwsdl="true" verbose="true" resourcedestdir="${basedir}/resources" keep="true" sei="serveur.ServiceMeteo">
			<classpath refid="wsgen.path" />
		</wsgen>
	</target>
	<!-- on doit rajouter les classes generees -->
	<target name="compile.wsgen">
		<delete dir="${build.dir}" />
		<mkdir dir="${build.dir}" />
		<mkdir dir="${build.dir}/classes" />
		<javac debug="on" fork="true" destdir="${build.dir}/classes" srcdir="${basedir}/src" />
		<copy todir="${build.dir}/classes">
			<fileset dir="${jar.dir}/classes">
				<include name="*.class" />
			</fileset>
		</copy>
	</target>

	<target name="clean">
		<delete dir="${jar.dir}" />
		<delete dir="${build.dir}" />
	</target>

	<target name="xjc">
		<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask">
			<classpath>
				<fileset dir="${jaxws.lib.home}" includes="*.jar" />
			</classpath>
		</taskdef>
		<xjc schema="resources/Requete.xsd" destdir="src" package="serveur.xjc" />
	</target>
	<target name="war">
		<war destFile="${war.name}" webxml="./WEB-INF/web.xml" basedir="${basedir}">
			<classes dir="${build.dir}/classes" />
			<lib dir="${jaxws.lib.home}" />
			<fileset dir="${basedir}/WEB-INF" includes="*.xml" excludes="web.xml" />
		</war>
	</target>
	<target name="deploy">
		<copy file="${war.name}" todir="${tomcat.home}/webapps" />
		<delete file="meteo.war" />
	</target>
</project>