blob: af4af07dc81e9fffef618567f6927ef386f6899c [file] [log] [blame]
Mark Slee83c52a82006-06-07 06:51:18 +00001<project name="libthrift" default="dist" basedir=".">
2
3 <description>Thrift Build File</description>
4
Bryan Duxbury249d7cb2009-01-29 01:21:20 +00005 <property name="gen" location="gen-java" />
6 <property name="genbean" location="gen-javabean" />
7
Mark Slee83c52a82006-06-07 06:51:18 +00008 <property name="src" location="src" />
9 <property name="build" location="build" />
Bryan Duxbury32e04b42009-03-20 16:43:06 +000010 <property name="javadoc" location="${build}/javadoc" />
David Reissf0c21a72008-07-11 01:26:16 +000011 <property name="install.path" value="/usr/local/lib" />
Bryan Duxbury249d7cb2009-01-29 01:21:20 +000012 <property name="src.test" location="test" />
13 <property name="build.test" location="${build}/test" />
Bryan Duxbury249d7cb2009-01-29 01:21:20 +000014 <property name="test.thrift.home" location="../../test"/>
15
16 <property file="${user.home}/.thrift-build.properties" />
Bryan Duxbury538e3442009-02-10 04:49:39 +000017
Bryan Duxbury249d7cb2009-01-29 01:21:20 +000018 <property name="cpath" location="libthrift.jar:${thrift.extra.cpath}" />
Bryan Duxbury538e3442009-02-10 04:49:39 +000019
Mark Slee83c52a82006-06-07 06:51:18 +000020 <target name="init">
21 <tstamp />
22 <mkdir dir="${build}"/>
Bryan Duxbury249d7cb2009-01-29 01:21:20 +000023 <mkdir dir="${build.test}" />
Mark Slee83c52a82006-06-07 06:51:18 +000024 </target>
25
26 <target name="compile" depends="init">
Bryan Duxbury538e3442009-02-10 04:49:39 +000027 <javac srcdir="${src}" destdir="${build}" source="1.5" debug="true"/>
Mark Slee83c52a82006-06-07 06:51:18 +000028 </target>
29
Bryan Duxbury32e04b42009-03-20 16:43:06 +000030 <target name="javadoc" depends="init">
31 <javadoc sourcepath="${src}"
32 destdir="${javadoc}"
33 version="true"
34 windowtitle="Thrift Java API"
35 doctitle="Thrift Java API">
36 </javadoc>
Mark Slee83c52a82006-06-07 06:51:18 +000037 </target>
38
Bryan Duxbury32e04b42009-03-20 16:43:06 +000039 <target name="dist" depends="compile">
40 <jar jarfile="libthrift.jar">
41 <fileset dir="${build}">
42 <include name="**/*.class" />
43 </fileset>
44 <fileset dir="src">
45 <include name="**/*.java" />
46 </fileset>
47 </jar>
48 </target>
49
50 <target name="install" depends="dist,javadoc">
Mark Slee54b7ab92007-03-06 00:06:27 +000051 <exec executable="install">
David Reissf0c21a72008-07-11 01:26:16 +000052 <arg line="libthrift.jar ${install.path}" />
Mark Slee83c52a82006-06-07 06:51:18 +000053 </exec>
Bryan Duxbury32e04b42009-03-20 16:43:06 +000054 <copy todir="${install.javadoc.path}">
55 <fileset dir="${javadoc}">
56 <include name="**/*" />
57 </fileset>
58 </copy>
Mark Slee83c52a82006-06-07 06:51:18 +000059 </target>
60
61 <target name="clean">
62 <delete dir="${build}" />
Bryan Duxbury249d7cb2009-01-29 01:21:20 +000063 <delete dir="${gen}"/>
64 <delete dir="${genbean}"/>
Bryan Duxbury32e04b42009-03-20 16:43:06 +000065 <delete dir="${javadoc}"/>
Mark Slee83c52a82006-06-07 06:51:18 +000066 <delete file="libthrift.jar" />
67 </target>
68
Bryan Duxbury249d7cb2009-01-29 01:21:20 +000069 <target name="compile-test" description="Build the test suite classes" depends="generate,dist">
70 <javac debug="true" srcdir="${gen}" destdir="${build.test}" classpath="${cpath}" />
71 <javac debug="true" srcdir="${genbean}" destdir="${build.test}" classpath="${cpath}" />
72 <javac debug="true" srcdir="${src.test}" destdir="${build.test}" classpath="${cpath}:${gen}" />
73 </target>
74
75 <target name="test" description="Run the full test suite" depends="compile-test">
76 <java classname="org.apache.thrift.test.JSONProtoTest"
77 classpath="${cpath}:${build.test}" failonerror="true" />
Bryan Duxbury538e3442009-02-10 04:49:39 +000078 <java classname="org.apache.thrift.test.TCompactProtocolTest"
79 classpath="${cpath}:${build.test}" failonerror="true" />
Bryan Duxbury249d7cb2009-01-29 01:21:20 +000080 <java classname="org.apache.thrift.test.IdentityTest"
81 classpath="${cpath}:${build.test}" failonerror="true" />
82 <java classname="org.apache.thrift.test.EqualityTest"
83 classpath="${cpath}:${build.test}" failonerror="true" />
84 <java classname="org.apache.thrift.test.ToStringTest"
85 classpath="${cpath}:${build.test}" failonerror="true" />
86 <java classname="org.apache.thrift.test.DeepCopyTest"
87 classpath="${cpath}:${build.test}" failonerror="true" />
Bryan Duxbury986d7052009-01-29 01:51:08 +000088 <java classname="org.apache.thrift.test.MetaDataTest"
89 classpath="${cpath}:${build.test}" failonerror="true" />
Bryan Duxbury249d7cb2009-01-29 01:21:20 +000090 <java classname="org.apache.thrift.test.JavaBeansTest"
91 classpath="${cpath}:${build.test}" failonerror="true" />
92 </target>
93
94 <target name="generate">
95 <exec executable="../../compiler/cpp/thrift">
96 <arg line="--gen java:hashcode ${test.thrift.home}/ThriftTest.thrift" />
97 </exec>
98 <exec executable="../../compiler/cpp/thrift">
99 <arg line="--gen java:hashcode ${test.thrift.home}/DebugProtoTest.thrift" />
100 </exec>
101 <exec executable="../../compiler/cpp/thrift">
102 <arg line="--gen java:hashcode ${test.thrift.home}/OptionalRequiredTest.thrift" />
103 </exec>
104 <exec executable="../../compiler/cpp/thrift">
105 <arg line="--gen java:beans,nocamel ${test.thrift.home}/JavaBeansTest.thrift" />
106 </exec>
107 </target>
108
Mark Slee83c52a82006-06-07 06:51:18 +0000109</project>