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"> |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 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" /> |
Roger Meier | 5fc6973 | 2011-04-08 21:28:50 +0000 | [diff] [blame] | 33 | </fileset> |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 34 | <fileset dir="../../lib/java/build/deps"> |
Todd Lipcon | 515c238 | 2010-09-27 18:26:07 +0000 | [diff] [blame] | 35 | <include name="*.jar" /> |
| 36 | </fileset> |
| 37 | </path> |
| 38 | <path id="build.classpath"> |
| 39 | <path refid="libs.classpath" /> |
| 40 | <pathelement path="${gen}" /> |
| 41 | </path> |
Roger Meier | fa89932 | 2012-10-22 19:27:38 +0000 | [diff] [blame] | 42 | <path id="tutorial.classpath"> |
| 43 | <path refid="build.classpath" /> |
| 44 | <pathelement path="${build}" /> |
| 45 | <pathelement path="tutorial.jar" /> |
| 46 | </path> |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 47 | |
Mark Slee | cb39f08 | 2007-04-10 02:30:30 +0000 | [diff] [blame] | 48 | <target name="init"> |
| 49 | <tstamp /> |
| 50 | <mkdir dir="${build}"/> |
Roger Meier | fa89932 | 2012-10-22 19:27:38 +0000 | [diff] [blame] | 51 | <mkdir dir="${build}/log"/> |
Mark Slee | cb39f08 | 2007-04-10 02:30:30 +0000 | [diff] [blame] | 52 | </target> |
| 53 | |
Roger Meier | fa89932 | 2012-10-22 19:27:38 +0000 | [diff] [blame] | 54 | <target name="compile" depends="init, generate"> |
James E. King, III | cf25489 | 2017-01-25 20:34:04 -0500 | [diff] [blame] | 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" /> |
Mark Slee | cb39f08 | 2007-04-10 02:30:30 +0000 | [diff] [blame] | 57 | </target> |
| 58 | |
Roger Meier | fa89932 | 2012-10-22 19:27:38 +0000 | [diff] [blame] | 59 | <target name="test" depends="tutorial" /> |
| 60 | |
| 61 | <target name="tutorial" description="Run the tutorial" depends="compile"> |
Mark Slee | cb39f08 | 2007-04-10 02:30:30 +0000 | [diff] [blame] | 62 | <jar jarfile="tutorial.jar" basedir="${build}"/> |
Roger Meier | fa89932 | 2012-10-22 19:27:38 +0000 | [diff] [blame] | 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> |
Mark Slee | cb39f08 | 2007-04-10 02:30:30 +0000 | [diff] [blame] | 107 | </target> |
| 108 | |
| 109 | <target name="clean"> |
| 110 | <delete dir="${build}" /> |
Roger Meier | 18a90d1 | 2012-10-24 18:40:06 +0000 | [diff] [blame] | 111 | <delete dir="${gen}"/> |
Mark Slee | cb39f08 | 2007-04-10 02:30:30 +0000 | [diff] [blame] | 112 | <delete file="tutorial.jar" /> |
| 113 | </target> |
| 114 | |
| 115 | </project> |