compress: build.xml

File build.xml, 25.2 KB (added by liaojiaohe, 14 years ago)
Line 
1<?xml version="1.0"?>
2
3<!--
4 This file is part of Hadoop-Gpl-Compression.
5
6 Hadoop-Gpl-Compression is free software: you can redistribute it
7 and/or modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation, either version 3 of
9 the License, or (at your option) any later version.
10
11 Hadoop-Gpl-Compression is distributed in the hope that it will be
12 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Hadoop-Gpl-Compression.  If not, see
18 <http://www.gnu.org/licenses/>.
19-->
20
21<project name="Hadoop-GPL-Compression" default="compile"
22   xmlns:ivy="antlib:org.apache.ivy.ant"
23   xmlns:artifact="urn:maven-artifact-ant">
24
25  <!-- Load all the default properties, and any the user wants    -->
26  <!-- to contribute (without having to type -D or edit this file -->
27  <property file="${user.home}/build.properties" />
28  <property file="${basedir}/build.properties" />
29 
30  <property name="Name" value="Hadoop GPL Compression"/>
31  <property name="name" value="hadoop-lzo"/>
32  <property name="version" value="0.4.15"/>
33  <property name="final.name" value="${name}-${version}"/>
34  <property name="year" value="2011"/>
35
36  <property name="src.dir" value="${basedir}/src"/>     
37  <property name="java.src.dir" value="${src.dir}/java"/>
38  <property name="native.src.dir" value="${basedir}/src/native"/>
39
40  <property name="build.dir" value="${basedir}/build"/>
41  <property name="build.classes" value="${build.dir}/classes"/>
42  <property name="build.src" value="${build.dir}/src"/>
43  <property name="lib.dir" value="${basedir}/lib"/>
44  <!-- convert spaces to _ so that mac os doesn't break things -->
45  <exec executable="sed" inputstring="${os.name}"
46        outputproperty="nonspace.os">
47     <arg value="s/ /_/g"/>
48  </exec>
49  <property name="build.platform"
50            value="${nonspace.os}-${os.arch}-${sun.arch.data.model}"/>
51  <property name="jvm.arch"
52            value="${sun.arch.data.model}"/>
53  <property name="build.native" value="${build.dir}/native/${build.platform}"/>
54  <property name="build.docs" value="${build.dir}/docs"/>
55  <property name="build.javadoc" value="${build.docs}/api"/>
56  <property name="build.javadoc.dev" value="${build.docs}/dev-api"/>
57  <property name="build.encoding" value="ISO-8859-1"/>
58
59  <property name="test.src.dir" value="${basedir}/src/test"/>
60  <property name="test.build.dir" value="${build.dir}/test"/>
61  <property name="test.input.data" value="${test.src.dir}/data"/>
62  <property name="test.generated.dir" value="${test.build.dir}/src"/>
63  <property name="test.build.data" value="${test.build.dir}/data"/>
64  <property name="test.log.dir" value="${test.build.dir}/logs"/>
65  <property name="test.build.classes" value="${test.build.dir}/classes"/>
66
67  <property name="test.include" value="Test*"/>
68  <property name="test.classpath.id" value="test.classpath"/>
69  <property name="test.output" value="no"/>
70  <property name="test.timeout" value="900000"/>
71  <property name="test.junit.output.format" value="plain"/>
72  <property name="test.junit.fork.mode" value="perTest" />
73  <property name="test.junit.printsummary" value="yes" />
74  <property name="test.junit.haltonfailure" value="no" />
75  <property name="test.junit.maxmemory" value="512m" />
76
77  <property name="javadoc.link.java"
78            value="http://java.sun.com/javase/6/docs/api/"/>
79  <property name="javadoc.packages" value="com.hadoop.compression.*"/>
80
81  <property name="dist.dir" value="${build.dir}/${final.name}"/>
82
83  <property name="javac.debug" value="on"/>
84  <property name="javac.optimize" value="on"/>
85  <property name="javac.deprecation" value="on"/>
86  <property name="javac.version" value="1.6"/>
87  <property name="javac.args" value=""/>
88  <property name="javac.args.warnings" value="-Xlint:unchecked"/>
89
90  <property name="make.cmd" value="make"/>
91
92  <!-- IVY properties set here -->
93  <property name="ivy.dir" location="ivy" />
94  <loadproperties srcfile="${ivy.dir}/libraries.properties"/>
95  <property name="ivy.jar" location="${ivy.dir}/ivy-${ivy.version}.jar"/>
96  <property name="ivy_repo_url" value="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar"/>
97  <property name="ivysettings.xml" location="${ivy.dir}/ivysettings.xml" />
98  <property name="ivy.org" value="com.hadoop.compression"/>
99  <property name="build.dir" location="build" />
100  <property name="dist.dir" value="${build.dir}/${final.name}"/>
101  <property name="build.ivy.dir" location="${build.dir}/ivy" />
102  <property name="build.ivy.lib.dir" location="${build.ivy.dir}/lib" />
103  <property name="common.ivy.lib.dir" location="${build.ivy.lib.dir}/${ant.project.name}/common"/>
104  <property name="build.ivy.report.dir" location="${build.ivy.dir}/report" />
105  <property name="build.ivy.maven.dir" location="${build.ivy.dir}/maven" />
106  <property name="build.ivy.maven.pom" location="${build.ivy.maven.dir}/${name}-${version}.pom" />
107  <property name="build.ivy.maven.jar" location="${build.ivy.maven.dir}/${version}.jar" />
108
109  <!--this is the naming policy for artifacts we want pulled down-->
110  <property name="ivy.artifact.retrieve.pattern" value="${ant.project.name}/[conf]/[artifact]-[revision].[ext]"/>
111
112  <!--this is how artifacts that get built are named-->
113  <property name="ivy.publish.pattern" value="${name}-[revision].[ext]"/>
114  <property name="jar.name" location="${build.dir}/${final.name}.jar" />
115  <property name="tsk.org" value="/org/apache/maven/maven-ant-tasks/"/>
116  <property name="ant_task.jar"
117    location="${ivy.dir}/maven-ant-tasks-${ant-task.version}.jar"/>
118  <property name="mvnrepo" value="http://repo2.maven.org/maven2"/>
119  <property name="ant_task_repo_url"
120    value="${mvnrepo}${tsk.org}${ant-task.version}/maven-ant-tasks-${ant-task.version}.jar"/>
121
122   <!-- set -no-as-needed for gnu ld -->
123   <condition property="native.ldflags" value="" else="-Wl,--no-as-needed">
124     <os family="mac"/>
125   </condition>
126
127  <!-- the normal classpath -->
128  <path id="classpath">
129    <pathelement location="${build.classes}"/>
130    <pathelement location="${conf.dir}"/>
131    <fileset dir="${lib.dir}">
132      <include name="**/*.jar" />
133      <exclude name="**/excluded/" />
134    </fileset>
135  </path>
136
137  <!-- the unit test classpath: uses test.src.dir for configuration -->
138  <path id="test.classpath">
139    <pathelement location="${test.build.extraconf}"/>
140    <pathelement location="${test.build.classes}" />
141    <pathelement location="${test.src.dir}"/>
142    <pathelement location="${build.dir}"/>
143    <pathelement location="${build.examples}"/>
144    <pathelement location="${build.tools}"/>
145    <path refid="classpath"/>
146  </path>
147
148  <!-- the cluster test classpath: uses conf.dir for configuration -->
149  <path id="test.cluster.classpath">
150    <path refid="classpath"/>
151    <pathelement location="${test.build.classes}" />
152    <pathelement location="${test.src.dir}"/>
153    <pathelement location="${build.dir}"/>
154  </path>
155
156  <!-- ivy settings -->
157
158 <!-- <ivy:settings file="ivysettings.xml" /> -->
159
160  <!-- properties dependent on the items defined above. -->
161  <!--<available classname="${rat.reporting.classname}" classpathref="classpath" property="rat.present" value="true"/> -->
162
163  <!-- ====================================================== -->
164  <!-- Macro definitions                                      -->
165  <!-- ====================================================== -->
166  <macrodef name="macro_tar" description="Worker Macro for tar">
167    <attribute name="param.destfile"/>
168    <element name="param.listofitems"/>
169    <sequential>
170      <tar compression="gzip" longfile="gnu"
171      destfile="@{param.destfile}">
172      <param.listofitems/>
173      </tar>
174    </sequential>
175  </macrodef>
176
177  <target name="ant-task-download" description="To download mvn-ant-task">
178    <get src="${ant_task_repo_url}" dest="${ant_task.jar}" usetimestamp="true"/>
179  </target>
180
181  <target name="mvn-taskdef" depends="ant-task-download">
182     <path id="mvn-ant-task.classpath" path="${ant_task.jar}"/>
183     <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
184         uri="urn:maven-artifact-ant"
185         classpathref="mvn-ant-task.classpath"/>
186  </target> 
187
188  <!-- ====================================================== -->
189  <!-- Stuff needed by all targets                            -->
190  <!-- ====================================================== -->
191  <target name="init" >
192    <mkdir dir="${build.dir}"/>
193    <mkdir dir="${build.classes}"/>
194    <mkdir dir="${build.src}"/>
195 
196    <mkdir dir="${test.build.dir}"/>
197    <mkdir dir="${test.build.classes}"/>
198  </target>
199
200  <!-- ====================================================== -->
201  <!-- Build properties file                                  -->
202  <!-- ====================================================== -->
203  <target name="buildinfo">
204    <tstamp>
205      <format property="build_time" pattern="MM/dd/yyyy hh:mm aa" timezone="GMT"/>
206    </tstamp>
207    <exec executable="sh" outputproperty="build_revision">
208       <arg value="${src.dir}/get_build_revision.sh"/>
209    </exec>
210    <exec executable="uname" outputproperty="build_os">
211      <arg value="-a"/>
212    </exec>
213
214    <propertyfile file="${build.classes}/build.properties"
215        comment="This file is automatically generated - DO NOT EDIT">
216      <entry key="build_time" value="${build_time}"/>
217      <entry key="build_revision" value="${build_revision}"/>
218      <entry key="build_author" value="${build_author}"/>
219      <entry key="build_version" value="${version}"/>
220      <entry key="build_os" value="${build_os}"/>
221    </propertyfile>
222  </target>
223
224
225  <!-- ====================================================== -->
226  <!-- Compile the Java files                                 -->
227  <!-- ====================================================== -->
228  <target name="compile-java" depends="init">
229    <javac
230     encoding="${build.encoding}"
231     srcdir="${java.src.dir}"   
232     includes="**/*.java"
233     destdir="${build.classes}"
234     debug="${javac.debug}"
235     optimize="${javac.optimize}"
236     target="${javac.version}"
237     source="${javac.version}"
238     deprecation="${javac.deprecation}">
239      <compilerarg line="${javac.args} ${javac.args.warnings}" />
240      <classpath refid="classpath"/>
241    </javac>
242
243    <copy todir="${build.classes}">
244      <fileset dir="${java.src.dir}" includes="**/*.properties"/>
245    </copy>
246     
247  </target>
248  <target name="check-native-uptodate">
249    <uptodate
250        property="native.uptodate"
251        targetfile="${build.native}/lib/libgplcompression.so">
252      <srcfiles dir="${native.src.dir}" includes="**/*" />
253    </uptodate>
254  </target>
255
256  <target name="compile-native" depends="compile-java,check-native-uptodate" unless="native.uptodate">
257       
258    <mkdir dir="${build.native}/lib"/>
259    <mkdir dir="${build.native}/src/com/hadoop/compression/lzo"/>
260
261    <javah classpath="${build.classes}"
262           destdir="${build.native}/src/com/hadoop/compression/lzo"
263           force="yes"
264           verbose="yes">
265      <class name="com.hadoop.compression.lzo.LzoCompressor" />
266      <class name="com.hadoop.compression.lzo.LzoDecompressor" />
267    </javah>
268
269    <exec dir="${build.native}" executable="sh" failonerror="true">
270       <env key="OS_NAME" value="${os.name}"/>
271       <env key="OS_ARCH" value="${os.arch}"/>
272       <env key="LDFLAGS" value="${native.ldflags}"/>
273       <env key="JVM_DATA_MODEL" value="${sun.arch.data.model}"/>
274       <env key="NATIVE_SRCDIR" value="${native.src.dir}"/>
275       <arg line="${native.src.dir}/configure"/>
276    </exec>
277
278    <exec dir="${build.native}" executable="${make.cmd}" failonerror="true">
279      <env key="OS_NAME" value="${os.name}"/>
280      <env key="OS_ARCH" value="${os.arch}"/>
281          <env key="JVM_DATA_MODEL" value="${sun.arch.data.model}"/>
282          <env key="HADOOP_NATIVE_SRCDIR" value="${native.src.dir}"/>
283    </exec>
284
285        <exec dir="${build.native}" executable="sh" failonerror="true">
286          <arg line="${build.native}/libtool --mode=install cp ${build.native}/libgplcompression.la ${build.native}/lib"/>
287    </exec>
288
289  </target>
290
291  <target name="compile" depends="compile-java,compile-native,buildinfo"
292          description="Compile all">
293  </target>
294
295  <!-- ================================================================== -->
296  <!-- Make jar                                                     -->
297  <!-- ================================================================== -->
298  <!--                                                                    -->
299  <!-- ================================================================== -->
300  <target name="jar" depends="compile-java, buildinfo" description="Make jar">
301    <jar jarfile="${build.dir}/${final.name}.jar"
302         basedir="${build.classes}">
303      <manifest>
304        <section name="com/hadoop/compression">
305          <attribute name="Implementation-Title"
306                     value="Hadoop GPL Compression"/>
307          <attribute name="Implementation-Version" value="${version}"/>
308          <attribute name="Implementation-Vendor" value="GPL3"/>
309        </section>
310      </manifest>
311    </jar>
312  </target>
313 
314  <!-- ================================================================== -->
315  <!-- Compile test code                                                  -->
316  <!-- ================================================================== -->
317  <target name="compile-java-test" depends="compile">
318    <javac
319     encoding="${build.encoding}"
320     srcdir="${test.src.dir}"
321     includes="com/hadoop/**/*.java"
322     destdir="${test.build.classes}"
323     debug="${javac.debug}"
324     optimize="${javac.optimize}"
325     target="${javac.version}"
326     source="${javac.version}"
327     deprecation="${javac.deprecation}">
328      <compilerarg line="${javac.args} ${javac.args.warnings}" />
329      <classpath refid="test.classpath"/>
330    </javac>
331  </target>
332
333  <!-- ================================================================== -->
334  <!-- Run unit tests                                                     -->
335  <!-- ================================================================== -->
336  <target name="test" depends="compile-java-test"
337                      description="Run unit tests">
338
339    <delete dir="${test.build.data}"/>
340    <mkdir dir="${test.build.data}"/>
341    <copy todir="${test.build.data}">
342      <fileset dir="${test.input.data}"/>
343    </copy>
344    <delete dir="${test.log.dir}"/>
345    <mkdir dir="${test.log.dir}"/>
346    <junit showoutput="${test.output}"
347      printsummary="${test.junit.printsummary}"
348      haltonfailure="${test.junit.haltonfailure}"
349      fork="yes"
350      forkmode="${test.junit.fork.mode}"
351      maxmemory="${test.junit.maxmemory}"
352      dir="${basedir}" timeout="${test.timeout}"
353      errorProperty="tests.failed" failureProperty="tests.failed">
354      <sysproperty key="test.build.data" value="${test.build.data}"/>
355      <sysproperty key="test.cache.data" value="${test.cache.data}"/>           
356      <sysproperty key="test.debug.data" value="${test.debug.data}"/>
357      <sysproperty key="hadoop.log.dir" value="${test.log.dir}"/>
358      <sysproperty key="test.src.dir" value="${test.src.dir}"/>
359      <sysproperty key="test.build.extraconf" value="${test.build.extraconf}" />
360      <sysproperty key="hadoop.policy.file" value="hadoop-policy.xml"/>
361      <sysproperty key="java.library.path"
362       value="${build.native}/lib"/>
363      <sysproperty key="install.c++.examples" value="${install.c++.examples}"/>
364      <!-- set compile.c++ in the child jvm only if it is set -->
365      <syspropertyset dynamic="no">
366         <propertyref name="compile.c++"/>
367      </syspropertyset>
368      <classpath refid="${test.classpath.id}"/>
369      <formatter type="${test.junit.output.format}" />
370      <batchtest todir="${test.build.dir}" unless="testcase">
371        <fileset dir="${test.src.dir}"
372                 includes="**/${test.include}.java"
373                 excludes="**/${test.exclude}.java" />
374      </batchtest>
375      <batchtest todir="${test.build.dir}" if="testcase">
376        <fileset dir="${test.src.dir}" includes="**/${testcase}.java"/>
377      </batchtest>
378    </junit>
379    <fail if="tests.failed">Tests failed!</fail>
380  </target>   
381
382  <!-- ================================================================== -->
383  <!-- Documentation                                                      -->
384  <!-- ================================================================== -->
385
386  <target name="docs" depends="javadoc"/>
387 
388  <target name="javadoc-dev" description="Generate javadoc for hadoop developers">
389    <mkdir dir="${build.javadoc.dev}"/>
390    <javadoc
391      packagenames="com.hadoop.compression.*"
392      destdir="${build.javadoc.dev}"
393      author="true"
394      version="true"
395      use="true"
396      windowtitle="${Name} ${version} API"
397      doctitle="${Name} ${version} Developer API"
398      >
399        <packageset dir="${java.src.dir}"/>
400
401        <link href="${javadoc.link.java}"/>
402
403        <classpath >
404          <path refid="classpath" />
405          <fileset dir="src/contrib/">
406            <include name="*/lib/*.jar" />
407          </fileset>
408          <pathelement path="${java.class.path}"/>
409        </classpath>
410
411        <group title="Java" packages="com.hadoop.compression.*"/>
412    </javadoc>
413  </target>     
414
415  <target name="javadoc" depends="compile, ivy-retrieve-javadoc"
416          description="Generate javadoc">
417    <mkdir dir="${build.javadoc}"/>
418    <javadoc
419      packagenames="com.hadoop.compression.*"
420      destdir="${build.javadoc}"
421      author="true"
422      version="true"
423      use="true"
424      windowtitle="${Name} ${version} API"
425      doctitle="${Name} ${version} API"
426      >
427        <packageset dir="${java.src.dir}"/>
428       
429        <link href="${javadoc.link.java}"/>
430
431        <classpath >
432          <path refid="classpath" />
433          <path refid="javadoc-classpath"/>
434          <pathelement path="${java.class.path}"/>
435          <pathelement location="${build.tools}"/>
436        </classpath>
437
438        <group title="Java" packages="com.hadoop.compression.*"/>
439    </javadoc>
440  </target>     
441
442  <!-- ================================================================== -->
443  <!-- D I S T R I B U T I O N                                            -->
444  <!-- ================================================================== -->
445  <!--                                                                    -->
446  <!-- ================================================================== -->
447  <target name="package" depends="compile, jar"
448          description="Build distribution">
449    <mkdir dir="${dist.dir}"/>
450    <mkdir dir="${dist.dir}/lib"/>
451
452   <copy todir="${dist.dir}/lib" includeEmptyDirs="false" flatten="true">
453      <fileset dir="${lib.dir}"/>
454    </copy>
455
456    <copy todir="${dist.dir}">
457        <fileset file="${build.dir}/${final.name}*.jar"/>
458    </copy>
459
460    <exec dir="${dist.dir}" executable="sh" failonerror="true">
461     <env key="BASE_NATIVE_LIB_DIR" value="${lib.dir}/native"/>
462     <env key="BUILD_NATIVE_DIR" value="${build.dir}/native"/>
463     <env key="DIST_LIB_DIR" value="${dist.dir}/lib/native"/>
464     <arg line="${native.src.dir}/packageNativeHadoop.sh"/>
465    </exec>
466
467
468        <copy file="ivy.xml" tofile="${dist.dir}/ivy.xml"/>
469
470        <copy todir="${dist.dir}/ivy">
471                <fileset dir="ivy"/>
472        </copy>
473
474        <copy todir="${dist.dir}">
475                <fileset dir=".">
476                        <include name="*.txt" />
477                </fileset>
478        </copy>
479
480        <copy todir="${dist.dir}/src" includeEmptyDirs="true">
481                <fileset dir="src" excludes="**/*.template **/docs/build/**/*"/>
482        </copy>
483
484        <copy todir="${dist.dir}/" file="build.xml"/>
485  </target>
486
487  <!-- ================================================================== -->
488  <!-- Make release tarball                                               -->
489  <!-- ================================================================== -->
490  <target name="tar" depends="package" description="Make release tarball">
491    <macro_tar param.destfile="${build.dir}/${final.name}.tar.gz">
492      <param.listofitems>
493        <tarfileset dir="${build.dir}" mode="664">
494          <exclude name="${final.name}/bin/*" />
495          <include name="${final.name}/**" />
496        </tarfileset>
497        <tarfileset dir="${build.dir}" mode="755">
498          <include name="${final.name}/bin/*" />
499        </tarfileset>
500      </param.listofitems>
501    </macro_tar>
502  </target>
503
504  <!-- ================================================================== -->
505  <!-- Clean.  Delete the build files, and their directories              -->
506  <!-- ================================================================== -->
507  <target name="clean"
508          description="Clean.  Delete the build files, and their directories">
509    <delete dir="${build.dir}"/>
510  </target>
511
512  <target name="ivy-init-dirs">
513    <mkdir dir="${build.ivy.dir}" />
514    <mkdir dir="${build.ivy.lib.dir}" />
515    <mkdir dir="${build.ivy.report.dir}" />
516    <mkdir dir="${build.ivy.maven.dir}" />
517  </target>
518
519  <target name="ivy-probe-antlib" >
520    <condition property="ivy.found">
521      <typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/>
522    </condition>
523  </target>
524
525  <target name="ivy-download" description="To download ivy" unless="offline">
526    <get src="${ivy_repo_url}" dest="${ivy.jar}" usetimestamp="true"/>
527  </target>
528
529  <!--
530  To avoid Ivy leaking things across big projects, always load Ivy in the same
531  classloader. Also note how we skip loading Ivy if it is already there, just
532  to make sure all is well.
533  -->
534  <target name="ivy-init-antlib" depends="ivy-download,ivy-init-dirs,ivy-probe-antlib" unless="ivy.found">
535    <typedef uri="antlib:org.apache.ivy.ant" onerror="fail"
536      loaderRef="ivyLoader">
537      <classpath>
538        <pathelement location="${ivy.jar}"/>
539      </classpath>
540    </typedef>
541    <fail >
542      <condition >
543        <not>
544          <typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/>
545        </not>
546      </condition>
547      You need Apache Ivy 2.0 or later from http://ant.apache.org/
548      It could not be loaded from ${ivy_repo_url}
549    </fail>
550  </target>
551
552
553  <target name="ivy-init" depends="ivy-init-antlib" >
554
555    <!--Configure Ivy by reading in the settings file
556        If anyone has already read in a settings file into this settings ID, it gets priority
557    -->
558    <ivy:configure settingsid="${ant.project.name}.ivy.settings" file="${ivysettings.xml}" override='false'/>
559  </target>
560
561  <target name="ivy-resolve" depends="ivy-init">
562    <ivy:resolve settingsRef="${ant.project.name}.ivy.settings"/>
563  </target>
564
565  <target name="ivy-resolve-common" depends="ivy-init">
566    <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="common" />
567  </target>
568
569  <target name="ivy-resolve-javadoc" depends="ivy-init">
570    <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="javadoc"/>
571  </target>
572
573  <target name="ivy-retrieve" depends="ivy-resolve"
574    description="Retrieve Ivy-managed artifacts">
575    <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
576      pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}"/>
577  </target>
578
579  <target name="ivy-retrieve-common" depends="ivy-resolve-common"
580    description="Retrieve Ivy-managed artifacts for the compile configurations">
581    <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
582      pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}"/>
583    <ivy:cachepath pathid="ivy-common.classpath" conf="common"/>
584  </target>
585
586  <target name="ivy-retrieve-javadoc" depends="ivy-resolve-javadoc"
587    description="Retrieve Ivy-managed artifacts for the javadoc configurations">
588    <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
589      pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}"/>
590    <ivy:cachepath pathid="javadoc-classpath" conf="javadoc"/>
591  </target>
592
593  <target name="ready-to-publish" depends="jar,ivy-resolve"/>
594
595  <target name="ivy-publish-local" depends="ready-to-publish,ivy-resolve">
596    <ivy:publish
597      settingsRef="${ant.project.name}.ivy.settings"
598      resolver="local"
599      pubrevision="${version}"
600      overwrite="true"
601      artifactspattern="${build.dir}/${ivy.publish.pattern}" />
602  </target>
603
604
605  <!-- this is here for curiosity, to see how well the makepom task works
606  Answer: it depends whether you want transitive dependencies excluded or not
607  -->
608  <target name="makepom" depends="ivy-resolve">
609    <ivy:makepom settingsRef="${ant.project.name}.ivy.settings"
610      ivyfile="ivy.xml"
611      pomfile="${build.ivy.maven.dir}/${final.name}.pom">
612      <ivy:mapping conf="default" scope="default"/>
613      <ivy:mapping conf="master" scope="master"/>
614      <ivy:mapping conf="runtime" scope="runtime"/>
615    </ivy:makepom>
616  </target>
617
618
619  <target name="copy-jar-to-maven" depends="ready-to-publish">
620    <copy file="${jar.name}"
621      tofile="${build.ivy.maven.dir}/${final.name}.jar"/>
622    <checksum file="${build.ivy.maven.dir}/${final.name}.jar" algorithm="md5"/>
623  </target>
624
625  <target name="copypom" depends="ivy-init-dirs,makepom">
626
627   <presetdef name="expandingcopy" >
628    <copy overwrite="true">
629      <filterchain>
630        <expandproperties/>
631      </filterchain>
632    </copy>
633   </presetdef>
634
635   <expandingcopy file="${build.ivy.maven.dir}/${final.name}.pom"
636      tofile="${build.ivy.maven.pom}"/>
637   <checksum file="${build.ivy.maven.pom}" algorithm="md5"/>
638  </target>
639
640  <target name="maven-artifacts" depends="copy-jar-to-maven,copypom" />
641
642  <target name="published" depends="mvn-taskdef,ivy-publish-local,maven-artifacts">
643     <artifact:pom file="${build.ivy.maven.pom}" id="hadoop.lzo.mvn.install"/>
644     <artifact:install file="${build.ivy.maven.dir}/${final.name}.jar">
645        <pom refid="hadoop.lzo.mvn.install"/>
646     </artifact:install>
647  </target>
648
649</project>