<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright (c) 2009, 2013 Tasktop Technologies and others.
    All rights reserved. This program and the accompanying materials
    are made available under the terms of the Eclipse Public License v1.0
    which accompanies this distribution, and is available at
    http://www.eclipse.org/legal/epl-v10.html
   
    Contributors:
         Tasktop Technologies - initial API and implementation
 -->
<project name="org.eclipse.mylyn.wikitext-standalone" default="all">
    <description>
    Enables standalone usage of WikiText by creating a download archive 
    that may be used outside of Eclipse
    </description>

    <target name="all" description="description">
    	<fail unless="wikitext.standalone.archive">Must define wikitext.standalone.archive</fail>
    	<fail unless="wikitext.standalone.dir">Must define wikitext.standalone.dir</fail>
    	<fail unless="wikitext.sources.location">Must define wikitext.sources.location</fail>
    	<fail unless="wikitext.plugin.jars.location">Must define wikitext.plugin.jars.location</fail>
    	<fail unless="wikitext.version">Must define wikitext.version</fail>
    	<fail unless="buildDirectory">Must define buildDirectory</fail>
    	
    	<antcall target="javadoc"/>
    	
        <zip destfile="${wikitext.standalone.archive}">
        	<zipfileset prefix="${wikitext.standalone.dir}" dir="${wikitext.plugin.jars.location}">
        		<include name="org.eclipse.mylyn.wikitext.*core*.jar"/>
        		<include name="com.google.guava*.jar"/>
        		<exclude name="org.eclipse.mylyn.wikitext.*source*.jar"/>
        	</zipfileset>
        	<zipfileset prefix="${wikitext.standalone.dir}/docs" dir="${wikitext.sources.location}/org.eclipse.mylyn.wikitext.help.ui/help">
        		<include name="**/*"/>
        	</zipfileset>
        	<zipfileset prefix="${wikitext.standalone.dir}" dir="${wikitext.sources.location}/org.eclipse.mylyn.wikitext-feature">
        		<include name="license.html"/>
        	</zipfileset>
        	<zipfileset prefix="${wikitext.standalone.dir}/src" dir="${wikitext.sources.location}">
        		<include name="org.eclipse.mylyn.wikitext.*core*/src/**/*"/>
        		<include name="org.eclipse.mylyn.wikitext.*core*/META-INF/**/*"/>
        		<exclude name="org.eclipse.mylyn.wikitext.*source*/**/*"/>
        	</zipfileset>
        	<zipfileset prefix="${wikitext.standalone.dir}/apidoc" dir="${buildDirectory}/wikitext-apidoc">
        		<include name="**/*"/>
        	</zipfileset>
        </zip>
    </target>

	<target name="javadoc">
		<fail unless="buildDirectory">Must define buildDirectory</fail>
    	<fail unless="wikitext.sources.location">Must define wikitext.plugin.jars.location</fail>
    	<fail unless="wikitext.plugin.jars.location">Must define wikitext.plugin.jars.location</fail>
		<fail unless="wikitext.version">Must define wikitext.version</fail>

		<dirset dir="${wikitext.sources.location}" id="">
			<include name="org.eclipse.mylyn.wikitext.*core*/src"/>
		</dirset>
		
		<javadoc destdir="${buildDirectory}/wikitext-apidoc">
			<fileset dir="${wikitext.sources.location}">
				<include name="org.eclipse.mylyn.wikitext.*core*/src/**/*.java"/>
				<exclude name="org.eclipse.mylyn.wikitext.*core*/**/internal/**/*"/>
			</fileset>
			<classpath>
				<fileset dir="${wikitext.plugin.jars.location}">
					<include name="org.eclipse.mylyn.wikitext.*core*.jar"/>
				</fileset>
			</classpath>
			<doctitle><![CDATA[Mylyn WikiText]]></doctitle>
			<header><![CDATA[Mylyn WikiText version ${wikitext.version}]]></header>
			<bottom><![CDATA[<i>Copyright &#169; 2007, 2013 David Green and others.<br/>
				All rights reserved. This program and the accompanying materials<br/>
				are made available under the terms of the Eclipse Public License v1.0<br/>
				which accompanies this distribution, and is available at<br/>
				<a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a></i>]]></bottom>
		    <link href="http://java.sun.com/javase/6/docs/api/"/>
			
		</javadoc>
		
		
	</target>
	 
	
</project>
