build.xml
author Markus Bröker <mbroeker@largo.homelinux.org>
Wed, 13 May 2009 14:08:44 +0200
changeset 9 506c7ab82d39
parent 8 34a247829246
child 16 55b0d5006e7b
permissions -rw-r--r--
ant build file improved this will be the default build file for all my java projects

<?xml version="1.0"?>
<project name="Schach" basedir="." default="jar">
	<property name="project" value="Schach" />
	<property name="package.name" value="org.homelinux.largo" />
	<property name="package.dir" value="org/homelinux/largo" />
	<property name="jar.file" value="bin/games.jar" />
	<property name="classpath.dir" value="/usr/local/lib/classes" />
	<property name="www.dir" value="/var/www/localhost/htdocs/classes" />
	<property name="manifest" value="${project}.manifest" />
	<property name="docs.dir" value="doc/" />
	<property name="debug" value="simu" />

	<property name="distributable.exts"
		value="**/*.class,**/*.gif,**/*.html,**/*.jar,**/*.jnlp,**/*.jpg,**/*.png" />
	<path id="classpath">
		<pathelement location="." />
	</path>

	<!-- Targets -->
	<target name="clean">
		<echo
			message="deleting all class- and jar-files  in ${package.dir} tree" />
		<delete>
			<fileset dir="${package.dir}" includes="**/*.class" />
			<fileset dir="." includes="**/*.*~" defaultexcludes="no" />
		</delete>

		<delete file="${jar.file}" />
	</target>

	<target name="docs"
	    depends="compile,docs-init"
    	description="Generate JavaDocs.">

	    <javadoc destdir="${docs.dir}"
    	    author="true"
        	version="true"
	        use="true"
    	    windowtitle="${ant.project.name}"
            sourcepathref="classpath"
	    packagenames="org.*"
    	    verbose="false">
        	<doctitle><![CDATA[<h1>${ant.project.name}</h1>]]></doctitle>
	        <bottom>
    	        <![CDATA[<i>Developed by Largo Enterprises in 2008</i>]]>
        	</bottom>
	    </javadoc>
	</target>

	<target name="docs-init">
	    <mkdir dir="${docs.dir}"/>
	</target>

	<target name="docs-clean">
    	<delete dir="${docs.dir}"/>
	</target>

	<target name="compile">
		<echo message="compiling ${package.dir} tree." />
		<javac source="1.5" target="1.5" srcdir="${package.dir}"
			sourcepath="${basedir}" debug="on">
			<classpath refid="classpath" />
		</javac>
	</target>

	<target name="jar" depends="compile">
		<property environment="env" />
		<jar destfile="${jar.file}" basedir="${basedir}"
			includes="org/ images/"
			manifest="${manifest}" />
	</target>

	<target name="post" depends="jar">
		<signjar jar="${jar.file}" alias="spectre" storepass="${env.jsp}" />
		<copy file="${jar.file}" todir="${www.dir}"/>
	</target>

	<target name="debug" depends="compile">
		<java classname="${package.name}.schach.Schach"
			failonerror="true" fork="yes">
			<classpath refid="classpath" />
			<arg line="${debug}" />
		</java>
	</target>

	<target name="checkers" depends="compile">
		<java classname="${package.name}.checkers.Checkers"
			failonerror="true" fork="yes">
			<classpath refid="classpath" />
			<arg line="${debug}" />
		</java>
	</target>
</project>