blob: 05cf9cd4e06a8146b188c3887fd3393dca22ba90 [file] [log] [blame]
David Reissea2cba82009-03-30 21:35:00 +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-->
Mark Slee83c52a82006-06-07 06:51:18 +000019<project name="libthrift" default="dist" basedir=".">
20
21 <description>Thrift Build File</description>
22
Bryan Duxbury249d7cb2009-01-29 01:21:20 +000023 <property name="gen" location="gen-java" />
24 <property name="genbean" location="gen-javabean" />
25
Mark Slee83c52a82006-06-07 06:51:18 +000026 <property name="src" location="src" />
27 <property name="build" location="build" />
Bryan Duxbury32e04b42009-03-20 16:43:06 +000028 <property name="javadoc" location="${build}/javadoc" />
David Reissf0c21a72008-07-11 01:26:16 +000029 <property name="install.path" value="/usr/local/lib" />
Bryan Duxbury249d7cb2009-01-29 01:21:20 +000030 <property name="src.test" location="test" />
31 <property name="build.test" location="${build}/test" />
Bryan Duxbury249d7cb2009-01-29 01:21:20 +000032 <property name="test.thrift.home" location="../../test"/>
33
34 <property file="${user.home}/.thrift-build.properties" />
Bryan Duxbury538e3442009-02-10 04:49:39 +000035
Bryan Duxbury249d7cb2009-01-29 01:21:20 +000036 <property name="cpath" location="libthrift.jar:${thrift.extra.cpath}" />
Bryan Duxbury538e3442009-02-10 04:49:39 +000037
Mark Slee83c52a82006-06-07 06:51:18 +000038 <target name="init">
39 <tstamp />
40 <mkdir dir="${build}"/>
Bryan Duxbury249d7cb2009-01-29 01:21:20 +000041 <mkdir dir="${build.test}" />
Mark Slee83c52a82006-06-07 06:51:18 +000042 </target>
43
44 <target name="compile" depends="init">
Bryan Duxbury538e3442009-02-10 04:49:39 +000045 <javac srcdir="${src}" destdir="${build}" source="1.5" debug="true"/>
Mark Slee83c52a82006-06-07 06:51:18 +000046 </target>
47
Bryan Duxbury32e04b42009-03-20 16:43:06 +000048 <target name="javadoc" depends="init">
49 <javadoc sourcepath="${src}"
50 destdir="${javadoc}"
51 version="true"
52 windowtitle="Thrift Java API"
53 doctitle="Thrift Java API">
54 </javadoc>
Mark Slee83c52a82006-06-07 06:51:18 +000055 </target>
56
Bryan Duxbury32e04b42009-03-20 16:43:06 +000057 <target name="dist" depends="compile">
58 <jar jarfile="libthrift.jar">
59 <fileset dir="${build}">
60 <include name="**/*.class" />
61 </fileset>
62 <fileset dir="src">
63 <include name="**/*.java" />
64 </fileset>
65 </jar>
66 </target>
67
68 <target name="install" depends="dist,javadoc">
Mark Slee54b7ab92007-03-06 00:06:27 +000069 <exec executable="install">
David Reissf0c21a72008-07-11 01:26:16 +000070 <arg line="libthrift.jar ${install.path}" />
Mark Slee83c52a82006-06-07 06:51:18 +000071 </exec>
Bryan Duxbury32e04b42009-03-20 16:43:06 +000072 <copy todir="${install.javadoc.path}">
73 <fileset dir="${javadoc}">
74 <include name="**/*" />
75 </fileset>
76 </copy>
Mark Slee83c52a82006-06-07 06:51:18 +000077 </target>
78
79 <target name="clean">
80 <delete dir="${build}" />
Bryan Duxbury249d7cb2009-01-29 01:21:20 +000081 <delete dir="${gen}"/>
82 <delete dir="${genbean}"/>
Bryan Duxbury32e04b42009-03-20 16:43:06 +000083 <delete dir="${javadoc}"/>
Mark Slee83c52a82006-06-07 06:51:18 +000084 <delete file="libthrift.jar" />
85 </target>
86
Bryan Duxbury249d7cb2009-01-29 01:21:20 +000087 <target name="compile-test" description="Build the test suite classes" depends="generate,dist">
88 <javac debug="true" srcdir="${gen}" destdir="${build.test}" classpath="${cpath}" />
89 <javac debug="true" srcdir="${genbean}" destdir="${build.test}" classpath="${cpath}" />
90 <javac debug="true" srcdir="${src.test}" destdir="${build.test}" classpath="${cpath}:${gen}" />
91 </target>
92
93 <target name="test" description="Run the full test suite" depends="compile-test">
94 <java classname="org.apache.thrift.test.JSONProtoTest"
95 classpath="${cpath}:${build.test}" failonerror="true" />
Bryan Duxbury538e3442009-02-10 04:49:39 +000096 <java classname="org.apache.thrift.test.TCompactProtocolTest"
97 classpath="${cpath}:${build.test}" failonerror="true" />
Bryan Duxbury249d7cb2009-01-29 01:21:20 +000098 <java classname="org.apache.thrift.test.IdentityTest"
99 classpath="${cpath}:${build.test}" failonerror="true" />
100 <java classname="org.apache.thrift.test.EqualityTest"
101 classpath="${cpath}:${build.test}" failonerror="true" />
102 <java classname="org.apache.thrift.test.ToStringTest"
103 classpath="${cpath}:${build.test}" failonerror="true" />
104 <java classname="org.apache.thrift.test.DeepCopyTest"
105 classpath="${cpath}:${build.test}" failonerror="true" />
Bryan Duxbury986d7052009-01-29 01:51:08 +0000106 <java classname="org.apache.thrift.test.MetaDataTest"
107 classpath="${cpath}:${build.test}" failonerror="true" />
Bryan Duxbury249d7cb2009-01-29 01:21:20 +0000108 <java classname="org.apache.thrift.test.JavaBeansTest"
109 classpath="${cpath}:${build.test}" failonerror="true" />
110 </target>
111
112 <target name="generate">
113 <exec executable="../../compiler/cpp/thrift">
114 <arg line="--gen java:hashcode ${test.thrift.home}/ThriftTest.thrift" />
115 </exec>
116 <exec executable="../../compiler/cpp/thrift">
117 <arg line="--gen java:hashcode ${test.thrift.home}/DebugProtoTest.thrift" />
118 </exec>
119 <exec executable="../../compiler/cpp/thrift">
120 <arg line="--gen java:hashcode ${test.thrift.home}/OptionalRequiredTest.thrift" />
121 </exec>
122 <exec executable="../../compiler/cpp/thrift">
123 <arg line="--gen java:beans,nocamel ${test.thrift.home}/JavaBeansTest.thrift" />
124 </exec>
125 </target>
126
Mark Slee83c52a82006-06-07 06:51:18 +0000127</project>