Source

bolts / build.xml

<?xml version="1.0" encoding="utf-8"?>

<project name="bolts" basedir="." default="dist" xmlns:ivy="antlib:org.apache.ivy.ant">
    <property name="jar.suffix" value=""/>
    
    <property name="ivy.version" value="2.1.0"/>
    <available property="ivy.available" file="ivy/ivy-${ivy.version}.jar"/>
    <target name="download-ivy" unless="ivy.available">
        <mkdir dir="ivy"/>

        <echo>Downloading ivy</echo>

        <get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar"
                dest="ivy/ivy-${ivy.version}.jar"/>
    </target>

    <target name="resolve" depends="download-ivy">
        <taskdef resource="org/apache/ivy/ant/antlib.xml"
                uri="antlib:org.apache.ivy.ant">
            <classpath>
                <fileset dir="ivy" includes="*.jar"/>
            </classpath>
        </taskdef>

        <ivy:retrieve conf="*" pattern="lib/[type]s/[organisation]-[artifact]-[revision].[ext]" sync="true"/>
    </target>
   
    
    <target name="clean" description="cleanup compiled and generated classes">
        <delete dir="target" quiet="true"/>
    </target>

    <target name="compile" depends="resolve">
        <mkdir dir="target/classes"/>
        <javac source="1.6" target="1.6" srcdir="src/main/java" destdir="target/classes" debug="true">
            <classpath>
                <fileset dir="lib" includes="*.jar"/>
                <fileset dir="lib/jars" includes="*.jar"/>
                <fileset dir="lib/bundles" includes="*.jar"/>
            </classpath>
        </javac>
    </target>
    
    <target name="javadoc">
        <delete dir="target/javadoc"/>
        <javadoc destdir="target/javadoc"
            doctitle="Bolts API"
            >
            <fileset dir="src/main/java">
                <include name="**/*.java"/>
                <exclude name="**/*Test.java"/>
                <exclude name="**/*TestSupport.java"/>
                <exclude name="**/test/**"/>
                <exclude name="**/example/**"/>
            </fileset>
            <classpath>
                <fileset dir="lib" includes="*.jar"/>
                <fileset dir="lib/jars" includes="*.jar"/>
                <fileset dir="lib/bundles" includes="*.jar"/>
            </classpath>
            <link href="http://download.java.net/jdk7/docs/api/"/>
            <link href="http://functionaljava.googlecode.com/svn/artifacts/2.20/javadoc/"/>
            <link href="http://commons.apache.org/collections/apidocs/"/>
            <link href="http://jedi.codehaus.org/javadoc/"/>
        </javadoc>
    </target>
    
    <target name="jar" depends="compile">
        <mkdir dir="target"/>
        <delete>
            <fileset dir="target" includes="bolts*.jar"/>
        </delete>
        <jar destfile="target/bolts${jar.suffix}.jar">
            <fileset dir="target/classes"/>
        </jar>
    	<jar destfile="target/bolts${jar.suffix}-sources.jar">
            <fileset dir="src/main/java"/>
        </jar>
    </target>

    <target name="build" depends="jar" />
    
    <target name="dist" depends="clean,jar"/>

    <target name="test" depends="clean,compile">
        <junit printsummary="yes" fork="yes" failureproperty="test.failure">
            <jvmarg value="-Dfile.encoding=UTF-8"/>
            <classpath>
                <fileset dir="lib" includes="**/*.jar"/>
                <pathelement location="target/classes"/>
                <pathelement location="src/test/log4j"/>
            </classpath>

            <batchtest todir="${basedir}" >
                <fileset dir="target/classes">
                    <include name="**/*Test.class"/>
                </fileset>
                <formatter type="plain" usefile="no"/>
            </batchtest>
        </junit>

        <fail message="Tests failed" if="test.failure"/>
    </target>

</project>
<!-- vim: set ts=4 sw=4 et: -->