Roger Meier | e5e50de | 2010-11-02 12:36:52 +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 | --> |
| 19 | <project name="tutorial" default="test" basedir="."> |
| 20 | |
| 21 | <description>Thrift JavaScript Tutorial</description> |
| 22 | |
| 23 | <property name="src" location="src" /> |
| 24 | <property name="javasrc" location="../java/src" /> |
Roger Meier | fa89932 | 2012-10-22 19:27:38 +0000 | [diff] [blame] | 25 | <property name="gen" location="../java/gen-java" /> |
Roger Meier | e5e50de | 2010-11-02 12:36:52 +0000 | [diff] [blame] | 26 | <property name="build" location="build" /> |
| 27 | |
| 28 | <!-- the root directory, where you unpack thrift distibution (e.g. thrift-0.x.x.tar.gz) --> |
| 29 | <property name="thrift.dir" location="../../" /> |
Roger Meier | fa89932 | 2012-10-22 19:27:38 +0000 | [diff] [blame] | 30 | <!-- JavaScript tutorial depends on the java tutorial thrift handler and server infrastructure --> |
Roger Meier | e5e50de | 2010-11-02 12:36:52 +0000 | [diff] [blame] | 31 | <property name="thrift.java.dir" location="${thrift.dir}/lib/java" /> |
| 32 | |
| 33 | <path id="libs.classpath"> |
Roger Meier | 5fc6973 | 2011-04-08 21:28:50 +0000 | [diff] [blame] | 34 | <fileset dir="../../lib/java/build"> |
| 35 | <include name="*.jar" /> |
| 36 | <exclude name="-test.jar" /> |
| 37 | </fileset> |
| 38 | <fileset dir="../../lib/java/build/lib"> |
Roger Meier | e5e50de | 2010-11-02 12:36:52 +0000 | [diff] [blame] | 39 | <include name="*.jar" /> |
| 40 | </fileset> |
| 41 | </path> |
| 42 | <path id="build.classpath"> |
| 43 | <path refid="libs.classpath" /> |
| 44 | <pathelement path="${gen}" /> |
| 45 | <pathelement path="${build}" /> |
| 46 | </path> |
| 47 | |
| 48 | <target name="init"> |
| 49 | <tstamp /> |
| 50 | <mkdir dir="${build}"/> |
| 51 | </target> |
| 52 | |
| 53 | <target name="compile" depends="init"> |
| 54 | <javac srcdir="${gen}" destdir="${build}" classpathref="libs.classpath" /> |
| 55 | <javac srcdir="${javasrc}" destdir="${build}" classpathref="build.classpath"> |
| 56 | <exclude name="JavaClient.java"/> |
| 57 | <exclude name="JavaServer.java"/> |
| 58 | <include name="CalculatorHandler.java"/> |
| 59 | </javac> |
| 60 | <javac srcdir="${src}" destdir="${build}" classpathref="build.classpath"> |
| 61 | <compilerarg value="-Xlint:all"/> |
| 62 | </javac> |
| 63 | </target> |
| 64 | |
Roger Meier | fa89932 | 2012-10-22 19:27:38 +0000 | [diff] [blame] | 65 | <target name="test" depends="tutorial" /> |
| 66 | |
Roger Meier | e5e50de | 2010-11-02 12:36:52 +0000 | [diff] [blame] | 67 | <target name="tutorial" depends="compile"> |
| 68 | <jar jarfile="tutorial-js.jar" basedir="${build}"/> |
| 69 | </target> |
| 70 | |
Roger Meier | fa89932 | 2012-10-22 19:27:38 +0000 | [diff] [blame] | 71 | <target name="tutorialserver" description="run the test server" depends="tutorial, generate"> |
Roger Meier | e5e50de | 2010-11-02 12:36:52 +0000 | [diff] [blame] | 72 | <java classname="Httpd" fork="true" |
| 73 | classpathref="build.classpath" failonerror="true"> |
| 74 | <arg value="../../" /> |
| 75 | </java> |
| 76 | </target> |
| 77 | |
Roger Meier | fa89932 | 2012-10-22 19:27:38 +0000 | [diff] [blame] | 78 | <target name="generate"> |
| 79 | <exec executable="../../compiler/cpp/thrift" failonerror="true"> |
| 80 | <arg line="--gen js -r ../tutorial.thrift"/> |
| 81 | </exec> |
| 82 | </target> |
| 83 | |
Roger Meier | e5e50de | 2010-11-02 12:36:52 +0000 | [diff] [blame] | 84 | <target name="clean"> |
| 85 | <delete dir="${build}" /> |
Roger Meier | 18a90d1 | 2012-10-24 18:40:06 +0000 | [diff] [blame] | 86 | <delete dir="gen-js"/> |
Roger Meier | e5e50de | 2010-11-02 12:36:52 +0000 | [diff] [blame] | 87 | <delete file="tutorial-js.jar" /> |
| 88 | </target> |
| 89 | |
| 90 | </project> |