Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
154 lines (134 sloc) 5.75 KB
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="./ant2html.xsl"?>
<!-- ======================================================================
DateParser
An ANTLR parser for interpreting natural language date strings.
by Ethan Blackwelder
====================================================================== -->
<project name="DateParser" default="prepare">
<description>
DateParser:
An ANTLR parser for interpreting natural language date strings.
(You're currently reading the Ant script for creating distribution packages.)
Copyright (c) 2010 Ethan Blackwelder. All Rights Reserved.
</description>
<tstamp>
<format property="timestamp" pattern="dd-MM-yyyy hh:mm aa"/>
</tstamp>
<property file="build.properties"/>
<path id="classpath.compile">
<pathelement location="${dist.home}/${jar.name}"/>
<fileset dir="${dist.home}" includes="*.jar"/>
</path>
<path id="classpath.run">
<fileset dir="${dist.home}" includes="*.jar"/>
</path>
<target name="generate-lexer" description="Generates a lexer and parser from an ANTLR grammar.">
<java classname="${antlr.main-class}" classpath="${libs.home}${file.separator}${antlr.jar}">
<arg value="-verbose"/>
<arg value="-o"/>
<arg value="${src.home}${file.separator}${grammar.package-dir}"/>
<arg value="-make"/> <!-- Only re-generate if the grammar changes. -->
<arg value="${src.home}${file.separator}${grammar.package-dir}${file.separator}${grammar.file}"/>
</java>
</target>
<target name="prepare" depends="generate-lexer" description="Makes target directories, copy non-Java resources, etc.">
<mkdir dir="${build.home}" />
<mkdir dir="${dist.home}" />
<copy todir="${dist.home}">
<fileset dir="${libs.home}" includes="*.jar"/>
</copy>
<antcall target="-copy-resources">
<param name="resources.srcdir" value="${src.home}"/>
<param name="resources.destdir" value="${build.home}"/>
</antcall>
<antcall target="-copy-resources">
<param name="resources.srcdir" value="${demos.home}"/>
<param name="resources.destdir" value="${build.home}"/>
</antcall>
<antcall target="-copy-resources">
<param name="resources.srcdir" value="${tools.home}"/>
<param name="resources.destdir" value="${build.home}"/>
</antcall>
</target>
<target name="clean" description="Clean-up time">
<delete dir="${build.home}" verbose="${verbose.mode}"/>
<delete dir="${dist.home}" verbose="${verbose.mode}"/>
</target>
<target name="-copy-resources" description="Copies image resources to a specific build directory.">
<fail message="Please set the 'resources.srcdir' parameter." unless="resources.srcdir"/>
<fail message="Please set the 'resources.destdir' parameter." unless="resources.destdir"/>
<copy todir="${resources.destdir}" includeemptydirs="no">
<fileset dir="${resources.srcdir}">
<exclude name="**/.svn"/>
<exclude name="**/*.java"/>
<exclude name="**/Thumbs.db"/>
</fileset>
</copy>
</target>
<target name="compile-full" depends="prepare" description="Compiles the all Java source files (including demos and tools).">
<javac destdir="${build.home}" target="${jar.target}" includeantruntime="no">
<src path="${src.home}"/>
<src path="${demos.home}"/>
<src path="${tools.home}"/>
<classpath>
<!-- pathelement location="${dist.home}/${jar.name.core}"/-->
<fileset dir="${libs.home}" includes="*.jar"/>
</classpath>
</javac>
</target>
<target name="jar-full" depends="compile-full" description="Creates a min JAR of the application">
<jar destfile="${dist.home}${file.separator}${jar.name}">
<manifest>
<attribute name="Created-By" value="${app.author}"/>
<attribute name="Built-By" value="${user.name} - ${ant.version}"/>
<attribute name="Implementation-Title" value="${app.name}"/>
<attribute name="Implementation-Version" value="${app.version} (${timestamp})"/>
<attribute name="Implementation-URL" value="${app.website}"/>
<attribute name="Main-Class" value="${jar.main-class}"/>
<attribute name="Class-Path" value="${antlr.jar}"/>
</manifest>
<fileset dir="${build.home}">
<include name="**/*"/>
</fileset>
</jar>
</target>
<target name="zip-src" depends="prepare" description="Creates a ZIP of the source code">
<property name="base-prefix" value="${app.name}-${app.version}"/>
<zip destfile="${dist.home}${file.separator}${zip.name.src}">
<zipfileset dir="${basedir}" prefix="${base-prefix}">
<include name="build.xml"/>
<include name="ant2html.xsl"/>
<include name="License.txt"/>
</zipfileset>
<zipfileset dir="${src.home}" prefix="${base-prefix}/src">
<exclude name="**/.svn"/>
<exclude name="**/Thumbs.db"/>
</zipfileset>
<zipfileset dir="${demos.home}" prefix="${base-prefix}/demos">
<exclude name="**/.svn"/>
<exclude name="**/Thumbs.db"/>
</zipfileset>
<zipfileset dir="${tools.home}" prefix="${base-prefix}/tools">
<exclude name="**/.svn"/>
</zipfileset>
<zipfileset dir="${libs.home}" prefix="${base-prefix}/lib">
<exclude name="**/.svn"/>
</zipfileset>
</zip>
</target>
<target name="dist" depends="jar-full,zip-src" description="Creates a distribution of all packages">
<echo message="Your distribution packages are here: ${dist.home}"/>
</target>
<target name="redist" depends="clean,dist" description="Creates a fresh distribution of all packages">
</target>
<target name="run-demo" depends="jar-full" description="Compiles and runs the GUI application.">
<java fork="true" classname="${run.main-class}">
<classpath>
<fileset dir="${dist.home}">
<include name="*.jar"/>
</fileset>
</classpath>
</java>
</target>
</project>