build.xml 6.34 KB
<!-- $Id: build.xml 138 2013-09-10 10:02:43Z wyldfire $ -->
<!-- Copyright (C) 2007 Ryan McDonald -->
<project default="compile" basedir=".">

	<!-- =================================================================== -->
	<!-- Initialization target                                               -->
	<!-- =================================================================== -->
	<target name="init">
		<tstamp/>
		<property name="Name" value="MSTParser"/>
		<property name="name" value="mstparser"/>
		<property name="year" value="2013"/>
		<property name="version" value="0.5.1"/>

		<echo message="----------- ${Name} ${version} [${year}] ------------"/>

		<property name="debug" value="on"/>
		<property name="optimize" value="off"/>
		<property name="deprecation" value="on"/>

		<property name="src.dir" value="./src/main/java"/>
		<property name="lib.dir" value="./lib"/>
		<property name="packages" value="mstparser.*"/>

		<property name="build.dir" value="./output"/>
		<property name="build.dest" value="./output/classes"/>
		<property name="build.javadocs" value="./docs/api"/>

		<filter token="year" value="${year}"/>
		<filter token="version" value="${version}"/>
		<filter token="date" value="${TODAY}"/>
		<filter token="log" value="true"/>
		<filter token="verbose" value="true"/>

		<path id="build.classpath">
			<fileset dir="${lib.dir}/">
				<include name="*.jar"/>
			</fileset>
		</path>
	</target>


	<!-- =================================================================== -->
	<!-- Help on usage                                                       -->
	<!-- =================================================================== -->
	<target name="usage">
		<echo message=""/>
		<echo message=""/>
		<echo message="MST Parser build file"/>
		<echo message="-------------------------------------------------------------"/>
		<echo message=""/>
		<echo message=" Available targets are:"/>
		<echo message=""/>
		<echo message="   package  --> generates the mstparser.jar file"/>
		<echo message="   compile  --> compiles the source code  (default)"/>
		<echo message="   javadoc  --> generates the API documentation"/>
		<echo message="   clean    --> cleans up the compilation directory"/>
		<echo message=""/>
		<echo message=" See the comments inside the build.xml file for more details."/>
		<echo message="-------------------------------------------------------------"/>
		<echo message=""/>
		<echo message=""/>
	</target>


	<!-- =================================================================== -->
	<!-- Prepares the build directories                                      -->
	<!-- =================================================================== -->
	<target name="prepare" depends="init">
		<!-- create directories -->
		<mkdir dir="${build.dir}"/>
		<mkdir dir="${build.dest}"/>
	</target>


	<!-- =================================================================== -->
	<!-- Compiles the source directory                                       -->
	<!-- =================================================================== -->
	<target name="compile" 
          depends="prepare"
          description="compiles the source code  (default)">
		<javac srcdir="${src.dir}"
           destdir="${build.dest}"
           debug="${debug}"
           deprecation="${deprecation}"
           classpathref="build.classpath"
           optimize="${optimize}">
			<!--	   <compilerarg line="-Xlint:unchecked"/> -->
		</javac>
	</target>


	<!-- =================================================================== -->
	<!-- Creates the class package                                           -->
	<!-- =================================================================== -->
	<target name="package" 
          depends="compile"
          description="generates the mstparser.jar file">
		<jar jarfile="${build.dir}/${name}.jar">
			<fileset dir="${build.dest}" includes="**"/>
		</jar>
	</target>


	<!-- =================================================================== -->
	<!-- Creates the release file                                           -->
	<!-- =================================================================== -->
	<target name="release" depends="clean,cleandocs">
		<tar tarfile="${name}-${version}-src.tar"
          basedir="../"
          includes="${name}/**"
          excludes="**/CVS **/*forest testbed/my*" />
		<gzip src="${name}-${version}-src.tar" 
          zipfile="../${name}-${version}-src.tgz" />
		<delete file="${name}-${version}-src.tar" />
	</target>

	<!-- =================================================================== -->
	<!-- Creates the homepage                                                -->
	<!-- =================================================================== -->
	<target name="homepage" 
          depends="init,javadoc"
          description="generates the API documentation">
		<tar tarfile="${name}-homepage.tar"
         basedir="./docs/"
         includes="**"
         excludes="**/CVS" />
		<gzip src="${name}-homepage.tar"
          zipfile="${build.dir}/${name}-homepage.tgz" />
		<delete file="${name}-homepage.tar" />
	</target>


	<!-- =================================================================== -->
	<!-- Creates the API documentation                                       -->
	<!-- =================================================================== -->
	<target name="javadoc" depends="prepare">
		<mkdir dir="${build.javadocs}"/>
		<javadoc packagenames="${packages}"
             sourcepath="${src.dir}"
             destdir="${build.javadocs}"
             author="true"
             version="true"
             use="true"
             splitindex="true"
             noindex="false"
             windowtitle="${name}"
             doctitle="The ${Name} API v${version}"
             bottom="Copyright &#169; ${year} Ryan McDonald and Jason Baldridge. All Rights Reserved."
    />
	</target>


	<!-- =================================================================== -->
	<!-- Cleans targets                                                      -->
	<!-- =================================================================== -->
	<target name="clean" 
          depends="init"
          description="cleans up the directory">
		<delete dir="${build.dir}"/>
		<delete file="${lib.dir}/${name}.jar" />
	</target>

	<target name="cleandocs" depends="init" description="cleans up the API docs directory">
		<delete dir="${build.javadocs}"/>
	</target>

</project>

<!-- End of file -->