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--> 19<project name="tutorial" default="tutorial" basedir="."> 20 21 <description>Thrift Java Tutorial</description> 22 23 <property name="src" location="src" /> 24 <property name="gen" location="gen-java" /> 25 <property name="build" location="build" /> 26 27 <path id="libs.classpath"> 28 <fileset dir="../../lib/java/build/libs"> 29 <include name="libthrift*.jar" /> 30 <exclude name="libthrift*test.jar" /> 31 <exclude name="libthrift*javadoc.jar" /> 32 <exclude name="libthrift*sources.jar" /> 33 </fileset> 34 <fileset dir="../../lib/java/build/deps"> 35 <include name="*.jar" /> 36 </fileset> 37 </path> 38 <path id="build.classpath"> 39 <path refid="libs.classpath" /> 40 <pathelement path="${gen}" /> 41 </path> 42 <path id="tutorial.classpath"> 43 <path refid="build.classpath" /> 44 <pathelement path="${build}" /> 45 <pathelement path="tutorial.jar" /> 46 </path> 47 48 <target name="init"> 49 <tstamp /> 50 <mkdir dir="${build}"/> 51 <mkdir dir="${build}/log"/> 52 </target> 53 54 <target name="compile" depends="init, generate"> 55 <javac compiler="modern" includeantruntime="false" srcdir="${gen}" destdir="${build}" classpathref="libs.classpath" /> 56 <javac compiler="modern" includeantruntime="false" srcdir="${src}" destdir="${build}" classpathref="build.classpath" /> 57 </target> 58 59 <target name="test" depends="tutorial" /> 60 61 <target name="tutorial" description="Run the tutorial" depends="compile"> 62 <jar jarfile="tutorial.jar" basedir="${build}"/> 63 <parallel> 64 <java classname="JavaServer" fork="true" timeout="10000" 65 classpathref="tutorial.classpath" failonerror="false" output="${build}/log/tutorial.log"> 66 </java> 67 <sequential> 68 <sleep seconds="2"/> 69 <echo>tutorial client simple:</echo> 70 <java classname="JavaClient" 71 classpathref="tutorial.classpath" failonerror="true"> 72 <arg line="simple"/> 73 </java> 74 <echo>tutorial client secure:</echo> 75 <java classname="JavaClient" 76 classpathref="tutorial.classpath" failonerror="true"> 77 <arg line="secure"/> 78 </java> 79 </sequential> 80 </parallel> 81 </target> 82 83 <target name="generate"> 84 <!-- Generate the thrift gen-java source --> 85 <exec executable="../../compiler/cpp/thrift" failonerror="true"> 86 <arg line="--gen java -r ../tutorial.thrift"/> 87 </exec> 88 </target> 89 90 <target name="tutorialclient" description="Run a tutorial client" depends="compile"> 91 <echo>tutorial client simple:</echo> 92 <java classname="JavaClient" 93 classpathref="tutorial.classpath" failonerror="true"> 94 <arg line="simple"/> 95 </java> 96 <echo>tutorial client secure:</echo> 97 <java classname="JavaClient" 98 classpathref="tutorial.classpath" failonerror="true"> 99 <arg line="secure"/> 100 </java> 101 </target> 102 103 <target name="tutorialserver" description="Run a tutorial server" depends="compile"> 104 <java classname="JavaServer" fork="true" 105 classpathref="tutorial.classpath" failonerror="false" output="${build}/log/tutorial.log"> 106 </java> 107 </target> 108 109 <target name="clean"> 110 <delete dir="${build}" /> 111 <delete dir="${gen}"/> 112 <delete file="tutorial.jar" /> 113 </target> 114 115</project> 116