|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<project name="java-cloudfiles" default="compile" basedir="."> |
| 3 | + |
| 4 | + <description> |
| 5 | + Builds CloudFiles Java Library and example apps. |
| 6 | + </description> |
| 7 | + |
| 8 | + <!-- =============================================================== --> |
| 9 | + <!-- Set project properties for folder locations --> |
| 10 | + <!-- =============================================================== --> |
| 11 | + <property name="project.name" value="cloudfiles"/> |
| 12 | + |
| 13 | + <!-- Allow overrides to the properties set here --> |
| 14 | + <property file="local.properties" /> |
| 15 | + <property name="src" location="src/main/java"/> |
| 16 | + <property name="test-src" location="src/test/java"/> |
| 17 | + <property name="test-resource" location="src/test/resources"/> |
| 18 | + <property name="lib" location="lib"/> |
| 19 | + <property name="dist" location="dist"/> |
| 20 | + <property name="classes" location="classes"/> |
| 21 | + <property name="doc-dir" location="docs" /> |
| 22 | + <property name="pkg-dir" location="cloudfiles" /> |
| 23 | + <property name="report.dir" location="testreport" /> |
| 24 | + |
| 25 | + |
| 26 | + <path id="base.path"> |
| 27 | + <pathelement location="${classes}"/> |
| 28 | + <fileset dir="${lib}"> |
| 29 | + <include name="**/*.jar"/> |
| 30 | + </fileset> |
| 31 | + </path> |
| 32 | + |
| 33 | + <!-- =============================================================== --> |
| 34 | + <!-- Create a time stamp and needed directories --> |
| 35 | + <!-- =============================================================== --> |
| 36 | + <target name="init"> |
| 37 | + |
| 38 | + <echo>-------------------------------------------------</echo> |
| 39 | + <echo> Building Cloudfiles </echo> |
| 40 | + <echo>-------------------------------------------------</echo> |
| 41 | + |
| 42 | + <!-- Create time stamp --> |
| 43 | + <tstamp/> |
| 44 | + |
| 45 | + <!-- Create the build directory structure used by compile --> |
| 46 | + <mkdir dir="${classes}"/> |
| 47 | + <mkdir dir="${dist}"/> |
| 48 | + </target> |
| 49 | + |
| 50 | + <!-- =============================================================== --> |
| 51 | + <!-- Compile the project sources --> |
| 52 | + <!-- =============================================================== --> |
| 53 | + <target name="compile" depends="init" description="Compiles source" > |
| 54 | + |
| 55 | + <echo>Compiling the source</echo> |
| 56 | + |
| 57 | + <javac destdir="${classes}" |
| 58 | + optimize="off" |
| 59 | + debug="on" |
| 60 | + failonerror="true" |
| 61 | + srcdir="${src}"> |
| 62 | + <classpath> |
| 63 | + <path refid="base.path"/> |
| 64 | + </classpath> |
| 65 | + <include name="**"/> |
| 66 | + </javac> |
| 67 | + <copy file="${src}/com/mosso/client/cloudfiles/MIME.types" |
| 68 | + todir="${classes}/com/mosso/client/cloudfiles" /> |
| 69 | + <jar jarfile="${dist}/${project.name}.jar" basedir="${classes}"/> |
| 70 | + </target> |
| 71 | + |
| 72 | + <target name="compile-test" depends="compile" description="Compiles Test Code" > |
| 73 | + <echo>Compiling the test source</echo> |
| 74 | + <javac destdir="${classes}" |
| 75 | + optimize="off" |
| 76 | + debug="on" |
| 77 | + failonerror="true" |
| 78 | + srcdir="${test-src}"> |
| 79 | + <classpath> |
| 80 | + <path refid="base.path"/> |
| 81 | + </classpath> |
| 82 | + <include name="**"/> |
| 83 | + </javac> |
| 84 | + <copy todir="${classes}"> |
| 85 | + <fileset dir="${test-resource}" /> |
| 86 | + </copy> |
| 87 | + <jar jarfile="${dist}/${project.name}-test.jar" basedir="${classes}"/> |
| 88 | + </target> |
| 89 | + |
| 90 | + <target name="test" depends="compile-test"> |
| 91 | + <junit printsummary="yes" > |
| 92 | + <classpath refid="base.path" /> |
| 93 | + <formatter type="brief" usefile="false" /> |
| 94 | + <test name="com.mosso.client.cloudfiles.FilesClientTestCase" /> |
| 95 | + </junit> |
| 96 | + </target> |
| 97 | + |
| 98 | + <target name="test-report" depends="compile-test"> |
| 99 | + <mkdir dir="${report.dir}"/> |
| 100 | + <junit> |
| 101 | + <classpath refid="base.path" /> |
| 102 | + <formatter type="xml" /> |
| 103 | + <test name="com.mosso.client.cloudfiles.FilesClientTestCase" todir="${report.dir}" /> |
| 104 | + </junit> |
| 105 | + <junitreport todir="${report.dir}"> |
| 106 | + <fileset dir="${report.dir}" includes="TEST-*.xml"/> |
| 107 | + <report todir="${report.dir}"/> |
| 108 | + </junitreport> |
| 109 | + </target> |
| 110 | + |
| 111 | + |
| 112 | + <!-- =============================================================== --> |
| 113 | + <!-- Package things up, leaving out test files --> |
| 114 | + <!-- =============================================================== --> |
| 115 | + <target name="package" description="Package files" depends="clean,compile,docs"> |
| 116 | + <delete dir="${pkg-dir}"/> |
| 117 | + <mkdir dir="${pkg-dir}" /> |
| 118 | + <mkdir dir="${pkg-dir}/lib" /> |
| 119 | + <mkdir dir="${pkg-dir}/dist" /> |
| 120 | + |
| 121 | + <copy todir="${pkg-dir}/lib" > |
| 122 | + <fileset dir="${lib}" /> |
| 123 | + </copy> |
| 124 | + <copy todir="${pkg-dir}/dist"> |
| 125 | + <fileset dir="${dist}" /> |
| 126 | + </copy> |
| 127 | + <copy todir="${pkg-dir}/docs" > |
| 128 | + <fileset dir="${doc-dir}" /> |
| 129 | + </copy> |
| 130 | + <copy file="run_cli.sh" todir="${pkg-dir}" /> |
| 131 | + <copy file="cloudfiles.properties" todir="${pkg-dir}" /> |
| 132 | + <copy file="log4j.properties" todir="${pkg-dir}" /> |
| 133 | + <copy file="COPYING" todir="${pkg-dir}" /> |
| 134 | + |
| 135 | + <tar destfile="cloudfiles_binary.tar.gz" compression="gzip"> |
| 136 | + <tarfileset dir="${pkg-dir}" prefix="cloudfiles/" /> |
| 137 | + </tar> |
| 138 | + |
| 139 | + <!-- Source version --> |
| 140 | + <copy file="build.xml" todir="${pkg-dir}" /> |
| 141 | + <mkdir dir="${pkg-dir}/src/main/java" /> |
| 142 | + <copy todir="${pkg-dir}/src/main/java" > |
| 143 | + <fileset dir="${src}" /> |
| 144 | + </copy> |
| 145 | + <tar destfile="cloudfiles_source.tar.gz" compression="gzip"> |
| 146 | + <tarfileset dir="${pkg-dir}" prefix="cloudfiles/" /> |
| 147 | + </tar> |
| 148 | + </target> |
| 149 | + |
| 150 | + <!-- =============================================================== --> |
| 151 | + <!-- Create the JavaDoc HTML Files --> |
| 152 | + <!-- =============================================================== --> |
| 153 | + <target name="docs" description="Create javadocs"> |
| 154 | + <javadoc sourcepath="${src}" destdir="${doc-dir}"> |
| 155 | + <classpath> |
| 156 | + <path refid="base.path"/> |
| 157 | + </classpath> |
| 158 | + </javadoc> |
| 159 | + </target> |
| 160 | + |
| 161 | + |
| 162 | + <!-- =============================================================== --> |
| 163 | + <!-- Delete the folders we create --> |
| 164 | + <!-- =============================================================== --> |
| 165 | + <target name="clean" description="clean up"> |
| 166 | + |
| 167 | + <delete dir="${classes}"/> |
| 168 | + <delete dir="${dist}"/> |
| 169 | + <delete dir="${docdir}" /> |
| 170 | + |
| 171 | + </target> |
| 172 | + |
| 173 | + |
| 174 | +</project> |
0 commit comments