| 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 | cb39f08 | 2007-04-10 02:30:30 +0000 | [diff] [blame] | 19 | <project name="tutorial" default="tutorial" basedir="."> | 
|  | 20 |  | 
| Roger Meier | fa89932 | 2012-10-22 19:27:38 +0000 | [diff] [blame] | 21 | <description>Thrift Java Tutorial</description> | 
| Mark Slee | cb39f08 | 2007-04-10 02:30:30 +0000 | [diff] [blame] | 22 |  | 
|  | 23 | <property name="src" location="src" /> | 
| Roger Meier | fa89932 | 2012-10-22 19:27:38 +0000 | [diff] [blame] | 24 | <property name="gen" location="gen-java" /> | 
| Mark Slee | cb39f08 | 2007-04-10 02:30:30 +0000 | [diff] [blame] | 25 | <property name="build" location="build" /> | 
| Todd Lipcon | 515c238 | 2010-09-27 18:26:07 +0000 | [diff] [blame] | 26 |  | 
|  | 27 | <path id="libs.classpath"> | 
| Roger Meier | 5fc6973 | 2011-04-08 21:28:50 +0000 | [diff] [blame] | 28 | <fileset dir="../../lib/java/build"> | 
|  | 29 | <include name="*.jar" /> | 
|  | 30 | <exclude name="-test.jar" /> | 
|  | 31 | </fileset> | 
|  | 32 | <fileset dir="../../lib/java/build/lib"> | 
| Todd Lipcon | 515c238 | 2010-09-27 18:26:07 +0000 | [diff] [blame] | 33 | <include name="*.jar" /> | 
|  | 34 | </fileset> | 
|  | 35 | </path> | 
|  | 36 | <path id="build.classpath"> | 
|  | 37 | <path refid="libs.classpath" /> | 
|  | 38 | <pathelement path="${gen}" /> | 
|  | 39 | </path> | 
| Roger Meier | fa89932 | 2012-10-22 19:27:38 +0000 | [diff] [blame] | 40 | <path id="tutorial.classpath"> | 
|  | 41 | <path refid="build.classpath" /> | 
|  | 42 | <pathelement path="${build}" /> | 
|  | 43 | <pathelement path="tutorial.jar" /> | 
|  | 44 | </path> | 
|  | 45 |  | 
| Mark Slee | cb39f08 | 2007-04-10 02:30:30 +0000 | [diff] [blame] | 46 | <target name="init"> | 
|  | 47 | <tstamp /> | 
|  | 48 | <mkdir dir="${build}"/> | 
| Roger Meier | fa89932 | 2012-10-22 19:27:38 +0000 | [diff] [blame] | 49 | <mkdir dir="${build}/log"/> | 
| Mark Slee | cb39f08 | 2007-04-10 02:30:30 +0000 | [diff] [blame] | 50 | </target> | 
|  | 51 |  | 
| Roger Meier | fa89932 | 2012-10-22 19:27:38 +0000 | [diff] [blame] | 52 | <target name="compile" depends="init, generate"> | 
| Todd Lipcon | 515c238 | 2010-09-27 18:26:07 +0000 | [diff] [blame] | 53 | <javac srcdir="${gen}" destdir="${build}" classpathref="libs.classpath" /> | 
|  | 54 | <javac srcdir="${src}" destdir="${build}" classpathref="build.classpath" /> | 
| Mark Slee | cb39f08 | 2007-04-10 02:30:30 +0000 | [diff] [blame] | 55 | </target> | 
|  | 56 |  | 
| Roger Meier | fa89932 | 2012-10-22 19:27:38 +0000 | [diff] [blame] | 57 | <target name="test" depends="tutorial" /> | 
|  | 58 |  | 
|  | 59 | <target name="tutorial" description="Run the tutorial" depends="compile"> | 
| Mark Slee | cb39f08 | 2007-04-10 02:30:30 +0000 | [diff] [blame] | 60 | <jar jarfile="tutorial.jar" basedir="${build}"/> | 
| Roger Meier | fa89932 | 2012-10-22 19:27:38 +0000 | [diff] [blame] | 61 | <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 Slee | cb39f08 | 2007-04-10 02:30:30 +0000 | [diff] [blame] | 105 | </target> | 
|  | 106 |  | 
|  | 107 | <target name="clean"> | 
|  | 108 | <delete dir="${build}" /> | 
| Roger Meier | 18a90d1 | 2012-10-24 18:40:06 +0000 | [diff] [blame] | 109 | <delete dir="${gen}"/> | 
| Mark Slee | cb39f08 | 2007-04-10 02:30:30 +0000 | [diff] [blame] | 110 | <delete file="tutorial.jar" /> | 
|  | 111 | </target> | 
|  | 112 |  | 
|  | 113 | </project> |