Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 1 | <project name="libthrift" default="dist" basedir="."> |
| 2 | |
| 3 | <description>Thrift Build File</description> |
| 4 | |
Bryan Duxbury | 249d7cb | 2009-01-29 01:21:20 +0000 | [diff] [blame] | 5 | <property name="gen" location="gen-java" /> |
| 6 | <property name="genbean" location="gen-javabean" /> |
| 7 | |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 8 | <property name="src" location="src" /> |
| 9 | <property name="build" location="build" /> |
Bryan Duxbury | 32e04b4 | 2009-03-20 16:43:06 +0000 | [diff] [blame] | 10 | <property name="javadoc" location="${build}/javadoc" /> |
David Reiss | f0c21a7 | 2008-07-11 01:26:16 +0000 | [diff] [blame] | 11 | <property name="install.path" value="/usr/local/lib" /> |
Bryan Duxbury | 249d7cb | 2009-01-29 01:21:20 +0000 | [diff] [blame] | 12 | <property name="src.test" location="test" /> |
| 13 | <property name="build.test" location="${build}/test" /> |
Bryan Duxbury | 249d7cb | 2009-01-29 01:21:20 +0000 | [diff] [blame] | 14 | <property name="test.thrift.home" location="../../test"/> |
| 15 | |
| 16 | <property file="${user.home}/.thrift-build.properties" /> |
Bryan Duxbury | 538e344 | 2009-02-10 04:49:39 +0000 | [diff] [blame] | 17 | |
Bryan Duxbury | 249d7cb | 2009-01-29 01:21:20 +0000 | [diff] [blame] | 18 | <property name="cpath" location="libthrift.jar:${thrift.extra.cpath}" /> |
Bryan Duxbury | 538e344 | 2009-02-10 04:49:39 +0000 | [diff] [blame] | 19 | |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 20 | <target name="init"> |
| 21 | <tstamp /> |
| 22 | <mkdir dir="${build}"/> |
Bryan Duxbury | 249d7cb | 2009-01-29 01:21:20 +0000 | [diff] [blame] | 23 | <mkdir dir="${build.test}" /> |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 24 | </target> |
| 25 | |
| 26 | <target name="compile" depends="init"> |
Bryan Duxbury | 538e344 | 2009-02-10 04:49:39 +0000 | [diff] [blame] | 27 | <javac srcdir="${src}" destdir="${build}" source="1.5" debug="true"/> |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 28 | </target> |
| 29 | |
Bryan Duxbury | 32e04b4 | 2009-03-20 16:43:06 +0000 | [diff] [blame] | 30 | <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 Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 37 | </target> |
| 38 | |
Bryan Duxbury | 32e04b4 | 2009-03-20 16:43:06 +0000 | [diff] [blame] | 39 | <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 Slee | 54b7ab9 | 2007-03-06 00:06:27 +0000 | [diff] [blame] | 51 | <exec executable="install"> |
David Reiss | f0c21a7 | 2008-07-11 01:26:16 +0000 | [diff] [blame] | 52 | <arg line="libthrift.jar ${install.path}" /> |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 53 | </exec> |
Bryan Duxbury | 32e04b4 | 2009-03-20 16:43:06 +0000 | [diff] [blame] | 54 | <copy todir="${install.javadoc.path}"> |
| 55 | <fileset dir="${javadoc}"> |
| 56 | <include name="**/*" /> |
| 57 | </fileset> |
| 58 | </copy> |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 59 | </target> |
| 60 | |
| 61 | <target name="clean"> |
| 62 | <delete dir="${build}" /> |
Bryan Duxbury | 249d7cb | 2009-01-29 01:21:20 +0000 | [diff] [blame] | 63 | <delete dir="${gen}"/> |
| 64 | <delete dir="${genbean}"/> |
Bryan Duxbury | 32e04b4 | 2009-03-20 16:43:06 +0000 | [diff] [blame] | 65 | <delete dir="${javadoc}"/> |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 66 | <delete file="libthrift.jar" /> |
| 67 | </target> |
| 68 | |
Bryan Duxbury | 249d7cb | 2009-01-29 01:21:20 +0000 | [diff] [blame] | 69 | <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 Duxbury | 538e344 | 2009-02-10 04:49:39 +0000 | [diff] [blame] | 78 | <java classname="org.apache.thrift.test.TCompactProtocolTest" |
| 79 | classpath="${cpath}:${build.test}" failonerror="true" /> |
Bryan Duxbury | 249d7cb | 2009-01-29 01:21:20 +0000 | [diff] [blame] | 80 | <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 Duxbury | 986d705 | 2009-01-29 01:51:08 +0000 | [diff] [blame] | 88 | <java classname="org.apache.thrift.test.MetaDataTest" |
| 89 | classpath="${cpath}:${build.test}" failonerror="true" /> |
Bryan Duxbury | 249d7cb | 2009-01-29 01:21:20 +0000 | [diff] [blame] | 90 | <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 Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 109 | </project> |