add fb303 to thrift contrib
Summary: Add clean version of fb303 to thrift contrib readying for open sourcing scribe
Reviewed By: dreiss
Test Plan: bootstrap.sh, make, make install on a fresh machine and then try compiling and running scribe open source version.
Revert: OK
TracCamp Project: Thrift
DiffCamp Revision: 10841
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665634 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/contrib/fb303/java/build.xml b/contrib/fb303/java/build.xml
new file mode 100755
index 0000000..1b61e0a
--- /dev/null
+++ b/contrib/fb303/java/build.xml
@@ -0,0 +1,62 @@
+<project name="libfb303" default="dist" basedir="..">
+
+ <!-- project wide settings. All directories relative to basedir -->
+ <property name="src.dir" value="java"/>
+ <property name="if.dir" value="if"/>
+ <property name="thrift_home" value="/usr/local"/>
+
+ <!-- temp build directories -->
+ <property name="build.dir" value="${src.dir}/build"/>
+ <property name="build.classes.dir" value="${build.dir}/classes"/>
+ <property name="build.lib.dir" value="${build.dir}/lib"/>
+
+ <!-- final distribution directories -->
+ <property name="dist.dir" value="/usr/local"/>
+ <property name="dist.lib.dir" value="${dist.dir}/lib"/>
+
+ <!-- make temporary and distribution directories -->
+ <target name="prepare">
+ <mkdir dir="${build.dir}"/>
+ <mkdir dir="${build.classes.dir}"/>
+ <mkdir dir="${build.lib.dir}"/>
+ <mkdir dir="${dist.dir}"/>
+ <mkdir dir="${dist.lib.dir}"/>
+ </target>
+
+ <!-- generate fb303 thrift code -->
+ <target name="thriftbuild">
+ <echo>generating thrift fb303 files</echo>
+ <exec executable="${thrift_home}/bin/thrift" failonerror="true">
+ <arg line="--gen java -I ${thrift_home}/share/ -o ${build.dir} ${src.dir}/../if/fb303.thrift" />
+ </exec>
+ </target>
+
+ <!-- compile the base and thrift generated code and jar them -->
+ <target name="dist" depends="prepare,thriftbuild">
+ <echo>Building libfb303.jar .... </echo>
+ <javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="on">
+ <classpath>
+ <pathelement location="${thrift_home}/lib/libthrift.jar"/>
+ </classpath>
+ <include name="*.java"/>
+ <include name="${build.dir}/gen-java/com/facebook/fb303"/>
+ </javac>
+ <jar jarfile="${build.lib.dir}/libfb303.jar" basedir="${build.classes.dir}">
+ </jar>
+ </target>
+
+ <!-- copy the build jar to the distribution library directory -->
+ <target name="install" depends="dist">
+ <copy todir="${dist.lib.dir}">
+ <fileset dir="${build.lib.dir}" includes="libfb303.jar"/>
+ </copy>
+ </target>
+
+ <target name="clean">
+ <echo>Cleaning old stuff .... </echo>
+ <delete dir="${build.dir}/classes/com"/>
+ <delete dir="${build.dir}/lib"/>
+ <delete dir="${build.dir}"/>
+ <delete dir="${dist.dir}"/>
+ </target>
+</project>