<?xml version="1.0" encoding="UTF-8" ?>

<!--
/*   **********************************************************************  **
 **   Copyright notice                                                       **
 **                                                                          **
 **   (c) 2003-2004 RSSOwl Development Team                                  **
 **   http://www.rssowl.org/                                                 **
 **                                                                          **
 **   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.rssowl.org/legal/epl-v10.html                               **
 **                                                                          **
 **   A copy is found in the file epl-v10.html and important notices to the  **
 **   license from the team is found in the textfile LICENSE.txt distributed **
 **   in this package.                                                       **
 **                                                                          **
 **   This copyright notice MUST APPEAR in all copies of the file!           **
 **                                                                          **
 **   Contributors:                                                          **
 **     RSSOwl - initial API and implementation (bpasero@rssowl.org)         **
 **                                                                          **
 **  **********************************************************************  */
-->

<project basedir="." default="deploy_win" name="RSSOwl Source">

	<!-- 
    	Variables used in the script. You have to change the "desktop"
    	value in order to deploy RSSOwl to your desktop or any other
    	desired location.
    -->
	<property name="root" value="${basedir}/.." />
	<property name="temp" value="${java.io.tmpdir}/source/" />
	<property name="src" value="${root}/src/java/" />
	<property name="build" value="${temp}/build" />
	<property name="deploy" value="${temp}/deploy" />
	<property name="classes" value="${build}/classes" />

	<!-- Libraries (including SWT for win, mac, linux and solaris) -->
	<property name="libs" value="${root}/lib/swt.jar; 
                     ${root}/lib/swt-nl.jar; 
                     ${root}/lib/jdom.jar; 
                     ${root}/lib/jface.jar; 
                     ${root}/lib/xerces.jar;
                     ${root}/lib/BlowfishJ.jar;
                     ${root}/lib/iTextAsian.jar;
        						 ${root}/lib/codec-1.3.jar;
        						 ${root}/lib/httpclient-3.0.1.jar;
        						 ${root}/lib/logging-1.0.4.jar;
                     ${root}/lib/itext.jar" />
	<property name="SWT" value="${root}/lib/swt.jar" />
	<property name="SWT-NL" value="${root}/lib/swt-nl.jar" />
	<property name="JDOM" value="${root}/lib/jdom.jar" />
	<property name="XERCES" value="${root}/lib/xerces.jar" />
	<property name="JFACE" value="${root}/lib/jface.jar" />
	<property name="BLOWFISH" value="${root}/lib/BlowfishJ.jar" />
	<property name="ITEXT" value="${root}/lib/itext.jar" />
	<property name="ITEXTASIAN" value="${root}/lib/iTextAsian.jar" />
	<property name="CODEC" value="${root}/lib/codec-1.3.jar" />
	<property name="HTTPCLIENT" value="${root}/lib/httpclient-3.0.1.jar" />
	<property name="LOGGING" value="${root}/lib/logging-1.0.4.jar" />
	<property name="res" value="${temp}/res" />

	<!-- Source directory -->
	<property name="source_root" value="${basedir}/../../rssowl_src/" />

	<!-- Change to release to your desired location -->
	<property name="desktop" value="C:\Dokumente und Einstellungen\bpasero\Desktop" />

	<!-- RSSOwl & SWT Version -->
	<property name="version" value="1_2_3" />
	<property name="swt_version" value="3235" />

	<!-- 
		Clean the folders that were created during deployment
    -->
	<target name="clean">
		<delete dir="${build}" />
		<delete dir="${deploy}" />
		<delete dir="${res}" />
	</target>

	<!-- 
		Create directorys to deploy RSSOwl. Copy contents
		of images and usr data into.
    -->
	<target name="init" depends="clean">
		<mkdir dir="${build}" />
		<mkdir dir="${classes}" />
		<mkdir dir="${deploy}" />
		<mkdir dir="${build}/classes/img" />
		<copy todir="${build}/classes/img">
			<fileset dir="${root}/img" />
		</copy>
		<mkdir dir="${build}/classes/usr" />
		<copy todir="${build}/classes/usr">
			<fileset dir="${root}/usr" />
		</copy>
	</target>

	<!-- 
		Target OS: Win32
		
		Compile RSSOwl using UTF-8 encoding. This is important
		for the special-chars of the translations.
    -->
	<target name="compile_win" depends="init">
		<javac excludes="**/DevShop.java" encoding="utf8" destdir="${classes}/" srcdir="${src}" classpath="${libs}" />
	</target>

	<!-- 
		Target OS: Linux
		
		Compile RSSOwl using UTF-8 encoding. This is important
		for the special-chars of the translations.
    -->
	<target name="compile_linux" depends="init">
		<javac excludes="**/DevShop.java" encoding="utf8" destdir="${classes}/" srcdir="${src}" classpath="${libs}" />
	</target>

	<!-- 
			Target OS: Linux 64 Bit
			
			Compile RSSOwl using UTF-8 encoding. This is important
			for the special-chars of the translations.
	    -->
	<target name="compile_linux64" depends="init">
		<javac excludes="**/DevShop.java" encoding="utf8" destdir="${classes}/" srcdir="${src}" classpath="${libs}" />
	</target>

	<!-- 
		Target OS: Mac
		
		Compile RSSOwl using UTF-8 encoding. This is important
		for the special-chars of the translations.
	-->
	<target name="compile_mac" depends="init">
		<javac excludes="**/DevShop.java" encoding="utf8" destdir="${classes}/" srcdir="${src}" classpath="${libs}" />
	</target>

	<!-- 
		Target OS: Solaris
		
		Compile RSSOwl using UTF-8 encoding. This is important
		for the special-chars of the translations.
	-->
	<target name="compile_solaris" depends="init">
		<javac excludes="**/DevShop.java" encoding="utf8" destdir="${classes}/" srcdir="${src}" classpath="${libs}" />
	</target>

	<!-- 
		Target OS: Win32
		
		Pack compiled RSSOwl into executable JAR file.
    -->
	<target name="jar_win" depends="compile_win">
		<unjar src="${SWT}" dest="${classes}" />
		<unjar src="${SWT-NL}" dest="${classes}" />
		<unjar src="${JDOM}" dest="${classes}" />
		<unjar src="${JFACE}" dest="${classes}" />
		<unjar src="${XERCES}" dest="${classes}" />
		<unjar src="${CODEC}" dest="${classes}" />
		<unjar src="${HTTPCLIENT}" dest="${classes}" />
		<unjar src="${LOGGING}" dest="${classes}" />
		<unjar src="${ITEXT}" dest="${classes}" />
		<unjar src="${ITEXTASIAN}" dest="${classes}" />
		<unjar src="${BLOWFISH}" dest="${classes}" />
		<delete file="${classes}/META-INF/LICENSE.txt" />
		<delete file="${classes}/META-INF/info.xml" />
		<jar jarfile="${deploy}/rssowl.jar" basedir="${classes}">
			<manifest>
				<attribute name="Main-Class" value="net.sourceforge.rssowl.controller.RSSOwlLoader" />
			</manifest>
		</jar>
	</target>

	<!-- 
		Target OS: Linux
		
		Pack compiled RSSOwl into executable JAR file.
    -->
	<target name="jar_linux" depends="compile_linux">
		<unjar src="${SWT}" dest="${classes}" />
		<unjar src="${SWT-NL}" dest="${classes}" />
		<unjar src="${JDOM}" dest="${classes}" />
		<unjar src="${JFACE}" dest="${classes}" />
		<unjar src="${XERCES}" dest="${classes}" />
		<unjar src="${ITEXT}" dest="${classes}" />
		<unjar src="${ITEXTASIAN}" dest="${classes}" />
		<unjar src="${CODEC}" dest="${classes}" />
		<unjar src="${HTTPCLIENT}" dest="${classes}" />
		<unjar src="${LOGGING}" dest="${classes}" />
		<unjar src="${BLOWFISH}" dest="${classes}" />
		<delete file="${classes}/META-INF/LICENSE.txt" />
		<delete file="${classes}/META-INF/info.xml" />
		<jar jarfile="${deploy}/rssowl.jar" basedir="${classes}">
			<manifest>
				<attribute name="Main-Class" value="net.sourceforge.rssowl.controller.RSSOwlLoader" />
			</manifest>
		</jar>
	</target>

	<!-- 
			Target OS: Linux 64 Bit
			
			Pack compiled RSSOwl into executable JAR file.
	    -->
	<target name="jar_linux64" depends="compile_linux64">
		<unjar src="${SWT}" dest="${classes}" />
		<unjar src="${SWT-NL}" dest="${classes}" />
		<unjar src="${JDOM}" dest="${classes}" />
		<unjar src="${JFACE}" dest="${classes}" />
		<unjar src="${CODEC}" dest="${classes}" />
		<unjar src="${HTTPCLIENT}" dest="${classes}" />
		<unjar src="${LOGGING}" dest="${classes}" />
		<unjar src="${ITEXT}" dest="${classes}" />
		<unjar src="${ITEXTASIAN}" dest="${classes}" />
		<unjar src="${XERCES}" dest="${classes}" />
		<unjar src="${BLOWFISH}" dest="${classes}" />
		<delete file="${classes}/META-INF/LICENSE.txt" />
		<delete file="${classes}/META-INF/info.xml" />
		<jar jarfile="${deploy}/rssowl.jar" basedir="${classes}">
			<manifest>
				<attribute name="Main-Class" value="net.sourceforge.rssowl.controller.RSSOwlLoader" />
			</manifest>
		</jar>
	</target>

	<!-- 
		Target OS: Mac
		
		Pack compiled RSSOwl into executable JAR file.
    -->
	<target name="jar_mac" depends="compile_mac">
		<unjar src="${SWT}" dest="${classes}" />
		<unjar src="${SWT-NL}" dest="${classes}" />
		<unjar src="${JDOM}" dest="${classes}" />
		<unjar src="${JFACE}" dest="${classes}" />
		<unjar src="${XERCES}" dest="${classes}" />
		<unjar src="${ITEXT}" dest="${classes}" />
		<unjar src="${ITEXTASIAN}" dest="${classes}" />
		<unjar src="${CODEC}" dest="${classes}" />
		<unjar src="${HTTPCLIENT}" dest="${classes}" />
		<unjar src="${LOGGING}" dest="${classes}" />
		<unjar src="${BLOWFISH}" dest="${classes}" />
		<delete file="${classes}/META-INF/LICENSE.txt" />
		<delete file="${classes}/META-INF/info.xml" />
		<jar jarfile="${deploy}/rssowl.jar" basedir="${classes}">
			<manifest>
				<attribute name="Main-Class" value="net.sourceforge.rssowl.controller.RSSOwlLoader" />
			</manifest>
		</jar>
	</target>

	<!-- 
		Target OS: Solaris
		
		Pack compiled RSSOwl into executable JAR file.
    -->
	<target name="jar_solaris" depends="compile_solaris">
		<unjar src="${SWT}" dest="${classes}" />
		<unjar src="${SWT-NL}" dest="${classes}" />
		<unjar src="${JDOM}" dest="${classes}" />
		<unjar src="${JFACE}" dest="${classes}" />
		<unjar src="${XERCES}" dest="${classes}" />
		<unjar src="${ITEXT}" dest="${classes}" />
		<unjar src="${ITEXTASIAN}" dest="${classes}" />
		<unjar src="${CODEC}" dest="${classes}" />
		<unjar src="${HTTPCLIENT}" dest="${classes}" />
		<unjar src="${LOGGING}" dest="${classes}" />
		<unjar src="${BLOWFISH}" dest="${classes}" />
		<delete file="${classes}/META-INF/LICENSE.txt" />
		<delete file="${classes}/META-INF/info.xml" />
		<jar jarfile="${deploy}/rssowl.jar" basedir="${classes}">
			<manifest>
				<attribute name="Main-Class" value="net.sourceforge.rssowl.controller.RSSOwlLoader" />
			</manifest>
		</jar>
	</target>

	<!-- 
		Target OS: Win32
		
		Copy rssowl.jar to root.
    -->
	<target name="deploy_win" depends="jar_win">
		<copy file="${deploy}/rssowl.jar" todir="${root}" overwrite="yes" />
	</target>

	<!-- 
		Target OS: Linux
		
		Copy rssowl.jar to root.
    -->
	<target name="deploy_linux" depends="jar_linux">
		<copy file="${deploy}/rssowl.jar" todir="${root}" overwrite="yes" />
	</target>

	<!-- 
			Target OS: Linux 64 Bit
			
			Copy rssowl.jar to root.
	    -->
	<target name="deploy_linux64" depends="jar_linux64">
		<copy file="${deploy}/rssowl.jar" todir="${root}" overwrite="yes" />
	</target>

	<!-- 
		Target OS: Mac
		
		Copy rssowl.jar to root.
    -->
	<target name="deploy_mac" depends="jar_mac">
		<copy file="${deploy}/rssowl.jar" todir="${root}" overwrite="yes" />
	</target>

	<!-- 
		Target OS: Solaris
		
		Copy rssowl.jar to root.
    -->
	<target name="deploy_solaris" depends="jar_solaris">
		<copy file="${deploy}/rssowl.jar" todir="${root}" overwrite="yes" />
	</target>

	<!-- 
		Create the resource JAR holding images and user data.
    -->
	<target name="res" depends="init">
		<mkdir dir="${res}" />
		<mkdir dir="${res}/img" />
		<copy todir="${res}/img">
			<fileset dir="${root}/img" />
		</copy>
		<mkdir dir="${res}/usr" />
		<copy todir="${res}/usr">
			<fileset dir="${root}/usr" />
		</copy>
		<jar jarfile="${deploy}/res.jar" basedir="${res}" />
		<copy file="${deploy}/res.jar" todir="${root}/lib" overwrite="yes" />
	</target>

	<!-- 
		Generate JavaDoc from project.
    -->
	<target name="javadoc">
		<javadoc additionalparam="-breakiterator" locale="en_US" destdir="..\doc\api" access="private" use="true" notree="false" nonavbar="false" noindex="false" splitindex="true" author="true" version="true" nodeprecatedlist="false" nodeprecated="false" packagenames="net.sourceforge.rssowl.controller,net.sourceforge.rssowl.controller.panel,net.sourceforge.rssowl.controller.dialog,net.sourceforge.rssowl.controller.dnd,net.sourceforge.rssowl.controller.statusline,net.sourceforge.rssowl.controller.popup,net.sourceforge.rssowl.controller.properties,net.sourceforge.rssowl.controller.sort,net.sourceforge.rssowl.controller.thread,net.sourceforge.rssowl.controller.tray,net.sourceforge.rssowl.dao,net.sourceforge.rssowl.dao.feedparser,net.sourceforge.rssowl.model,net.sourceforge.rssowl.util,net.sourceforge.rssowl.util.document,net.sourceforge.rssowl.util.archive,net.sourceforge.rssowl.util.i18n,net.sourceforge.rssowl.util.search,net.sourceforge.rssowl.util.shop" sourcepath="java" bottom="&lt;a href='http://www.rssowl.org'&gt;RSSOwl - RSS / RDF / Atom Newsreader&lt;/a&gt; &lt;br/&gt;&lt;br/&gt; &lt;a href='http://www.rssowl.org' target='_parent'&gt; &lt;img src='http://sourceforge.net/sflogo.php?group_id=86683&amp;type=1' width='88' height='31' border='0' alt='SourceForge.net Logo' /&gt;&lt;/a&gt;" classpath="${root}\bin;${libs}" doctitle="Project: RSSOwl">
			<link href="http://java.sun.com/j2se/1.4.2/docs/api" />
		</javadoc>
	</target>

	<!-- 
		Release sources of RSSOwl
		
		This target is used by the RSSOwl development team to release a new Source Release.
    -->
	<target name="release_src">
		<mkdir dir="${desktop}/RSSOwl Release/src/rssowl_${version}_src" />

		<copy todir="${desktop}/RSSOwl Release/src/rssowl_${version}_src" overwrite="yes">
			<fileset dir="${source_root}">
				<include name="**/*.java" />
				<include name="**/*.gif" />
				<include name="**/*.png" />
				<include name="**/*.manifest" />
				<include name="**/*.jar" />
				<include name="**/*.template" />
				<include name="**/*.dtd" />
				<include name="**/*.ico" />
				<include name="**/*.xpm" />
				<include name="**/*.bmp" />
				<include name="**/*.txt" />
				<include name="doc/*.xml" />
				<include name="usr/*.xml" />
				<include name="**/faq.html" />
				<include name="**/epl-v10.html" />
				<include name="**/build.xml" />
				<exclude name="**/rssowl.jar" />
				<exclude name="**/swt.jar" />
				<exclude name="**/todo.txt" />
				<exclude name="**/inherit.gif" />
			</fileset>
		</copy>
		<copy todir="${desktop}/RSSOwl Release/src/rssowl_${version}_src" overwrite="yes" flatten="no">
			<fileset dir="${root}">
				<include name="doc/tutorial/**" />
			</fileset>
		</copy>
	</target>

	<!-- 
		Release both sources of RSSOwl zipped
    -->
	<target name="release" depends="release_src, zip" />

	<!-- 
		ZIP and GZip sources
    -->
	<target name="zip" depends="">
		<zip destfile="${desktop}/RSSOwl Release/rssowl_${version}_src.zip" basedir="${desktop}/RSSOwl Release/src/" />
		<tar destfile="${desktop}/RSSOwl Release/rssowl_${version}_src.tar" basedir="${desktop}/RSSOwl Release/src/" />
		<gzip zipfile="${desktop}/RSSOwl Release/rssowl_${version}_src.tar.gz" src="${desktop}/RSSOwl Release/rssowl_${version}_src.tar" />
		<delete file="${desktop}/RSSOwl Release/rssowl_${version}_src.tar" />
	</target>
</project>