<?xml version="1.0" encoding="UTF-8"?> <project name="java-cloudfiles" default="compile" basedir="."> <description> Builds CloudFiles Java Library and example apps. </description> <!-- =============================================================== --> <!-- Set project properties for folder locations --> <!-- =============================================================== --> <property name="project.name" value="java-cloudfiles"/> <!-- Allow overrides to the properties set here --> <property file="local.properties" /> <property name="src" location="src/main/java"/> <property name="test-src" location="src/test/java"/> <property name="test-resource" location="src/test/resources"/> <property name="lib" location="lib"/> <property name="dist" location="dist"/> <property name="classes" location="classes"/> <property name="doc-dir" location="docs" /> <property name="pkg-dir" location="cloudfiles" /> <property name="report.dir" location="testreport" /> <path id="base.path"> <pathelement location="${classes}"/> <fileset dir="${lib}"> <include name="**/*.jar"/> </fileset> </path> <!-- =============================================================== --> <!-- Create a time stamp and needed directories --> <!-- =============================================================== --> <target name="init"> <echo>-------------------------------------------------</echo> <echo> Building Cloudfiles </echo> <echo>-------------------------------------------------</echo> <!-- Create time stamp --> <tstamp/> <!-- Create the build directory structure used by compile --> <mkdir dir="${classes}"/> <mkdir dir="${dist}"/> </target> <!-- =============================================================== --> <!-- Compile the project sources --> <!-- =============================================================== --> <target name="compile" depends="init" description="Compiles source" > <echo>Compiling the source</echo> <javac destdir="${classes}" optimize="off" debug="on" source="1.5" target="1.5" failonerror="true" srcdir="${src}"> <classpath> <path refid="base.path"/> </classpath> <include name="**"/> </javac> <copy file="${src}/com/rackspacecloud/client/cloudfiles/MIME.types" todir="${classes}/com/rackspacecloud/client/cloudfiles" /> <jar jarfile="${dist}/${project.name}.jar" basedir="${classes}"/> </target> <target name="compile-test" depends="compile" description="Compiles Test Code" > <echo>Compiling the test source</echo> <javac destdir="${classes}" optimize="off" debug="on" failonerror="true" srcdir="${test-src}"> <classpath> <path refid="base.path"/> </classpath> <include name="**"/> </javac> <copy todir="${classes}"> <fileset dir="${test-resource}" /> </copy> <jar jarfile="${dist}/${project.name}-test.jar" basedir="${classes}"/> </target> <target name="test" depends="compile-test"> <junit printsummary="yes" > <classpath refid="base.path" /> <formatter type="brief" usefile="false" /> <test name="com.rackspacecloud.client.cloudfiles.FilesClientTestCase" /> </junit> </target> <target name="test-report" depends="compile-test"> <mkdir dir="${report.dir}"/> <junit> <classpath refid="base.path" /> <formatter type="xml" /> <test name="com.rackspacecloud.client.cloudfiles.FilesClientTestCase" todir="${report.dir}" /> </junit> <junitreport todir="${report.dir}"> <fileset dir="${report.dir}" includes="TEST-*.xml"/> <report todir="${report.dir}"/> </junitreport> </target> <!-- =============================================================== --> <!-- Package things up, leaving out test files --> <!-- =============================================================== --> <target name="package" description="Package files" depends="clean,compile,docs"> <delete dir="${pkg-dir}"/> <mkdir dir="${pkg-dir}" /> <mkdir dir="${pkg-dir}/lib" /> <mkdir dir="${pkg-dir}/dist" /> <copy todir="${pkg-dir}/lib" > <fileset dir="${lib}" /> </copy> <copy todir="${pkg-dir}/dist"> <fileset dir="${dist}" /> </copy> <copy todir="${pkg-dir}/docs" > <fileset dir="${doc-dir}" /> </copy> <copy file="cloudfiles.bat" todir="${pkg-dir}" /> <copy file="cloudfiles.sh" todir="${pkg-dir}" /> <copy file="cloudfiles.properties" todir="${pkg-dir}" /> <copy file="log4j.properties" todir="${pkg-dir}" /> <copy file="COPYING" todir="${pkg-dir}" /> <tar destfile="java-cloudfiles-binary.tar.gz" compression="gzip"> <tarfileset dir="${pkg-dir}" prefix="cloudfiles/" /> </tar> <!-- Source version --> <copy file="build.xml" todir="${pkg-dir}" /> <mkdir dir="${pkg-dir}/src/main/java" /> <copy todir="${pkg-dir}/src/main/java" > <fileset dir="${src}" /> </copy> <tar destfile="java-cloudfiles-source.tar.gz" compression="gzip"> <tarfileset dir="${pkg-dir}" prefix="cloudfiles/" /> </tar> </target> <!-- =============================================================== --> <!-- Create the JavaDoc HTML Files --> <!-- =============================================================== --> <target name="docs" description="Create javadocs"> <javadoc sourcepath="${src}" destdir="${doc-dir}"> <classpath> <path refid="base.path"/> </classpath> </javadoc> </target> <!-- =============================================================== --> <!-- Delete the folders we create --> <!-- =============================================================== --> <target name="clean" description="clean up"> <delete dir="${classes}"/> <delete dir="${dist}"/> <delete dir="${docdir}" /> </target> </project>