| 30 |
ashish |
1 |
<?xml version="1.0"?>
|
|
|
2 |
<!--
|
|
|
3 |
Licensed to the Apache Software Foundation (ASF) under one
|
|
|
4 |
or more contributor license agreements. See the NOTICE file
|
|
|
5 |
distributed with this work for additional information
|
|
|
6 |
regarding copyright ownership. The ASF licenses this file
|
|
|
7 |
to you under the Apache License, Version 2.0 (the
|
|
|
8 |
"License"); you may not use this file except in compliance
|
|
|
9 |
with the License. You may obtain a copy of the License at
|
|
|
10 |
|
|
|
11 |
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
12 |
|
|
|
13 |
Unless required by applicable law or agreed to in writing,
|
|
|
14 |
software distributed under the License is distributed on an
|
|
|
15 |
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
16 |
KIND, either express or implied. See the License for the
|
|
|
17 |
specific language governing permissions and limitations
|
|
|
18 |
under the License.
|
|
|
19 |
-->
|
|
|
20 |
<project name="libthrift" default="dist" basedir="."
|
|
|
21 |
xmlns:ivy="antlib:org.apache.ivy.ant">
|
|
|
22 |
|
|
|
23 |
<description>Thrift Build File</description>
|
|
|
24 |
|
|
|
25 |
<property environment="env" />
|
|
|
26 |
|
|
|
27 |
<property name="gen" location="gen-java" />
|
|
|
28 |
<property name="genbean" location="gen-javabean" />
|
|
|
29 |
|
|
|
30 |
<property name="src" location="src" />
|
|
|
31 |
<property name="build" location="build" />
|
|
|
32 |
<property name="javadoc" location="${build}/javadoc" />
|
|
|
33 |
<property name="install.path" value="/usr/local/lib" />
|
|
|
34 |
<property name="src.test" location="test" />
|
|
|
35 |
<property name="build.test" location="${build}/test" />
|
|
|
36 |
<property name="test.thrift.home" location="../../test"/>
|
|
|
37 |
<property name="thrift.root" location="../../"/>
|
|
|
38 |
|
|
|
39 |
<property file="${user.home}/.thrift-build.properties" />
|
|
|
40 |
|
|
|
41 |
<!-- ivy properties -->
|
|
|
42 |
<property name="ivy.version" value="2.0.0-rc2" />
|
|
|
43 |
<property name="ivy.dir" location="${build}/ivy" />
|
|
|
44 |
<property name="ivy.jar" location="${ivy.dir}/ivy-${ivy.version}.jar"/>
|
|
|
45 |
<property name="ivy.lib.dir" location="${ivy.dir}/lib" />
|
|
|
46 |
<property name="ivy_repo_url" value="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar"/>
|
|
|
47 |
<property name="ivysettings.xml" location="${ivy.dir}/ivysettings.xml" />
|
|
|
48 |
|
|
|
49 |
<path id="compile.classpath">
|
|
|
50 |
<fileset dir="${ivy.lib.dir}">
|
|
|
51 |
<include name="**/*.jar" />
|
|
|
52 |
</fileset>
|
|
|
53 |
</path>
|
|
|
54 |
|
|
|
55 |
<path id="test.classpath">
|
|
|
56 |
<path refid="compile.classpath" />
|
|
|
57 |
<pathelement path="${env.CLASSPATH}" />
|
|
|
58 |
<pathelement location="build/test" />
|
|
|
59 |
<pathelement location="libthrift.jar" />
|
|
|
60 |
</path>
|
|
|
61 |
|
|
|
62 |
<target name="init">
|
|
|
63 |
<tstamp />
|
|
|
64 |
<mkdir dir="${build}"/>
|
|
|
65 |
<mkdir dir="${build.test}" />
|
|
|
66 |
<!--
|
|
|
67 |
Allow Ivy to be disabled with "-Dnoivy=".
|
|
|
68 |
It is kind of a hack to pretend that we already found it,
|
|
|
69 |
but Ant doesn't provide an easy way of blocking dependencies
|
|
|
70 |
from executing or checking multiple conditions.
|
|
|
71 |
-->
|
|
|
72 |
<condition property="ivy.found"><isset property="noivy" /></condition>
|
|
|
73 |
<condition property="offline"><isset property="noivy" /></condition>
|
|
|
74 |
</target>
|
|
|
75 |
|
|
|
76 |
<target name="ivy-init-dirs">
|
|
|
77 |
<mkdir dir="${ivy.dir}" />
|
|
|
78 |
<mkdir dir="${ivy.lib.dir}" />
|
|
|
79 |
</target>
|
|
|
80 |
|
|
|
81 |
<target name="ivy-download" depends="ivy-init-dirs" description="To download ivy" unless="offline">
|
|
|
82 |
<get src="${ivy_repo_url}" dest="${ivy.jar}" usetimestamp="true"/>
|
|
|
83 |
</target>
|
|
|
84 |
|
|
|
85 |
<target name="ivy-probe-antlib">
|
|
|
86 |
<condition property="ivy.found">
|
|
|
87 |
<typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/>
|
|
|
88 |
</condition>
|
|
|
89 |
</target>
|
|
|
90 |
|
|
|
91 |
<target name="ivy-init-antlib" depends="ivy-download,ivy-probe-antlib" unless="ivy.found">
|
|
|
92 |
<typedef uri="antlib:org.apache.ivy.ant" onerror="fail"
|
|
|
93 |
loaderRef="ivyLoader">
|
|
|
94 |
<classpath>
|
|
|
95 |
<pathelement location="${ivy.jar}"/>
|
|
|
96 |
</classpath>
|
|
|
97 |
</typedef>
|
|
|
98 |
<fail>
|
|
|
99 |
<condition >
|
|
|
100 |
<not>
|
|
|
101 |
<typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/>
|
|
|
102 |
</not>
|
|
|
103 |
</condition>
|
|
|
104 |
You need Apache Ivy 2.0 or later from http://ant.apache.org/
|
|
|
105 |
It could not be loaded from ${ivy_repo_url}
|
|
|
106 |
</fail>
|
|
|
107 |
</target>
|
|
|
108 |
|
|
|
109 |
<target name="resolve" depends="ivy-init-antlib" description="retrieve dependencies with ivy" unless="noivy">
|
|
|
110 |
<ivy:retrieve />
|
|
|
111 |
</target>
|
|
|
112 |
|
|
|
113 |
<target name="compile" depends="init,resolve">
|
|
|
114 |
<javac srcdir="${src}" destdir="${build}" source="1.5" target="1.5" debug="true" classpathref="compile.classpath" />
|
|
|
115 |
</target>
|
|
|
116 |
|
|
|
117 |
<target name="javadoc" depends="init">
|
|
|
118 |
<javadoc sourcepath="${src}"
|
|
|
119 |
destdir="${javadoc}"
|
|
|
120 |
version="true"
|
|
|
121 |
windowtitle="Thrift Java API"
|
|
|
122 |
doctitle="Thrift Java API">
|
|
|
123 |
</javadoc>
|
|
|
124 |
</target>
|
|
|
125 |
|
|
|
126 |
<target name="dist" depends="compile">
|
|
|
127 |
<mkdir dir="${build}/META-INF"/>
|
|
|
128 |
<copy file="${thrift.root}/LICENSE" tofile="${build}/META-INF/LICENSE.txt"/>
|
|
|
129 |
<copy file="${thrift.root}/NOTICE" tofile="${build}/META-INF/NOTICE.txt"/>
|
|
|
130 |
<jar jarfile="libthrift.jar">
|
|
|
131 |
<fileset dir="${build}">
|
|
|
132 |
<include name="**/*.class" />
|
|
|
133 |
<include name="META-INF/*.txt" />
|
|
|
134 |
</fileset>
|
|
|
135 |
<fileset dir="src">
|
|
|
136 |
<include name="**/*.java" />
|
|
|
137 |
</fileset>
|
|
|
138 |
</jar>
|
|
|
139 |
</target>
|
|
|
140 |
|
|
|
141 |
<target name="install" depends="dist,javadoc">
|
|
|
142 |
<copy todir="${install.path}">
|
|
|
143 |
<fileset dir="."><include name="*.jar" /></fileset>
|
|
|
144 |
</copy>
|
|
|
145 |
<copy todir="${install.javadoc.path}">
|
|
|
146 |
<fileset dir="${javadoc}">
|
|
|
147 |
<include name="**/*" />
|
|
|
148 |
</fileset>
|
|
|
149 |
</copy>
|
|
|
150 |
</target>
|
|
|
151 |
|
|
|
152 |
<target name="clean">
|
|
|
153 |
<delete dir="${build}" />
|
|
|
154 |
<delete dir="${gen}"/>
|
|
|
155 |
<delete dir="${genbean}"/>
|
|
|
156 |
<delete dir="${javadoc}"/>
|
|
|
157 |
<delete file="libthrift.jar" />
|
|
|
158 |
</target>
|
|
|
159 |
|
|
|
160 |
<target name="compile-test" description="Build the test suite classes" depends="generate,dist">
|
|
|
161 |
<javac debug="true" srcdir="${gen}" destdir="${build.test}" classpathref="test.classpath" />
|
|
|
162 |
<javac debug="true" srcdir="${genbean}" destdir="${build.test}" classpathref="test.classpath" />
|
|
|
163 |
<javac debug="true" srcdir="${src.test}" destdir="${build.test}" classpathref="test.classpath" />
|
|
|
164 |
</target>
|
|
|
165 |
|
|
|
166 |
<target name="test" description="Run the full test suite" depends="compile-test">
|
|
|
167 |
<java classname="org.apache.thrift.test.JSONProtoTest"
|
|
|
168 |
classpathref="test.classpath" failonerror="true" />
|
|
|
169 |
<java classname="org.apache.thrift.test.TCompactProtocolTest"
|
|
|
170 |
classpathref="test.classpath" failonerror="true" />
|
|
|
171 |
<java classname="org.apache.thrift.test.IdentityTest"
|
|
|
172 |
classpathref="test.classpath" failonerror="true" />
|
|
|
173 |
<java classname="org.apache.thrift.test.EqualityTest"
|
|
|
174 |
classpathref="test.classpath" failonerror="true" />
|
|
|
175 |
<java classname="org.apache.thrift.test.ToStringTest"
|
|
|
176 |
classpathref="test.classpath" failonerror="true" />
|
|
|
177 |
<java classname="org.apache.thrift.test.DeepCopyTest"
|
|
|
178 |
classpathref="test.classpath" failonerror="true" />
|
|
|
179 |
<java classname="org.apache.thrift.test.MetaDataTest"
|
|
|
180 |
classpathref="test.classpath" failonerror="true" />
|
|
|
181 |
<java classname="org.apache.thrift.test.JavaBeansTest"
|
|
|
182 |
classpathref="test.classpath" failonerror="true" />
|
|
|
183 |
<java classname="org.apache.thrift.test.UnionTest"
|
|
|
184 |
classpathref="test.classpath" failonerror="true" />
|
|
|
185 |
<java classname="org.apache.thrift.test.PartialDeserializeTest"
|
|
|
186 |
classpathref="test.classpath" failonerror="true" />
|
|
|
187 |
</target>
|
|
|
188 |
|
|
|
189 |
<target name="generate">
|
|
|
190 |
<exec executable="../../compiler/cpp/thrift" failonerror="true">
|
|
|
191 |
<arg line="--gen java:hashcode ${test.thrift.home}/ThriftTest.thrift" />
|
|
|
192 |
</exec>
|
|
|
193 |
<exec executable="../../compiler/cpp/thrift" failonerror="true">
|
|
|
194 |
<arg line="--gen java:hashcode ${test.thrift.home}/DebugProtoTest.thrift" />
|
|
|
195 |
</exec>
|
|
|
196 |
<exec executable="../../compiler/cpp/thrift" failonerror="true">
|
|
|
197 |
<arg line="--gen java:hashcode ${test.thrift.home}/OptionalRequiredTest.thrift" />
|
|
|
198 |
</exec>
|
|
|
199 |
<exec executable="../../compiler/cpp/thrift" failonerror="true">
|
|
|
200 |
<arg line="--gen java:beans,nocamel ${test.thrift.home}/JavaBeansTest.thrift" />
|
|
|
201 |
</exec>
|
|
|
202 |
</target>
|
|
|
203 |
|
|
|
204 |
</project>
|