Rev 1519 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
<?xml version="1.0"?>
<!--
File: build.xml
Copyright (C) 2006 Steve Ratcliffe
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Author: Steve Ratcliffe
Create date: 26 Nov 2006
-->
<project name="mkgmap" default="dist" basedir=".">
<!-- Init -->
<property name="top" value="."/>
<property file="${top}/external.properties"/>
<property name="build" value="build"/>
<property name="dist" value="dist"/>
<property name="build.classes" value="${build}/classes"/>
<property name="build.test" value="${build}/test"/>
<property name="src" value="src"/>
<property name="test" value="test"/>
<property name="doc" value="doc"/>
<property name="javadoc" value="${doc}/api"/>
<property name="resources" value="resources"/>
<property name="jars" value="/opt/jars"/>
<property name="junit.jar" value="${jars}/junit-4.5/junit-4.5.jar"/>
<!-- A place to keep a local copy of the test input data. The test files
are large and so are not kept in svn. If you don't set this then they
will be downloaded.
You can set it in the external.properties file too.
-->
<property name="test.input.cache" value="/opt/data/testinput"/>
<!-- For class paths -->
<path id="main">
<pathelement location="${build.classes}" />
</path>
<path id="test">
<pathelement location="test/resources"/>
<pathelement location="build/test"/>
<pathelement location="${junit.jar}"/>
<path refid="main"/>
<pathelement location="test"/>
</path>
<!-- Prepare - make all the directories -->
<target name="prepare">
<mkdir dir="${build.classes}" />
</target>
<!-- Compile the product itself (no tests). -->
<target name="compile" depends="prepare" description="main compilation">
<javac srcdir="${src}" destdir="${build.classes}" target="1.5" debug="true">
<include name="**/*.java" />
<classpath refid="main"/>
<!-- <compilerarg value="-Xlint:unchecked"/> -->
<exclude name="**/reader/dem/optional/*.java"/>
</javac>
</target>
<!-- Build into the build direcotory. All resource files are copied in. -->
<target name="build" depends="compile" >
<copy todir="${build.classes}">
<fileset dir="${resources}">
<include name="*.csv"/>
<include name="*.properties"/>
<include name="*.xml"/>
<include name="**/*.trans"/>
<include name="styles/**"/>
<include name="help/**"/>
<exclude name="**/.*"/>
</fileset>
<fileset dir="src">
<include name="**/*.properties"/>
</fileset>
</copy>
</target>
<!-- Compile the test classes -->
<target name="build-test" depends="build">
<mkdir dir="${build.test}" />
<javac srcdir="${test}" destdir="${build.test}" target="1.5" debug="true">
<include name="**/*.java" />
<classpath refid="test"/>
</javac>
</target>
<target name="test" depends="build-test" description="Run the junit tests">
<mkdir dir="tmp/report"/>
<junit printsummary="yes">
<formatter type="plain"/>
<classpath refid="test"/>
<assertions>
<enable/>
</assertions>
<batchtest fork="yes" todir="tmp/report">
<fileset dir="test">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="obtain-test-input-files" description="download the input files for the functional tests">
<!-- Local cache, if it doesn't exist then it is not a problem the files
will be downloaded in the next step -->
<copy todir="test/resources/in" failonerror="false">
<fileset dir="${test.input.cache}" includes="**"/>
</copy>
<mkdir dir="test/resources/in/osm"/>
<mkdir dir="test/resources/in/mp"/>
<mkdir dir="test/resources/in/img"/>
<get src="http://www.mkgmap.org.uk/testinput/osm/lon1.osm.gz"
dest="test/resources/in/osm/lon1.osm.gz" usetimestamp="true"
ignoreerrors="true"/>
<get src="http://www.mkgmap.org.uk/testinput/osm/uk-test-1.osm.gz"
dest="test/resources/in/osm/uk-test-1.osm.gz" usetimestamp="true"
ignoreerrors="true"/>
<get src="http://www.mkgmap.org.uk/testinput/osm/uk-test-2.osm.gz"
dest="test/resources/in/osm/uk-test-2.osm.gz" usetimestamp="true"
ignoreerrors="true"/>
<get src="http://www.mkgmap.org.uk/testinput/mp/test1.mp"
dest="test/resources/in/mp/test1.mp" usetimestamp="true"
ignoreerrors="true"/>
<get src="http://www.mkgmap.org.uk/testinput/img/63240001.img"
dest="test/resources/in/img/63240001.img" usetimestamp="true"
ignoreerrors="true"/>
<get src="http://www.mkgmap.org.uk/testinput/img/63240002.img"
dest="test/resources/in/img/63240002.img" usetimestamp="true"
ignoreerrors="true"/>
</target>
<target name="dist" depends="build"
description="Make the distribution area">
<mkdir dir="${dist}"/>
<mkdir dir="${dist}/doc/api"/>
<!-- Make the jar -->
<jar basedir="${build.classes}" jarfile="${dist}/mkgmap.jar"
manifest="${resources}/MANIFEST.MF">
<include name="**/*.class"/>
<include name="*.csv"/>
<include name="*.xml"/>
<include name="*.properties"/>
<include name="**/*.trans"/>
<include name="styles/**"/>
<include name="help/**"/>
</jar>
<copy todir="${dist}/doc" >
<fileset dir="doc" includes="*.txt, Credits, mkgmap.1"/>
</copy>
<!-- misc -->
<copy todir="${dist}" >
<fileset dir="${basedir}">
<include name="README"/>
<include name="LICENCE*"/>
<include name="build.xml"/>
<include name="external.properties"/>
<include name="resources/**"/>
</fileset>
</copy>
</target>
<target name="javadoc" description="Create the javadoc">
<mkdir dir="doc"/>
<javadoc destdir="${javadoc}">
<fileset dir="${src}" includes="**/*.java"/>
<classpath refid="main"/>
</javadoc>
</target>
<!-- Clean everything -->
<target name="clean">
<delete dir="${build}" />
<delete dir="tmp"/>
</target>
<!-- Clobber all generated and built files -->
<target name="clobber" depends="clean">
<delete dir="${dist}" />
</target>
<target name="rebuild" depends="clean, build" />
</project>