David Reiss | 16f5cd1 | 2009-03-30 22:52:51 +0000 | [diff] [blame] | 1 | <!-- |
| 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 | --> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 19 | <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"/> |
Todd Lipcon | 6193478 | 2010-09-21 18:01:43 +0000 | [diff] [blame^] | 24 | <property name="thrift_compiler" value="../../compiler/cpp/thrift" /> |
| 25 | <property name="thrift_lib" value="../../lib/java/libthrift.jar" /> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 26 | |
| 27 | <!-- temp build directories --> |
| 28 | <property name="build.dir" value="${src.dir}/build"/> |
| 29 | <property name="build.classes.dir" value="${build.dir}/classes"/> |
| 30 | <property name="build.lib.dir" value="${build.dir}/lib"/> |
| 31 | |
| 32 | <!-- final distribution directories --> |
| 33 | <property name="dist.dir" value="/usr/local"/> |
| 34 | <property name="dist.lib.dir" value="${dist.dir}/lib"/> |
| 35 | |
| 36 | <!-- make temporary and distribution directories --> |
| 37 | <target name="prepare"> |
| 38 | <mkdir dir="${build.dir}"/> |
| 39 | <mkdir dir="${build.classes.dir}"/> |
| 40 | <mkdir dir="${build.lib.dir}"/> |
| 41 | <mkdir dir="${dist.dir}"/> |
| 42 | <mkdir dir="${dist.lib.dir}"/> |
| 43 | </target> |
| 44 | |
| 45 | <!-- generate fb303 thrift code --> |
| 46 | <target name="thriftbuild"> |
| 47 | <echo>generating thrift fb303 files</echo> |
Todd Lipcon | 6193478 | 2010-09-21 18:01:43 +0000 | [diff] [blame^] | 48 | <exec executable="${thrift_compiler}" failonerror="true"> |
David Reiss | cd5284c | 2009-02-07 02:36:54 +0000 | [diff] [blame] | 49 | <arg line="--gen java -o ${src.dir} ${src.dir}/../if/fb303.thrift" /> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 50 | </exec> |
David Reiss | cd5284c | 2009-02-07 02:36:54 +0000 | [diff] [blame] | 51 | <move todir="${src.dir}"> |
| 52 | <fileset dir="${src.dir}/gen-java/com/facebook/fb303"> |
| 53 | <include name="**/*.java"/> |
| 54 | </fileset> |
| 55 | </move> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 56 | </target> |
| 57 | |
| 58 | <!-- compile the base and thrift generated code and jar them --> |
| 59 | <target name="dist" depends="prepare,thriftbuild"> |
| 60 | <echo>Building libfb303.jar .... </echo> |
| 61 | <javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="on"> |
| 62 | <classpath> |
Todd Lipcon | 6193478 | 2010-09-21 18:01:43 +0000 | [diff] [blame^] | 63 | <pathelement location="${thrift_lib}"/> |
| 64 | <fileset dir="../../lib/java/build/ivy/lib"> |
| 65 | <include name="*.jar" /> |
| 66 | </fileset> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 67 | </classpath> |
| 68 | <include name="*.java"/> |
| 69 | <include name="${build.dir}/gen-java/com/facebook/fb303"/> |
| 70 | </javac> |
| 71 | <jar jarfile="${build.lib.dir}/libfb303.jar" basedir="${build.classes.dir}"> |
| 72 | </jar> |
| 73 | </target> |
| 74 | |
| 75 | <!-- copy the build jar to the distribution library directory --> |
| 76 | <target name="install" depends="dist"> |
| 77 | <copy todir="${dist.lib.dir}"> |
| 78 | <fileset dir="${build.lib.dir}" includes="libfb303.jar"/> |
| 79 | </copy> |
| 80 | </target> |
| 81 | |
| 82 | <target name="clean"> |
| 83 | <echo>Cleaning old stuff .... </echo> |
| 84 | <delete dir="${build.dir}/classes/com"/> |
| 85 | <delete dir="${build.dir}/lib"/> |
| 86 | <delete dir="${build.dir}"/> |
pwyckoff | 99b000b | 2008-04-03 19:30:55 +0000 | [diff] [blame] | 87 | </target> |
| 88 | </project> |