<?xml version="1.0"?>
<!-- 
 MadKit template build.xml
 Author: F. Michel
 Version: 2.0

This is generic build.xml file for building MadKit plugins using JAKARTA-ANT http://ant.apache.org/index.html 
 
available targets are :
	- jar (default): make a clean compilation, and creates the jar file into the jars directory. Also create runner file if cfg file available
	- compile : only compile sources.
	- clean : remove built directories and files. Also remove docs/api directory.
	- src-dist : create the source distribution of the plugin.
	- bin-dist : create the bin distribution of the plugin.
	- doc-dist : create the doc distribution of the plugin.
	- standalone-dist : create a zip file that can be expand run anywhere as an autonomous application. (a cfg file is required)
	- all : do it all at once.
 -->

<!-- 
     EDIT THIS PART ACCORDING TO YOUR OWN PROJECT
-->

<project name="documentation" default="jar" basedir="."> <!-- default is "jar" but can be changed to "compile" to only compile for instance -->

	<property file="../madkit.properties"/> <!-- using madkit project's default properties. -->

	<!--
	     Specify the plugin jar files and third party resources that are required for compiling (madkitkernel.jar at least) (must be located in the lib directory) 
	-->
	<fileset id="project.class.path" dir="${jars.dir}">
		<include name="madkitkernel.jar"/>
		<!-- <include name="other1.jar"/> -->
		<!-- <include name="other2.jar"/> -->
	</fileset>
	

 	<!--
	     Specify the plugin basic informations:
	     . source directory
	     . version of the plugin
	     . author
	     . other plugins dependencies: the required jars separated by "," whithout space
	     . description: a short description of what the plugin does
	-->
	<property name="src.dir" value="src"/>
	<property name="version"  value="0.1"/>
	<property name="author"  value="MadKit Team"/> <!-- the author's name -->
	<property name="depend"  value=""/> <!-- value="madkitkernel, messages, other1, other2" for instance (you will need madkitkernel at least) -->
	<property name="requires" value="" /> <!-- value="boo.jar", "images.jar", all the external jars that you would need -->
	<property name="description"  value="The general documentation plugin."/>

	<!--
	     Options:
	     . Specify the directory where your images (jpg and gifs) are located inside the src directory (they will be added in the jar file)
	     . Specify the name of the java packages to build api docs properly.
	     . Give a title to the generated html pages.
	-->
	<property name="images.dir" value="images"/> <!-- means that images are located in "${src}/images" or its subdirectories-->
	<property name="project.label"  value="The Template project"/>

<!-- 
-->


<!-- 
     GENERIC PART (edit to achieve more functionalities or delete unused targets)
-->

	<target name="jar" description="Jars the plugin into the jars.dir directory and create launch file if a cfg file available">
		<echo message="Documentation cannot be put in a jar"/>
	</target>

	<target name="docs">
		<ant antfile="${generic.file}" dir="." target="docs" inheritrefs="true"/>
	</target>

	<target name="clean">
		<ant antfile="${generic.file}" dir="." target="clean" inheritrefs="true"/>
	</target>

	<target name="real-clean">
		<ant antfile="${generic.file}" dir="." target="real-clean" inheritrefs="true"/>
	</target>

	<target name="all">
		<ant antfile="${generic.file}" dir="." target="all" inheritrefs="true"/>
	</target>

	<target name="src-dist">
		<ant antfile="${generic.file}" dir="." target="src-dist" inheritrefs="true"/>
	</target>

	<target name="bin-dist">
		<ant antfile="${generic.file}" dir="." target="bin-dist" inheritrefs="true"/>
	</target>

	<target name="doc-dist">
		<ant antfile="${generic.file}" dir="." target="doc-dist" inheritrefs="true"/>
	</target>

	<target name="standalone-dist">
		<ant antfile="${generic.file}" dir="." target="standalone-dist" inheritrefs="true"/>
	</target>
	
	<target name="plugin-dist">
		<property file="${installer.dir}/component.properties"/> 
		<propertyfile file="${installer.dir}/component.properties" >
			<entry key="component.number" type="int" default="0" operation="+"/>
		</propertyfile>
			
		<propertyfile file="${installer.dir}/plugins.properties">
			<entry key="comp.${component.number}.name" value="${project.name}"/>
		  	<entry  key="comp.${component.number}.version" value="${version}"/>
		  	<entry  key="comp.${component.number}.depend" value="${depend}"/>
		  	<entry  key="comp.${component.number}.description" value="${description}"/>
		  	<entry  key="comp.count" value="${component.number}"/>
		</propertyfile>
		
		
	<!--	<concat destfile="${installer.dir}/plugins.properties" append="true">
			<filelist dir="${installer.dir}" files="temp.properties"/>
  		</concat> -->
		
		<zip destfile="${installer.dir}/${project.name}-${version}.zip">
			<zipfileset dir="." includes="build.xml" prefix="${plugins.root.path}/${project.name}"/>
			<zipfileset dir="${src.dir}" includes="**/*" prefix="${plugins.root.path}/${project.name}/${src.dir}"/>
			<zipfileset dir="../../docs" includes="**/*" prefix="docs"/>
		</zip>
	</target>

	<target name="web-dist">
<!--		<ant antfile="${generic.file}" dir="." target="web-dist" inheritrefs="true"/>-->
	</target>
</project>
