David Reiss | ea2cba8 | 2009-03-30 21:35:00 +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 | --> |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 19 | <project name="libthrift" default="dist" basedir="."> |
| 20 | |
| 21 | <description>Thrift Build File</description> |
| 22 | |
Bryan Duxbury | 249d7cb | 2009-01-29 01:21:20 +0000 | [diff] [blame] | 23 | <property name="gen" location="gen-java" /> |
| 24 | <property name="genbean" location="gen-javabean" /> |
| 25 | |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 26 | <property name="src" location="src" /> |
| 27 | <property name="build" location="build" /> |
Bryan Duxbury | 32e04b4 | 2009-03-20 16:43:06 +0000 | [diff] [blame] | 28 | <property name="javadoc" location="${build}/javadoc" /> |
David Reiss | f0c21a7 | 2008-07-11 01:26:16 +0000 | [diff] [blame] | 29 | <property name="install.path" value="/usr/local/lib" /> |
Bryan Duxbury | 249d7cb | 2009-01-29 01:21:20 +0000 | [diff] [blame] | 30 | <property name="src.test" location="test" /> |
| 31 | <property name="build.test" location="${build}/test" /> |
Bryan Duxbury | 249d7cb | 2009-01-29 01:21:20 +0000 | [diff] [blame] | 32 | <property name="test.thrift.home" location="../../test"/> |
| 33 | |
| 34 | <property file="${user.home}/.thrift-build.properties" /> |
Bryan Duxbury | 538e344 | 2009-02-10 04:49:39 +0000 | [diff] [blame] | 35 | |
Bryan Duxbury | 249d7cb | 2009-01-29 01:21:20 +0000 | [diff] [blame] | 36 | <property name="cpath" location="libthrift.jar:${thrift.extra.cpath}" /> |
Bryan Duxbury | 538e344 | 2009-02-10 04:49:39 +0000 | [diff] [blame] | 37 | |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 38 | <target name="init"> |
| 39 | <tstamp /> |
| 40 | <mkdir dir="${build}"/> |
Bryan Duxbury | 249d7cb | 2009-01-29 01:21:20 +0000 | [diff] [blame] | 41 | <mkdir dir="${build.test}" /> |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 42 | </target> |
| 43 | |
| 44 | <target name="compile" depends="init"> |
Bryan Duxbury | 538e344 | 2009-02-10 04:49:39 +0000 | [diff] [blame] | 45 | <javac srcdir="${src}" destdir="${build}" source="1.5" debug="true"/> |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 46 | </target> |
| 47 | |
Bryan Duxbury | 32e04b4 | 2009-03-20 16:43:06 +0000 | [diff] [blame] | 48 | <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 Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 55 | </target> |
| 56 | |
Bryan Duxbury | 32e04b4 | 2009-03-20 16:43:06 +0000 | [diff] [blame] | 57 | <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 Slee | 54b7ab9 | 2007-03-06 00:06:27 +0000 | [diff] [blame] | 69 | <exec executable="install"> |
David Reiss | f0c21a7 | 2008-07-11 01:26:16 +0000 | [diff] [blame] | 70 | <arg line="libthrift.jar ${install.path}" /> |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 71 | </exec> |
Bryan Duxbury | 32e04b4 | 2009-03-20 16:43:06 +0000 | [diff] [blame] | 72 | <copy todir="${install.javadoc.path}"> |
| 73 | <fileset dir="${javadoc}"> |
| 74 | <include name="**/*" /> |
| 75 | </fileset> |
| 76 | </copy> |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 77 | </target> |
| 78 | |
| 79 | <target name="clean"> |
| 80 | <delete dir="${build}" /> |
Bryan Duxbury | 249d7cb | 2009-01-29 01:21:20 +0000 | [diff] [blame] | 81 | <delete dir="${gen}"/> |
| 82 | <delete dir="${genbean}"/> |
Bryan Duxbury | 32e04b4 | 2009-03-20 16:43:06 +0000 | [diff] [blame] | 83 | <delete dir="${javadoc}"/> |
Mark Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 84 | <delete file="libthrift.jar" /> |
| 85 | </target> |
| 86 | |
Bryan Duxbury | 249d7cb | 2009-01-29 01:21:20 +0000 | [diff] [blame] | 87 | <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 Duxbury | 538e344 | 2009-02-10 04:49:39 +0000 | [diff] [blame] | 96 | <java classname="org.apache.thrift.test.TCompactProtocolTest" |
| 97 | classpath="${cpath}:${build.test}" failonerror="true" /> |
Bryan Duxbury | 249d7cb | 2009-01-29 01:21:20 +0000 | [diff] [blame] | 98 | <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 Duxbury | 986d705 | 2009-01-29 01:51:08 +0000 | [diff] [blame] | 106 | <java classname="org.apache.thrift.test.MetaDataTest" |
| 107 | classpath="${cpath}:${build.test}" failonerror="true" /> |
Bryan Duxbury | 249d7cb | 2009-01-29 01:21:20 +0000 | [diff] [blame] | 108 | <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 Slee | 83c52a8 | 2006-06-07 06:51:18 +0000 | [diff] [blame] | 127 | </project> |