blob: 4ad30e53fe9155efedbabc418459394d56ebdddf [file] [log] [blame]
David Reiss16f5cd12009-03-30 22:52:51 +00001<!--
2 Licensed to the Apache Software Foundation (ASF) under one
3 or more contributor license agreements. See the NOTICE file
4 distributed with this work for additional information
5 regarding copyright ownership. The ASF licenses this file
6 to you under the Apache License, Version 2.0 (the
7 "License"); you may not use this file except in compliance
8 with the License. You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing,
13 software distributed under the License is distributed on an
14 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 KIND, either express or implied. See the License for the
16 specific language governing permissions and limitations
17 under the License.
18-->
pwyckoff99b000b2008-04-03 19:30:55 +000019<project name="libfb303" default="dist" basedir="..">
20
21 <!-- project wide settings. All directories relative to basedir -->
22 <property name="src.dir" value="java"/>
23 <property name="if.dir" value="if"/>
24 <property name="thrift_home" value="/usr/local"/>
25
26 <!-- temp build directories -->
27 <property name="build.dir" value="${src.dir}/build"/>
28 <property name="build.classes.dir" value="${build.dir}/classes"/>
29 <property name="build.lib.dir" value="${build.dir}/lib"/>
30
31 <!-- final distribution directories -->
32 <property name="dist.dir" value="/usr/local"/>
33 <property name="dist.lib.dir" value="${dist.dir}/lib"/>
34
35 <!-- make temporary and distribution directories -->
36 <target name="prepare">
37 <mkdir dir="${build.dir}"/>
38 <mkdir dir="${build.classes.dir}"/>
39 <mkdir dir="${build.lib.dir}"/>
40 <mkdir dir="${dist.dir}"/>
41 <mkdir dir="${dist.lib.dir}"/>
42 </target>
43
44 <!-- generate fb303 thrift code -->
45 <target name="thriftbuild">
46 <echo>generating thrift fb303 files</echo>
47 <exec executable="${thrift_home}/bin/thrift" failonerror="true">
David Reisscd5284c2009-02-07 02:36:54 +000048 <arg line="--gen java -o ${src.dir} ${src.dir}/../if/fb303.thrift" />
pwyckoff99b000b2008-04-03 19:30:55 +000049 </exec>
David Reisscd5284c2009-02-07 02:36:54 +000050 <move todir="${src.dir}">
51 <fileset dir="${src.dir}/gen-java/com/facebook/fb303">
52 <include name="**/*.java"/>
53 </fileset>
54 </move>
pwyckoff99b000b2008-04-03 19:30:55 +000055 </target>
56
57 <!-- compile the base and thrift generated code and jar them -->
58 <target name="dist" depends="prepare,thriftbuild">
59 <echo>Building libfb303.jar .... </echo>
60 <javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="on">
61 <classpath>
62 <pathelement location="${thrift_home}/lib/libthrift.jar"/>
63 </classpath>
64 <include name="*.java"/>
65 <include name="${build.dir}/gen-java/com/facebook/fb303"/>
66 </javac>
67 <jar jarfile="${build.lib.dir}/libfb303.jar" basedir="${build.classes.dir}">
68 </jar>
69 </target>
70
71 <!-- copy the build jar to the distribution library directory -->
72 <target name="install" depends="dist">
73 <copy todir="${dist.lib.dir}">
74 <fileset dir="${build.lib.dir}" includes="libfb303.jar"/>
75 </copy>
76 </target>
77
78 <target name="clean">
79 <echo>Cleaning old stuff .... </echo>
80 <delete dir="${build.dir}/classes/com"/>
81 <delete dir="${build.dir}/lib"/>
82 <delete dir="${build.dir}"/>
pwyckoff99b000b2008-04-03 19:30:55 +000083 </target>
84</project>