/[Apache-SVN]/hadoop/avro/trunk/build.xml
ViewVC logotype

Contents of /hadoop/avro/trunk/build.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 883817 - (hide annotations)
Tue Nov 24 19:07:01 2009 UTC (27 hours ago) by cutting
File MIME type: text/xml
File size: 30645 byte(s)
Add Apache RAT to tests, to validate licenses.
1 cutting 763813 <?xml version="1.0"?>
2    
3     <!--
4     Licensed to the Apache Software Foundation (ASF) under one or more
5     contributor license agreements. See the NOTICE file distributed with
6     this work for additional information regarding copyright ownership.
7     The ASF licenses this file to You under the Apache License, Version 2.0
8     (the "License"); you may not use this file except in compliance with
9     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, software
14     distributed under the License is distributed on an "AS IS" BASIS,
15     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16     See the License for the specific language governing permissions and
17     limitations under the License.
18     -->
19    
20 cutting 785776 <project name="Avro" default="compile"
21     xmlns:ivy="antlib:org.apache.ivy.ant">
22 cutting 763813
23     <!-- Load user's default properties. -->
24     <property file="${user.home}/build.properties" />
25    
26     <property name="Org" value="Apache"/>
27     <property name="org" value="apache"/>
28     <property name="Name" value="Avro"/>
29     <property name="name" value="avro"/>
30 cutting 823690 <property name="version" value="1.2.0-dev"/>
31 cutting 763813 <property name="fullname" value="${name}-${version}"/>
32     <property name="year" value="2009"/>
33    
34     <property name="src.dir" value="${basedir}/src"/>
35 cutting 790785 <property name="build.dir" value="${basedir}/build"/>
36 cutting 763813 <property name="java.src.dir" value="${src.dir}/java"/>
37 cutting 774931 <property name="c.src.dir" value="${src.dir}/c"/>
38 cutting 790785 <property name="c.build.dir" value="${build.dir}/c/obj"/>
39 sbanacho 827822 <property name="cpp.src.dir" value="${src.dir}/c++"/>
40     <property name="cpp.build.dir" value="${build.dir}/c++"/>
41 cutting 763813 <property name="lib.dir" value="${basedir}/lib"/>
42 cutting 790785 <property name="install.c" value="${build.dir}/c/install"/>
43 sbanacho 827822 <property name="install.cpp" value="${build.dir}/c++/install"/>
44 cutting 763813 <property name="dist.dir" value="${build.dir}/${fullname}"/>
45    
46     <property name="build.classes" value="${build.dir}/classes"/>
47     <property name="build.doc" value="${build.dir}/doc"/>
48 cutting 778820 <property name="build.javadoc" value="${build.doc}/api/java"/>
49 cutting 803592 <property name="build.javadoc.log" value="${build.dir}/javadoc.log"/>
50 cutting 778820 <property name="build.cdoc" value="${build.doc}/api/c"/>
51 sbanacho 827822 <property name="build.cppdoc" value="${build.doc}/api/cpp"/>
52 cutting 763813
53 cutting 774931 <exec executable="sed" inputstring="${os.name}" outputproperty="nonspace.os">
54     <arg value="s/ /_/g"/>
55     </exec>
56     <property name="build.platform"
57     value="${nonspace.os}-${os.arch}-${sun.arch.data.model}"/>
58    
59 cutting 763813 <property name="test.count" value="100"/>
60 cutting 822518 <property name="test.junit.output.format" value="plain"/>
61 cutting 763813 <property name="test.java.src.dir" value="${basedir}/src/test/java"/>
62     <property name="test.schemata.dir" value="${basedir}/src/test/schemata"/>
63     <property name="test.java.build.dir" value="${build.dir}/test"/>
64 cutting 828875 <property name="test.java.generated.build.dir" value="${test.java.build.dir}/generated"/>
65     <property name="test.java.generated.dir" value="${test.java.generated.build.dir}/src"/>
66 cutting 763813 <property name="test.java.classes" value="${test.java.build.dir}/classes"/>
67 cutting 828875 <property name="test.java.generated.classes" value="${test.java.generated.build.dir}/classes"/>
68 cutting 763813 <property name="test.java.include" value="Test*"/>
69    
70     <property name="javadoc.link.java"
71     value="http://java.sun.com/javase/6/docs/api/"/>
72     <property name="javadoc.link.jackson"
73     value="http://jackson.codehaus.org/0.9.3/javadoc/"/>
74 cutting 823682 <property name="javadoc.link.servlet"
75     value="http://java.sun.com/products/servlet/2.3/javadoc/"/>
76 cutting 763813 <property name="javadoc.packages" value="org.${org}.${name}.*"/>
77    
78     <property name="javac.encoding" value="ISO-8859-1"/>
79     <property name="javac.debug" value="on"/>
80     <property name="javac.optimize" value="on"/>
81     <property name="javac.deprecation" value="off"/>
82     <property name="javac.version" value="1.6"/>
83     <property name="javac.args" value=""/>
84     <property name="javac.args.warnings" value="-Xlint:unchecked"/>
85    
86 cutting 785776 <property name="ivy.version" value="2.1.0-rc1"/>
87     <property name="ivy.url"
88     value="http://repo2.maven.org/maven2/org/apache/ivy/ivy" />
89     <property name="ivy.home" value="${user.home}/.ant" />
90     <property name="ivy.lib" value="${build.dir}/lib"/>
91 cutting 798646 <property name="ivy.test.lib" value="${build.dir}/test/lib"/>
92 cutting 785776
93 cutting 828875 <!-- Eclipse properties -->
94     <property name="build.dir.eclipse" value=".eclipse"/>
95     <property name="build.dir.eclipse-main-classes" value="${build.dir.eclipse}/classes-main"/>
96     <property name="build.dir.eclipse-main-generated-classes" value="${build.dir.eclipse}/classes-main-generated"/>
97     <property name="build.dir.eclipse-test-classes" value="${build.dir.eclipse}/classes-test"/>
98    
99 cutting 763813 <!-- the normal classpath -->
100     <path id="java.classpath">
101     <pathelement location="${build.classes}"/>
102     <fileset dir="${lib.dir}">
103     <include name="**/*.jar" />
104     <exclude name="**/excluded/" />
105     </fileset>
106     <fileset dir="${ant.home}/lib">
107     <include name="ant.jar" />
108     </fileset>
109 cutting 785776 <fileset dir="${ivy.lib}">
110     <include name="**/*.jar" />
111     </fileset>
112 cutting 763813 </path>
113    
114     <path id="test.java.classpath">
115     <pathelement location="${test.java.classes}" />
116 cutting 828875 <pathelement location="${test.java.generated.classes}" />
117 cutting 798646 <fileset dir="${ivy.test.lib}">
118     <include name="**/*.jar" />
119     </fileset>
120 cutting 763813 <path refid="java.classpath"/>
121     </path>
122    
123     <target name="init">
124     <mkdir dir="${build.dir}"/>
125     <mkdir dir="${build.classes}"/>
126    
127     <mkdir dir="${test.java.build.dir}"/>
128     <mkdir dir="${test.java.classes}"/>
129 cutting 828875 <mkdir dir="${test.java.generated.classes}"/>
130 cutting 785776
131     <mkdir dir="${ivy.lib}"/>
132 cutting 798646 <mkdir dir="${ivy.test.lib}"/>
133 cutting 785776 <condition property="ivy.jar.exists">
134     <available file="${lib.dir}/ivy-${ivy.version}.jar"/>
135     </condition>
136 cutting 763813 </target>
137    
138 sbanacho 827822 <target name="compile" depends="compile-java,compile-c,compile-cpp"/>
139 cutting 763813
140 cutting 798646 <target name="compile-java" depends="schemata,ivy-retrieve">
141 cutting 781125 <java-compiler excludes="**/ipc/** **/*Requestor.java **/*Responder.java"/>
142     <java-avro-compiler/>
143     <java-compiler/>
144     </target>
145 cutting 763813
146 cutting 785776 <target name="ivy-download" unless="ivy.jar.exists" depends="init">
147     <delete dir="${lib.dir}"
148     includes="ivy-*.jar" excludes="ivy-${ivy.version}.jar"/>
149     <get src="${ivy.url}/${ivy.version}/ivy-${ivy.version}.jar"
150     dest="${lib.dir}/ivy-${ivy.version}.jar" usetimestamp="true"/>
151     </target>
152    
153 cutting 818639 <target name="ivy-init" depends="ivy-download" unless="ivy.initialized">
154 cutting 785776 <taskdef resource="org/apache/ivy/ant/antlib.xml"
155     uri="antlib:org.apache.ivy.ant" classpathref="java.classpath"/>
156 cutting 818639 <!-- ensure that ivy taskdef is only run once, otw ant will error -->
157     <property name="ivy.initialized" value="true"/>
158 cutting 785776 </target>
159    
160 cutting 798646 <target name="ivy-retrieve" depends="init,ivy-init">
161     <ivy:retrieve type="jar" conf="default"
162     pattern="${ivy.lib}/[artifact]-[revision].[ext]"/>
163 cutting 785776 </target>
164    
165 cutting 798646 <target name="ivy-retrieve-test" depends="init,ivy-init">
166     <ivy:retrieve type="jar" conf="test"
167     pattern="${ivy.test.lib}/[artifact]-[revision].[ext]"/>
168     </target>
169    
170 cutting 781125 <macrodef name="java-compiler">
171     <attribute name="src" default="${java.src.dir}"/>
172     <attribute name="dest" default="${build.classes}"/>
173     <attribute name="includes" default="**/*.java"/>
174     <attribute name="excludes" default=""/>
175     <attribute name="classpath" default="java.classpath"/>
176     <sequential>
177     <javac
178     srcdir="@{src}"
179     destdir="@{dest}"
180     includes="@{includes}"
181     excludes="@{excludes}"
182     encoding="${javac.encoding}"
183     debug="${javac.debug}"
184     optimize="${javac.optimize}"
185     target="${javac.version}"
186     source="${javac.version}"
187     deprecation="${javac.deprecation}">
188     <compilerarg line="${javac.args} ${javac.args.warnings}" />
189     <classpath refid="@{classpath}"/>
190     </javac>
191     </sequential>
192     </macrodef>
193    
194     <target name="schemata" depends="init">
195     <mkdir dir="${build.dir}/src/org/apache/avro/ipc"/>
196     <mapper id="m4toavsc" type="glob" from="*.m4" to="${build.dir}/src/*.avsc"/>
197     <apply executable="m4" dir="${src.dir}/schemata">
198     <fileset dir="${src.dir}/schemata" includes="**/*.m4"/>
199     <mapper refid="m4toavsc"/>
200     <redirector><outputmapper refid="m4toavsc"/></redirector>
201     </apply>
202 cutting 763813 </target>
203    
204     <target name="jar" depends="compile-java" description="Build jar file.">
205 cutting 785776 <jar jarfile="${build.dir}/${fullname}.jar"
206 cutting 763813 basedir="${build.classes}">
207     <manifest>
208     <section name="org/${org}/${name}">
209     <attribute name="Implementation-Title" value="${Name}"/>
210     <attribute name="Implementation-Version" value="${version}"/>
211     <attribute name="Implementation-Vendor" value="${Org}"/>
212     </section>
213     </manifest>
214     </jar>
215     </target>
216    
217 cutting 798646 <target name="checkstyle-java" depends="compile-java">
218     <taskdef resource="checkstyletask.properties">
219     <classpath refid="test.java.classpath" />
220     </taskdef>
221     <checkstyle config="${java.src.dir}/checkstyle.xml"
222     classpathref="test.java.classpath">
223     <fileset dir="${java.src.dir}">
224 cutting 825270 <include name="**/*.java"/>
225     </fileset>
226     <fileset dir="${test.java.src.dir}">
227     <include name="**/*.java"/>
228     </fileset>
229 cutting 798646 </checkstyle>
230     </target>
231    
232     <target name="compile-test-java" depends="ivy-retrieve-test,compile-java">
233 cutting 781125 <java-avro-compiler src="${test.schemata.dir}"
234     generated="${test.java.generated.dir}"
235 cutting 828875 dest="${test.java.generated.classes}"
236 cutting 781125 classpath="test.java.classpath"/>
237     <java-compiler src="${test.java.src.dir}"
238     dest="${test.java.classes}"
239 cutting 795309 classpath="test.java.classpath"/>
240 cutting 835165 <taskdef
241     name="paranamer"
242     classname="com.thoughtworks.paranamer.ant.ParanamerGeneratorTask">
243     <classpath refid="java.classpath" />
244     </taskdef>
245     <paranamer sourceDirectory="${test.java.generated.dir}"
246     outputDirectory="${test.java.generated.classes}"/>
247 cutting 835670 <paranamer sourceDirectory="${test.java.src.dir}"
248     outputDirectory="${test.java.classes}"/>
249 cutting 763813 </target>
250    
251 cutting 781125 <macrodef name="java-avro-compiler">
252     <attribute name="src" default="${build.dir}/src"/>
253     <attribute name="generated" default="${build.dir}/src"/>
254     <attribute name="dest" default="${build.classes}"/>
255     <attribute name="classpath" default="java.classpath"/>
256    
257     <sequential>
258     <taskdef name="protocol"
259     classname="org.apache.avro.specific.ProtocolTask">
260     <classpath refid="java.classpath" />
261     </taskdef>
262     <taskdef name="schema" classname="org.apache.avro.specific.SchemaTask">
263     <classpath refid="java.classpath" />
264     </taskdef>
265    
266     <mkdir dir="@{generated}"/>
267    
268     <protocol destdir="@{generated}">
269     <fileset dir="@{src}">
270     <include name="**/*.avpr" />
271     </fileset>
272     </protocol>
273    
274     <schema destdir="@{generated}">
275     <fileset dir="@{src}">
276     <include name="**/*.avsc" />
277     </fileset>
278     </schema>
279    
280     <java-compiler src="@{generated}" dest="@{dest}"
281     classpath="@{classpath}"/>
282     </sequential>
283     </macrodef>
284    
285 cutting 883817 <target name="test" depends="test-java,test-py,test-c,test-cpp,test-interop,test-avroj,rat"/>
286 cutting 763813
287 cutting 883817 <target name="rat" depends="ivy-retrieve-test,package">
288     <typedef resource="org/apache/rat/anttasks/antlib.xml"
289     uri="antlib:org.apache.rat.anttasks">
290     <classpath refid="test.java.classpath"/>
291     </typedef>
292    
293     <rat:report xmlns:rat="antlib:org.apache.rat.anttasks"
294     reportFile="${build.dir}/rat-report.log">
295     <fileset dir="${dist.dir}" excludesfile="${src.dir}/rat-excludes.txt"/>
296     </rat:report>
297     <condition property="rat.passed">
298     <isfileselected file="${build.dir}/rat-report.log">
299     <containsregexp expression="^0 Unknown Licenses"/>
300     </isfileselected>
301     </condition>
302     <fail unless="rat.passed">Unknown licenses: See build/rat-report.txt.</fail>
303     </target>
304    
305 cutting 798716 <macrodef name="test-runner">
306     <attribute name="files.location" />
307     <attribute name="tests.pattern" />
308     <sequential>
309     <junit showoutput="yes"
310     printsummary="withOutAndErr"
311     haltonfailure="no"
312     errorProperty="tests.failed" failureProperty="tests.failed">
313     <sysproperty key="test.count" value="${test.count}"/>
314     <sysproperty key="test.dir" value="${test.java.build.dir}"/>
315     <sysproperty key="test.validate" value="${test.validate}"/>
316     <classpath refid="test.java.classpath"/>
317 cutting 822518 <formatter type="${test.junit.output.format}"/>
318 cutting 798716 <batchtest todir="${test.java.build.dir}" unless="testcase">
319     <fileset dir="@{files.location}"
320     includes="@{tests.pattern}"
321     excludes="**/${test.java.exclude}.java" />
322     </batchtest>
323     <batchtest todir="${test.java.build.dir}" if="testcase">
324     <fileset dir="@{files.location}" includes="**/${testcase}.java"/>
325     </batchtest>
326     </junit>
327 cutting 805549 <fail if="tests.failed">Tests Failed!</fail>
328 cutting 798716 </sequential>
329     </macrodef>
330 cutting 776049
331 cutting 822873 <target name="test-java" depends="unit-test-java,checkstyle-java,javadoc"
332     description="Run java tests" />
333    
334     <target name="unit-test-java" depends="compile-test-java"
335 cutting 798716 description="Run java unit tests">
336     <test-runner files.location="${test.java.src.dir}" tests.pattern="**/${test.java.include}.java"/>
337 cutting 776049 </target>
338    
339 cutting 763813 <path id="test.py.path">
340     <pathelement location="${basedir}/src/py"/>
341     <pathelement location="${basedir}/src/test/py"/>
342     <pathelement location="${basedir}/lib/py"/>
343     </path>
344    
345 cutting 788453 <target name="init-py" depends="init, schemata">
346     <copy todir="${basedir}/src/py/avro">
347     <fileset dir="${build.dir}/src/org/apache/avro/ipc">
348     <include name="**/*.avsc"/>
349     </fileset>
350     </copy>
351     </target>
352    
353     <target name="generate-test-data" depends="compile-test-java, init-py">
354 cutting 763813 <mkdir dir="${test.java.build.dir}/data-files"/>
355 cutting 805575 <mkdir dir="${test.java.build.dir}/blocking-data-files"/>
356 cutting 763813 <java classname="org.apache.avro.RandomData"
357     classpathref="test.java.classpath">
358 cutting 781125 <arg value="${basedir}/src/test/schemata/interop.avsc"/>
359 cutting 763813 <arg value="${test.java.build.dir}/data-files/test.java.avro"/>
360     <arg value="${test.count}"/>
361     </java>
362 cutting 805575 <java classname="org.apache.avro.GenerateBlockingData"
363     classpathref="test.java.classpath">
364     <arg value="${basedir}/src/test/schemata/interop.avsc"/>
365     <arg value="${test.java.build.dir}/blocking-data-files/test.java.blocking.avro"/>
366     <arg value="${test.count}"/>
367     </java>
368 cutting 763813
369     <taskdef name="py-run" classname="org.pyant.tasks.PythonRunTask">
370     <classpath refid="java.classpath" />
371     </taskdef>
372     <py-run script="${basedir}/src/test/py/testio.py" python="python"
373     pythonpathref="test.py.path">
374 cutting 781125 <arg value="${basedir}/src/test/schemata/interop.avsc"/>
375 cutting 763813 <arg value="${test.java.build.dir}/data-files/test.py.avro"/>
376     <arg value="100"/>
377     </py-run>
378     </target>
379    
380 cutting 788453 <target name="test-py" depends="init-py" description="Run python unit tests">
381 cutting 763813 <taskdef name="py-test" classname="org.pyant.tasks.PythonTestTask">
382     <classpath refid="java.classpath" />
383     </taskdef>
384     <py-test python="python" pythonpathref="test.py.path" >
385     <fileset dir="${basedir}/src/test/py">
386     <include name="test*.py"/>
387     </fileset>
388     </py-test>
389 sharad 765053 </target>
390 cutting 763813
391 massie 834708 <target name="test-interop" depends="test-interop-java,test-interop-py,test-interop-c"
392 sharad 765053 description="Run multiple languages interoperability tests">
393     </target>
394    
395 cutting 776049 <target name="test-interop-java"
396 sharad 765053 depends="test-interop-data-java,test-interop-rpc-java"
397     description="Run java interoperability tests">
398     </target>
399    
400     <target name="test-interop-py"
401     depends="test-interop-data-py,test-interop-rpc-py"
402     description="Run python interoperability tests">
403     </target>
404    
405 massie 834708 <target name="test-interop-c"
406     depends="test-interop-data-c"
407     description="Run C interoperability tests">
408     </target>
409    
410 cutting 776049 <target name="test-interop-data-java" depends="generate-test-data"
411 sharad 765053 description="Run java data file interoperability tests">
412 cutting 798716 <test-runner files.location="${test.java.classes}" tests.pattern="**/TestDataFile$InteropTest.class" />
413     </target>
414 cutting 776049
415 sharad 765053 <target name="test-interop-data-py" depends="generate-test-data"
416     description="Run python data file interoperability tests">
417     <taskdef name="py-test" classname="org.pyant.tasks.PythonTestTask">
418     <classpath refid="java.classpath" />
419     </taskdef>
420     <py-test python="python" pythonpathref="test.py.path" >
421     <fileset dir="${basedir}/src/test/py">
422     <include name="interop*.py"/>
423     </fileset>
424     </py-test>
425     </target>
426    
427 cutting 788453 <target name="start-rpc-daemons" depends="compile-test-java, init-py"
428 sharad 765053 description="Start the daemons for rpc interoperability tests">
429     <delete dir="${test.java.build.dir}/server-ports"/>
430     <mkdir dir="${test.java.build.dir}/server-ports"/>
431     <taskdef name="py-run" classname="org.pyant.tasks.PythonRunTask">
432     <classpath refid="java.classpath" />
433     </taskdef>
434     <!-- Start the servers. As servers block the ant main thread, these need
435     to be created in parallel threads-->
436     <parallel>
437     <daemons>
438     <java classname="org.apache.avro.TestProtocolSpecific$InteropTest">
439     <classpath refid="test.java.classpath"/>
440     <sysproperty key="test.dir" value="${test.java.build.dir}"/>
441     </java>
442     <py-run script="${basedir}/src/test/py/interoptests.py"
443     python="python" pythonpathref="test.py.path">
444     <arg value="server"/>
445     </py-run>
446     </daemons>
447    
448     <!-- Give some time to start -->
449     <sequential>
450     <sleep seconds="2"/>
451     </sequential>
452     </parallel>
453     </target>
454    
455     <target name="test-interop-rpc-java" depends="start-rpc-daemons"
456     description="Run java rpc interoperability tests">
457 cutting 798716 <test-runner files.location="${test.java.classes}" tests.pattern="**/TestProtocolSpecific$InteropTest.class" />
458 sharad 765053 </target>
459    
460     <target name="test-interop-rpc-py" depends="start-rpc-daemons"
461     description="Run java rpc interoperability tests">
462     <py-run script="${basedir}/src/test/py/interoptests.py"
463     python="python" pythonpathref="test.py.path">
464     <arg value="client"/>
465     </py-run>
466     </target>
467    
468 cutting 830407 <target name="avroj" depends="compile-java" description="Build standalone avroj jar file">
469     <jar jarfile="${build.dir}/avroj-${version}.jar">
470     <manifest>
471     <attribute name="Main-Class" value="org.apache.avro.tool.Main"/>
472     <attribute name="Implementation-Title" value="${Name}"/>
473     <attribute name="Implementation-Version" value="${version}"/>
474     <attribute name="Implementation-Vendor" value="${Org}"/>
475     </manifest>
476     <fileset dir="${build.classes}" />
477     <zipgroupfileset dir="${ivy.lib}" includes="*.jar"/>
478     </jar>
479     <chmod file="${build.dir}/avroj-${version}.jar" perm="ugo+x"/>
480     </target>
481    
482 cutting 882410 <target name="test-avroj" depends="avroj,compile-test-java"
483 cutting 830407 description="Tests avroj commands">
484     <exec executable="${basedir}/src/test/bin/test_avroj.sh"
485 cutting 835640 failonerror="true">
486     <env key="AVROJ" value="${build.dir}/avroj-${version}.jar"/>
487     <env key="TMPDIR" value="${test.java.build.dir}/avroj"/>
488     </exec>
489 cutting 830407 </target>
490    
491 cutting 763813 <target name="pydoc" description="Generate python api docs">
492     <taskdef name="py-doc" classname="org.pyant.tasks.PythonDocTask">
493     <classpath refid="java.classpath" />
494     </taskdef>
495 cutting 778820 <mkdir dir="${build.doc}/api/py"/>
496 cutting 763813 <py-doc python="python" pythonpathref="test.py.path" defaultexcludes="true"
497 cutting 778820 destdir="${build.doc}/api/py">
498 cutting 763813 <fileset dir="${basedir}/src/py">
499     <include name="**/*"/>
500     </fileset>
501     </py-doc>
502     </target>
503    
504 sbanacho 827822 <target name="doc" depends="forrest.check,javadoc,pydoc,cdoc,cppdoc" description="Generate forrest-based documentation. To use, specify -Dforrest.home=&lt;base of Apache Forrest installation&gt; on the command line." if="forrest.home">
505 cutting 822368 <echo file="${build.dir}/avro.ent" append="false">
506     &lt;!ENTITY AvroVersion "${version}"&gt;
507     </echo>
508 cutting 763813 <exec executable="${forrest.home}/bin/forrest" failonerror="true">
509     <env key="JAVA_HOME" value="${java5.home}"/>
510     <arg value="-Dproject.content-dir=src/doc"/>
511     <arg value="-Dproject.site=doc"/>
512     </exec>
513     </target>
514    
515     <target name="forrest.check" unless="forrest.home" depends="java5.check">
516     <fail message="'forrest.home' is not defined. Please pass -Dforrest.home=&lt;base of Apache Forrest installation&gt; to Ant on the command-line." />
517     </target>
518    
519     <target name="java5.check" unless="java5.home">
520     <fail message="'java5.home' is not defined. Forrest requires Java 5. Please pass -Djava5.home=&lt;base of Java 5 distribution&gt; to Ant on the command-line." />
521     </target>
522    
523 cutting 803592 <target name="javadoc" depends="compile-java" description="Generate javadoc">
524 cutting 763813 <mkdir dir="${build.javadoc}"/>
525 cutting 803592 <record name="${build.javadoc.log}" action="start"/>
526 cutting 763813 <javadoc
527     overview="${java.src.dir}/overview.html"
528     packagenames="org.${org}.${name}.*"
529     destdir="${build.javadoc}"
530     author="true"
531     version="true"
532     use="true"
533     windowtitle="${Name} ${version} API"
534     doctitle="${Name} ${version} API"
535     bottom="Copyright &amp;copy; ${year} The ${Org} Software Foundation"
536     >
537     <packageset dir="${java.src.dir}"/>
538    
539     <link href="${javadoc.link.java}"/>
540     <link href="${javadoc.link.jackson}"/>
541 cutting 823682 <link href="${javadoc.link.servlet}"/>
542 cutting 763813
543     <classpath >
544     <path refid="java.classpath" />
545     </classpath>
546    
547     </javadoc>
548 cutting 803592 <record name="${build.javadoc.log}" action="stop"/>
549     <condition property="javadoc.warnings">
550     <isfileselected file="${build.javadoc.log}">
551     <contains text=": warning - "/>
552     </isfileselected>
553     </condition>
554     <fail if="javadoc.warnings">Javadoc warnings!</fail>
555     </target>
556 cutting 763813
557 cutting 830407 <target name="package" depends="jar, avroj, doc, package-c, package-cpp"
558 cutting 763813 description="Build distribution">
559     <mkdir dir="${dist.dir}"/>
560     <mkdir dir="${dist.dir}/lib"/>
561     <mkdir dir="${dist.dir}/doc"/>
562    
563     <copy todir="${dist.dir}/lib" includeEmptyDirs="false">
564 cutting 819043 <fileset dir="lib" excludes="ivy-*.jar"/>
565 cutting 785776 <fileset dir="${ivy.lib}"/>
566 cutting 763813 </copy>
567    
568 cutting 774931 <copy todir="${dist.dir}/c" includeEmptyDirs="false">
569 cutting 790785 <fileset dir="${install.c}"/>
570 cutting 774931 </copy>
571    
572 sbanacho 827822 <copy todir="${dist.dir}/c++" includeEmptyDirs="false">
573     <fileset dir="${install.cpp}"/>
574     </copy>
575    
576 cutting 763813 <copy todir="${dist.dir}">
577 cutting 785776 <fileset file="${build.dir}/${fullname}.jar"/>
578 cutting 763813 </copy>
579    
580 cutting 785776 <checksum file="${dist.dir}/${fullname}.jar" algorithm="md5"/>
581     <checksum file="${dist.dir}/${fullname}.jar" algorithm="sha1"/>
582    
583     <ivy:makepom ivyfile="${basedir}/ivy.xml"
584     pomfile="${dist.dir}/${fullname}.pom">
585     <mapping conf="default" scope="compile"/>
586 cutting 798707 <mapping conf="test" scope="test"/>
587 cutting 785776 </ivy:makepom>
588    
589 cutting 790400 <checksum file="${dist.dir}/${fullname}.pom" algorithm="md5"/>
590     <checksum file="${dist.dir}/${fullname}.pom" algorithm="sha1"/>
591    
592 cutting 763813 <copy todir="${dist.dir}/doc">
593     <fileset dir="${build.doc}"/>
594     </copy>
595    
596     <copy todir="${dist.dir}">
597     <fileset dir=".">
598     <include name="*.txt" />
599     </fileset>
600     </copy>
601    
602     <copy todir="${dist.dir}/src" includeEmptyDirs="true">
603     <fileset dir="src"/>
604     </copy>
605    
606 cutting 790400 <copy todir="${dist.dir}/">
607     <fileset file="build.xml"/>
608     <fileset file="ivy.xml"/>
609     </copy>
610 cutting 763813 </target>
611    
612     <macrodef name="macro_tar" description="Worker Macro for tar">
613     <attribute name="param.destfile"/>
614     <element name="param.listofitems"/>
615     <sequential>
616     <tar compression="gzip" longfile="gnu"
617     destfile="@{param.destfile}">
618     <param.listofitems/>
619     </tar>
620     </sequential>
621     </macrodef>
622    
623     <target name="tar" depends="package" description="Make release tarball">
624     <macro_tar param.destfile="${build.dir}/${fullname}.tar.gz">
625     <param.listofitems>
626     <tarfileset dir="${build.dir}" mode="664">
627     <include name="${fullname}/**" />
628     </tarfileset>
629     </param.listofitems>
630     </macro_tar>
631 cutting 790400 <checksum file="${build.dir}/${fullname}.tar.gz" algorithm="md5"/>
632     <checksum file="${build.dir}/${fullname}.tar.gz" algorithm="sha1"/>
633 cutting 763813 </target>
634    
635 cutting 790785 <target name="clean" description="Delete build files, and their directories">
636 cutting 763813 <delete dir="${build.dir}"/>
637     <delete>
638     <fileset dir="src" includes="**/*.pyc" />
639 cutting 788453 <fileset dir="${basedir}/src/py/avro" includes="**/*.avsc"/>
640 cutting 763813 </delete>
641     </target>
642    
643 cutting 774931 <!-- C Targets -->
644 cutting 813932 <target name="cdoc" depends="configure-c">
645     <mkdir dir="${build.cdoc}"/>
646     <exec dir="${c.build.dir}" executable="make" failonerror="true">
647     <env key="C_DOCS_OUTPUT" value="${build.cdoc}" />
648     <arg line="docs" />
649     </exec>
650 cutting 778820 </target>
651    
652 cutting 774931 <target name="autoreconf-c-check">
653     <uptodate targetfile="${c.src.dir}/configure"
654     srcfile="${c.src.dir}/configure.in"
655     property="autoreconf-c-not-needed"/>
656     </target>
657    
658     <target name="autoreconf-c" depends="autoreconf-c-check"
659     unless="autoreconf-c-not-needed">
660     <exec dir="${c.src.dir}" executable="autoreconf" failonerror="true">
661     <arg line="-f -i"/>
662     </exec>
663     </target>
664    
665     <target name="configure-c-check">
666 cutting 790785 <uptodate targetfile="${c.build.dir}/Makefile"
667 cutting 774931 srcfile="${c.src.dir}/configure"
668     property="configure-c-not-needed"/>
669     </target>
670    
671     <target name="configure-c" depends="autoreconf-c, configure-c-check"
672     unless="configure-c-not-needed">
673 cutting 790785 <mkdir dir="${c.build.dir}" />
674     <exec dir="${c.build.dir}" executable="sh" failonerror="true">
675     <arg line="${c.src.dir}/configure --prefix=${install.c}/${build.platform}"/>
676 cutting 774931 </exec>
677     </target>
678    
679     <target name="compile-c" depends="init, configure-c">
680 cutting 790785 <exec dir="${c.build.dir}" executable="make" failonerror="true"/>
681 cutting 774931 </target>
682    
683     <target name="test-c" depends="compile-c">
684 cutting 790785 <exec dir="${c.build.dir}" executable="make" failonerror="true">
685 cutting 774931 <arg value="check"/>
686     </exec>
687     </target>
688    
689 massie 834708 <target name="test-interop-data-c" depends="generate-test-data,configure-c"
690     description="Run C data file interoperability tests">
691     <exec dir="${c.build.dir}" executable="make" failonerror="true">
692     <arg value="test_avro_interop"/>
693     </exec>
694     <exec dir="${c.build.dir}" executable="./test_avro_interop" failonerror="true">
695     <env key="srcdir" value="${c.src.dir}" />
696     </exec>
697     </target>
698    
699 cutting 774931 <target name="package-c" depends="compile-c">
700 cutting 791149 <chmod file="${c.src.dir}/config/install-sh" perm="ugo+x"/>
701 cutting 790785 <exec dir="${c.build.dir}" executable="make" failonerror="true">
702 cutting 774931 <arg value="install"/>
703     </exec>
704     </target>
705    
706 cutting 781218 <target name="c-makefile-check">
707 cutting 790785 <available file="${c.build.dir}/Makefile" property="c-makefile-present"/>
708 cutting 781218 </target>
709 cutting 774931 <!-- End C Targets -->
710    
711 sbanacho 827822 <!-- C++ Targets -->
712     <target name="cppdoc" depends="configure-cpp">
713     <mkdir dir="${build.cppdoc}"/>
714     <exec dir="${cpp.build.dir}" executable="make" failonerror="true">
715     <env key="CPP_DOC_DIR" value="${build.cppdoc}" />
716     <arg line="doc" />
717     </exec>
718     </target>
719    
720     <target name="configure-cpp-check">
721     <uptodate targetfile="${cpp.build.dir}/Makefile"
722     srcfile="${cpp.src.dir}/configure"
723     property="configure-cpp-not-needed"/>
724     </target>
725    
726     <target name="configure-cpp" depends="configure-cpp-check"
727     unless="configure-cpp-not-needed">
728     <mkdir dir="${cpp.build.dir}" />
729     <exec dir="${cpp.build.dir}" executable="sh" failonerror="true">
730     <arg line="${cpp.src.dir}/configure --prefix=${install.cpp}/${build.platform}"/>
731     </exec>
732     </target>
733    
734     <target name="compile-cpp" depends="configure-cpp">
735     <exec dir="${cpp.build.dir}" executable="make" failonerror="true"/>
736     </target>
737    
738     <target name="test-cpp" depends="compile-cpp">
739     <exec dir="${cpp.build.dir}" executable="make" failonerror="true">
740     <arg value="check"/>
741     </exec>
742     </target>
743    
744     <target name="package-cpp" depends="compile-cpp">
745     <exec dir="${cpp.build.dir}" executable="make" failonerror="true">
746     <arg value="install"/>
747     </exec>
748     </target>
749    
750     <target name="cpp-makefile-check">
751     <available file="${cpp.build.dir}/Makefile" property="cpp-makefile-present"/>
752     </target>
753     <!-- End C++ Targets -->
754    
755 cutting 828875 <!-- Begin Eclipse targets -->
756     <condition property="ant-eclipse.jar.exists">
757     <available file="${lib.dir}/ant-eclipse-1.0-jvm1.2.jar"/>
758     </condition>
759    
760     <target name="ant-eclipse-download" unless="ant-eclipse.jar.exists"
761     description="Downloads the ant-eclipse binary.">
762     <get src="http://downloads.sourceforge.net/project/ant-eclipse/ant-eclipse/1.0/ant-eclipse-1.0.bin.tar.bz2"
763     dest="${build.dir}/ant-eclipse-1.0.bin.tar.bz2" usetimestamp="false" />
764    
765     <untar src="${build.dir}/ant-eclipse-1.0.bin.tar.bz2"
766     dest="${build.dir}" compression="bzip2">
767     <patternset>
768     <include name="lib/ant-eclipse-1.0-jvm1.2.jar"/>
769     </patternset>
770     </untar>
771     <delete file="${src.dir}/java/ant-eclipse-1.0.bin.tar.bz2" />
772     </target>
773    
774     <target name="eclipse"
775     depends="compile-test-java,ant-eclipse-download"
776     description="Create eclipse project files">
777     <ivy:resolve useOrigin="true" conf="test"/>
778     <ivy:cachepath pathid="default.path.id" conf="default" />
779     <ivy:cachepath pathid="junit.path.id" conf="test" transitive="false"/>
780     <taskdef name="eclipse"
781     classname="prantl.ant.eclipse.EclipseTask"
782     classpathref="java.classpath" />
783     <eclipse updatealways="true">
784     <project name="${ant.project.name}" />
785     <classpath>
786     <!-- Use Eclipse to compile Avro runtime -->
787     <source path="${java.src.dir}"
788     output="${build.dir.eclipse-main-classes}" />
789     <source path="${test.java.src.dir}"
790     output="${build.dir.eclipse-test-classes}" />
791     <!-- Even though these are generated, Eclipse can compile these -->
792     <source path="${build.dir}/src"
793     output="${build.dir.eclipse-main-generated-classes}" />
794     <output path="${build.dir.eclipse-main-classes}" />
795     <!-- Tests require that the generated code has paranamer applied to it,
796     so we use the ant build for that. -->
797     <library path="${test.java.generated.classes}" source="${test.java.generated.dir}"/>
798     <library pathref="default.path.id" exported="true" />
799     <library pathref="junit.path.id" exported="false" />
800     </classpath>
801     </eclipse>
802     </target>
803    
804     <target name="clean-eclipse" description="Clean eclipse files">
805     <delete file=".classpath" />
806     <delete file=".eclipse" />
807     <delete file=".project" />
808     <delete dir=".settings" />
809     <delete dir="${build.dir.eclipse}" />
810     </target>
811     <!-- End Eclipse targets -->
812    
813 cutting 763813 </project>

apache@apache.org
ViewVC Help
Powered by ViewVC 1.1.2