blob: 36923f9895c8d5c3204ec9421169ac79740dd05a [file] [log] [blame]
pwyckoff99b000b2008-04-03 19:30:55 +00001<project name="libfb303" default="dist" basedir="..">
2
3 <!-- project wide settings. All directories relative to basedir -->
4 <property name="src.dir" value="java"/>
5 <property name="if.dir" value="if"/>
6 <property name="thrift_home" value="/usr/local"/>
7
8 <!-- temp build directories -->
9 <property name="build.dir" value="${src.dir}/build"/>
10 <property name="build.classes.dir" value="${build.dir}/classes"/>
11 <property name="build.lib.dir" value="${build.dir}/lib"/>
12
13 <!-- final distribution directories -->
14 <property name="dist.dir" value="/usr/local"/>
15 <property name="dist.lib.dir" value="${dist.dir}/lib"/>
16
17 <!-- make temporary and distribution directories -->
18 <target name="prepare">
19 <mkdir dir="${build.dir}"/>
20 <mkdir dir="${build.classes.dir}"/>
21 <mkdir dir="${build.lib.dir}"/>
22 <mkdir dir="${dist.dir}"/>
23 <mkdir dir="${dist.lib.dir}"/>
24 </target>
25
26 <!-- generate fb303 thrift code -->
27 <target name="thriftbuild">
28 <echo>generating thrift fb303 files</echo>
29 <exec executable="${thrift_home}/bin/thrift" failonerror="true">
David Reisscd5284c2009-02-07 02:36:54 +000030 <arg line="--gen java -o ${src.dir} ${src.dir}/../if/fb303.thrift" />
pwyckoff99b000b2008-04-03 19:30:55 +000031 </exec>
David Reisscd5284c2009-02-07 02:36:54 +000032 <move todir="${src.dir}">
33 <fileset dir="${src.dir}/gen-java/com/facebook/fb303">
34 <include name="**/*.java"/>
35 </fileset>
36 </move>
pwyckoff99b000b2008-04-03 19:30:55 +000037 </target>
38
39 <!-- compile the base and thrift generated code and jar them -->
40 <target name="dist" depends="prepare,thriftbuild">
41 <echo>Building libfb303.jar .... </echo>
42 <javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="on">
43 <classpath>
44 <pathelement location="${thrift_home}/lib/libthrift.jar"/>
45 </classpath>
46 <include name="*.java"/>
47 <include name="${build.dir}/gen-java/com/facebook/fb303"/>
48 </javac>
49 <jar jarfile="${build.lib.dir}/libfb303.jar" basedir="${build.classes.dir}">
50 </jar>
51 </target>
52
53 <!-- copy the build jar to the distribution library directory -->
54 <target name="install" depends="dist">
55 <copy todir="${dist.lib.dir}">
56 <fileset dir="${build.lib.dir}" includes="libfb303.jar"/>
57 </copy>
58 </target>
59
60 <target name="clean">
61 <echo>Cleaning old stuff .... </echo>
62 <delete dir="${build.dir}/classes/com"/>
63 <delete dir="${build.dir}/lib"/>
64 <delete dir="${build.dir}"/>
pwyckoff99b000b2008-04-03 19:30:55 +000065 </target>
66</project>