rrenkert@25: <?xml version="1.0"?>
rrenkert@25: <!DOCTYPE project[
rrenkert@25:   <!ENTITY properties SYSTEM "properties.xml">
rrenkert@25: ]>
raimund@256: <!--
raimund@256: /*
raimund@256:  * Copyright (c) 2011 by Intevation GmbH, Germany <info@intevation.de>
raimund@256:  * 
raimund@256:  * This file is part of MXD2map.
raimund@256:  *
raimund@256:  * This program is free software under the LGPL (>=v2.1)
raimund@256:  * Read the file LICENCE.txt coming with the software for details
raimund@256:  * or visit http://www.gnu.org/licenses/ if it does not exist.
raimund@256:  *
raimund@256:  * MXD2map has been developed on behalf of the
raimund@256:  * Bundesamt fuer Seeschifffahrt und Hydrographie (BSH) in Hamburg
raimund@256:  * by Intevation GmbH.
raimund@256:  *
raimund@256:  * Authors:
raimund@256:  * Raimund Renkert <raimund.renkert@intevation.de>
raimund@256:  * Bjoern Schilberg <bjoern.schilberg@intevation.de>
raimund@256:  * Stephan Holl <stephan.holl@intevation.de>
raimund@256: */
raimund@256: -->
raimund@256: 
rrenkert@25: <!-- :mode=ant -->
rrenkert@25: 
rrenkert@25: <project name="MXD-Konverter" default="all" basedir=".">
rrenkert@25:   <!-- import external XML fragments -->
rrenkert@25:   &properties;
rrenkert@25:   <!-- import sample properties -->
rrenkert@25:   <!-- TODO: edit sample.properties file before importing -->
rrenkert@25:   <property file="sample.properties"/>
rrenkert@25:   <path id="compile.classpath">
rrenkert@25:     <pathelement location="${arcobjects.jar}"/>
rrenkert@25:     <fileset dir="${libs.dir}">
rrenkert@25:       <include name="**/*.jar"/>
rrenkert@25:     </fileset>
rrenkert@25:   </path>
rrenkert@25:   <path id="run.classpath">
rrenkert@25:     <path refid="compile.classpath"/>
rrenkert@25:     <pathelement location="${class.dir}"/>
rrenkert@25:     <pathelement location="${src.dir}"/>
rrenkert@25:   </path>
rrenkert@25: 
rrenkert@25:   <!-- ========================================= -->
rrenkert@25:   <!-- private targets -->
rrenkert@25:   <!-- ========================================= -->
raimund@178:   <target name="revision">
raimund@178:     <property name="current" value="parent"/>
raimund@178:     <exec executable="hg" outputproperty="hash">
raimund@178: 	    <arg line="${current} --template '{node|short}'"/>
raimund@178:     </exec>
raimund@178:   </target>
raimund@178: 
raimund@193:   <target name="init">
rrenkert@25:     <!-- create the time stamp -->
rrenkert@25:     <tstamp/>
rrenkert@25:     <!-- create the build directory structure used by compile -->
rrenkert@25:     <mkdir dir="${build.dir}"/>
rrenkert@25:     <mkdir dir="${class.dir}"/>
rrenkert@25:   </target>
rrenkert@25: 
rrenkert@25:   <target name="validate-runtime" depends="init">
rrenkert@25:     <condition property="runtimeAvailable">
rrenkert@25:       <isset property="runtime.home"/>
rrenkert@25:     </condition>
rrenkert@25:     <fail message="No runtime installed. You need to install ArcGIS Engine, Desktop or Server to run this sample." unless="runtimeAvailable"/>
rrenkert@25:   </target>
rrenkert@25: 
rrenkert@25:   <target name="compile" depends="validate-runtime">
rrenkert@25:   <!-- javac resolver needed to run inside of Websphere Studio -->
rrenkert@25:     <available classname="org.eclipse.core.launcher.Main" property="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter" classpath="${java.class.path}" />
rrenkert@25:     <!-- compile the java code from ${src.dir} into ${class.dir} -->
rrenkert@25:     <javac srcdir="${src.dir}" destdir="${class.dir}" debug="on">
rrenkert@25:       <classpath refid="compile.classpath"/>
rrenkert@25:     </javac>
rrenkert@25:     <copy todir="${class.dir}">
rrenkert@25:       <fileset dir="${src.dir}" includes="**/icons/*" />
rrenkert@25:     </copy>
rrenkert@25:   </target>
rrenkert@25: 
raimund@193:   <target name="jar" depends="compile,revision">
rrenkert@25:     <mkdir dir="${dist.dir}" />
raimund@178:     <jar jarfile="${dist.dir}/mxd2map-${hash}.jar" compress="true" basedir="${class.dir}">
rrenkert@25:       <manifest>
rrenkert@55:         <attribute name="Main-Class" value="de.intevation.mxd.Converter"/>
aheinecke@326: 	<attribute name="Class-Path" value="lib/log4j.jar lib/mapscript.jar lib/arcobjects.jar lib/jargs.jar lib/commons-codec.jar"/>
rrenkert@55:       </manifest>
rrenkert@25:     </jar>
rrenkert@25:   </target>
rrenkert@25: 
raimund@193:   <target name="jar-norevision" depends="compile">
raimund@193:     <mkdir dir="${dist.dir}" />
raimund@193:     <jar jarfile="${dist.dir}/mxd2map.jar" compress="true" basedir="${class.dir}">
raimund@193:       <manifest>
raimund@193:         <attribute name="Main-Class" value="de.intevation.mxd.Converter"/>
aheinecke@340: 	<attribute name="Class-Path" value="lib/log4j.jar lib/mapscript.jar lib/arcobjects.jar lib/jargs.jar lib/commons-codec.jar"/>
raimund@193:       </manifest>
raimund@193:     </jar>
raimund@193:   </target>
raimund@193: 
rrenkert@25:   <target name="usage">
rrenkert@25:     <echo message="Execute 'ant -projecthelp' for the build file help"/>
rrenkert@25:     <echo message="Execute 'ant -help' for Ant help"/>
rrenkert@25:   </target>
rrenkert@25: 
rrenkert@25:   <target name="execute" depends="compile">
rrenkert@35:     <java classname="de.intevation.mxd.Converter" failonerror="true" fork="true">
rrenkert@25:       <jvmarg value="-Xss2m"/>
rrenkert@25:       <classpath refid="run.classpath"/>
rrenkert@28:       <sysproperty key="mxd.file" value="${MXDFILE}"/>
rrenkert@25:     </java>
rrenkert@25:   </target>
rrenkert@25: 
rrenkert@25:   <!-- ========================================= -->
rrenkert@25:   <!-- public targets -->
rrenkert@25:   <!-- ========================================= -->
rrenkert@25: 
rrenkert@25:   <target name="all" depends="compile" description="build everything">
rrenkert@25:     <echo message="application built"/>
rrenkert@25:   </target>
rrenkert@25: 
rrenkert@25:   <target name="clean" description="clean all build products">
rrenkert@25:     <!-- delete the ${build} directory trees -->
rrenkert@25:     <delete dir="${build.dir}"/>
rrenkert@25:     <echo message="build directory gone!"/>
rrenkert@25:   </target>
rrenkert@25: 
raimund@260:   <target name="doc" description="Create javadoc.">
raimund@260:     <javadoc packagenames="de.intevation.mxd.*"
raimund@260: 	     sourcepath="${src.dir}"
raimund@260:              defaultexcludes="yes"
raimund@260: 	     destdir="${doc.dir}/javadoc"
raimund@260:              author="true"
raimund@260:              version="true"
raimund@260: 	     windowtitle="MXD2map">
raimund@260:       <fileset dir="${src.dir}">
raimund@260:         <include name="**/*.java" />
raimund@260:       </fileset>	   
raimund@260:       <doctitle><![CDATA[<h1>MXD2map</h1>]]></doctitle>
raimund@260:       <bottom><![CDATA[<i>Copyright &#169; 2011 Intevation GmbH. All Rights Reserved.</i>]]></bottom>
raimund@260:       <group title="Reader" packages="de.intevation.mxd.reader.*"/>
raimund@260:       <group title="Writer" packages="de.intevation.mxd.writer.*"/>
raimund@260:       <group title="Utilities" packages="de.intevation.mxd.utils.*"/>
raimund@260:     </javadoc>
raimund@260:   </target>
raimund@260: 
rrenkert@25:   <target name="help" depends="usage" description="usage" />
rrenkert@25:   <target name="dist" depends="jar" description="create distributable products" />
rrenkert@25:   <target name="run-sample" depends="execute" description="execute the sample with args set in sample.properties"/>
rrenkert@25: </project>