<?xml version="1.0" encoding="UTF-8"?>
<project name="jenkinsapi.doc" default="all">
	<property file="build.properties"/>	
	
	<target name="all" depends="clean, doc_zip" />
	<target name="clean" depends="doc_clean" />
	
	<target name="doc_api">
			<property name="jenkinsapi.package.path" value="${basedir}/../jenkinsapi"/>
			<exec executable="sphinx-apidoc" >
				        <arg value="-o"/>
						<arg value="source"/>
					    <arg value="${jenkinsapi.package.path}"/>
						<arg value="-f"/>
			</exec>
	</target>
	
	<target name="doc" depends="doc_clean,doc_api">
		<mkdir dir="${docs.html.dir}" />
		<exec executable="sphinx-build" >
			        <arg value="-b"/>
					<arg value="html"/>
				    <arg value="${docs.source.dir}"/>
					<arg value="${docs.html.dir}"/>
		</exec>
	</target>
	
	<target name="doc_clean">
		<delete failonerror="false">
			<fileset dir="doc"/>
		</delete>
		<delete failonerror="false" file="${docs.zipfile.filename}" />
	</target>
	
	<target name="doc_zip" depends="doc">
		<property name="html_dirctory" location="${basedir}/${docs.html.dir}" />
		<echo message="Building zip from ${html_dirctory} as ${docs.zipfile.filename}" />
		<zip destfile="${docs.zipfile.filename}" basedir="${html_dirctory}"/>
	</target>
	
	
</project>