blob: eceeca702af0c77ea2304e6592dc865b827abafb [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 Sleecb39f082007-04-10 02:30:30 +000019<project name="tutorial" default="tutorial" basedir=".">
20
Roger Meierfa899322012-10-22 19:27:38 +000021 <description>Thrift Java Tutorial</description>
Mark Sleecb39f082007-04-10 02:30:30 +000022
23 <property name="src" location="src" />
Roger Meierfa899322012-10-22 19:27:38 +000024 <property name="gen" location="gen-java" />
Mark Sleecb39f082007-04-10 02:30:30 +000025 <property name="build" location="build" />
Todd Lipcon515c2382010-09-27 18:26:07 +000026
27 <path id="libs.classpath">
Roger Meier5fc69732011-04-08 21:28:50 +000028 <fileset dir="../../lib/java/build">
29 <include name="*.jar" />
30 <exclude name="-test.jar" />
31 </fileset>
32 <fileset dir="../../lib/java/build/lib">
Todd Lipcon515c2382010-09-27 18:26:07 +000033 <include name="*.jar" />
34 </fileset>
35 </path>
36 <path id="build.classpath">
37 <path refid="libs.classpath" />
38 <pathelement path="${gen}" />
39 </path>
Roger Meierfa899322012-10-22 19:27:38 +000040 <path id="tutorial.classpath">
41 <path refid="build.classpath" />
42 <pathelement path="${build}" />
43 <pathelement path="tutorial.jar" />
44 </path>
45
Mark Sleecb39f082007-04-10 02:30:30 +000046 <target name="init">
47 <tstamp />
48 <mkdir dir="${build}"/>
Roger Meierfa899322012-10-22 19:27:38 +000049 <mkdir dir="${build}/log"/>
Mark Sleecb39f082007-04-10 02:30:30 +000050 </target>
51
Roger Meierfa899322012-10-22 19:27:38 +000052 <target name="compile" depends="init, generate">
Todd Lipcon515c2382010-09-27 18:26:07 +000053 <javac srcdir="${gen}" destdir="${build}" classpathref="libs.classpath" />
54 <javac srcdir="${src}" destdir="${build}" classpathref="build.classpath" />
Mark Sleecb39f082007-04-10 02:30:30 +000055 </target>
56
Roger Meierfa899322012-10-22 19:27:38 +000057 <target name="test" depends="tutorial" />
58
59 <target name="tutorial" description="Run the tutorial" depends="compile">
Mark Sleecb39f082007-04-10 02:30:30 +000060 <jar jarfile="tutorial.jar" basedir="${build}"/>
Roger Meierfa899322012-10-22 19:27:38 +000061 <parallel>
62 <java classname="JavaServer" fork="true" timeout="10000"
63 classpathref="tutorial.classpath" failonerror="false" output="${build}/log/tutorial.log">
64 </java>
65 <sequential>
66 <sleep seconds="2"/>
67 <echo>tutorial client simple:</echo>
68 <java classname="JavaClient"
69 classpathref="tutorial.classpath" failonerror="true">
70 <arg line="simple"/>
71 </java>
72 <echo>tutorial client secure:</echo>
73 <java classname="JavaClient"
74 classpathref="tutorial.classpath" failonerror="true">
75 <arg line="secure"/>
76 </java>
77 </sequential>
78 </parallel>
79 </target>
80
81 <target name="generate">
82 <!-- Generate the thrift gen-java source -->
83 <exec executable="../../compiler/cpp/thrift" failonerror="true">
84 <arg line="--gen java -r ../tutorial.thrift"/>
85 </exec>
86 </target>
87
88 <target name="tutorialclient" description="Run a tutorial client" depends="compile">
89 <echo>tutorial client simple:</echo>
90 <java classname="JavaClient"
91 classpathref="tutorial.classpath" failonerror="true">
92 <arg line="simple"/>
93 </java>
94 <echo>tutorial client secure:</echo>
95 <java classname="JavaClient"
96 classpathref="tutorial.classpath" failonerror="true">
97 <arg line="secure"/>
98 </java>
99 </target>
100
101 <target name="tutorialserver" description="Run a tutorial server" depends="compile">
102 <java classname="JavaServer" fork="true"
103 classpathref="tutorial.classpath" failonerror="false" output="${build}/log/tutorial.log">
104 </java>
Mark Sleecb39f082007-04-10 02:30:30 +0000105 </target>
106
107 <target name="clean">
108 <delete dir="${build}" />
Roger Meier18a90d12012-10-24 18:40:06 +0000109 <delete dir="${gen}"/>
Mark Sleecb39f082007-04-10 02:30:30 +0000110 <delete file="tutorial.jar" />
111 </target>
112
113</project>