Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

633 lines (540 sloc) 24.815 kb
<?xml version="1.0"?>
<!--
This file is part of Hadoop-Gpl-Compression.
Hadoop-Gpl-Compression is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
Hadoop-Gpl-Compression is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Hadoop-Gpl-Compression. If not, see
<http://www.gnu.org/licenses/>.
-->
<project name="Hadoop-GPL-Compression" default="jar"
xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- Load all the default properties, and any the user wants -->
<!-- to contribute (without having to type -D or edit this file -->
<property file="${user.home}/build.properties" />
<property file="${basedir}/build.properties" />
<property name="Name" value="Hadoop GPL Compression"/>
<property name="name" value="hadoop-lzo"/>
<property name="version" value="0.2.1"/>
<property name="final.name" value="${name}-${version}"/>
<property name="year" value="2008"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="java.src.dir" value="${src.dir}/java"/>
<property name="native.src.dir" value="${basedir}/src/native"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="test.lib.dir" value="${lib.dir}"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="build.classes" value="${build.dir}/classes"/>
<property name="build.src" value="${build.dir}/src"/>
<!-- convert spaces to _ so that mac os doesn't break things -->
<exec executable="sed" inputstring="${os.name}"
outputproperty="nonspace.os">
<arg value="s/ /_/g"/>
</exec>
<property name="build.platform"
value="${nonspace.os}-${os.arch}-${sun.arch.data.model}"/>
<property name="jvm.arch"
value="${sun.arch.data.model}"/>
<property name="build.native" value="${build.dir}/native/${build.platform}"/>
<property name="build.docs" value="${build.dir}/docs"/>
<property name="build.javadoc" value="${build.docs}/api"/>
<property name="build.javadoc.dev" value="${build.docs}/dev-api"/>
<property name="build.encoding" value="ISO-8859-1"/>
<property name="test.src.dir" value="${basedir}/src/test"/>
<property name="test.build.dir" value="${build.dir}/test"/>
<property name="test.input.data" value="${test.src.dir}/data"/>
<property name="test.generated.dir" value="${test.build.dir}/src"/>
<property name="test.build.data" value="${test.build.dir}/data"/>
<property name="test.log.dir" value="${test.build.dir}/logs"/>
<property name="test.build.classes" value="${test.build.dir}/classes"/>
<property name="test.include" value="Test*"/>
<property name="test.classpath.id" value="test.classpath"/>
<property name="test.output" value="no"/>
<property name="test.timeout" value="900000"/>
<property name="test.junit.output.format" value="plain"/>
<property name="test.junit.fork.mode" value="perTest" />
<property name="test.junit.printsummary" value="yes" />
<property name="test.junit.haltonfailure" value="no" />
<property name="test.junit.maxmemory" value="512m" />
<property name="javadoc.link.java"
value="http://java.sun.com/javase/6/docs/api/"/>
<property name="javadoc.packages" value="com.hadoop.compression.*"/>
<property name="dist.dir" value="${build.dir}/${final.name}"/>
<property name="javac.debug" value="on"/>
<property name="javac.optimize" value="on"/>
<property name="javac.deprecation" value="on"/>
<property name="javac.version" value="1.6"/>
<property name="javac.args" value=""/>
<property name="javac.args.warnings" value="-Xlint:unchecked"/>
<property name="make.cmd" value="make"/>
<!-- IVY properties set here -->
<property name="ivy.dir" location="ivy" />
<loadproperties srcfile="${ivy.dir}/libraries.properties"/>
<property name="ivy.jar" location="${ivy.dir}/ivy-${ivy.version}.jar"/>
<property name="ivy_repo_url" value="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar"/>
<property name="ivysettings.xml" location="${ivy.dir}/ivysettings.xml" />
<property name="ivy.org" value="com.hadoop.compression"/>
<property name="build.dir" location="build" />
<property name="dist.dir" value="${build.dir}/${final.name}"/>
<property name="build.ivy.dir" location="${build.dir}/ivy" />
<property name="build.ivy.lib.dir" location="${build.ivy.dir}/lib" />
<property name="common.ivy.lib.dir" location="${build.ivy.lib.dir}/${ant.project.name}/common"/>
<property name="build.ivy.report.dir" location="${build.ivy.dir}/report" />
<property name="build.ivy.maven.dir" location="${build.ivy.dir}/maven" />
<property name="build.ivy.maven.pom" location="${build.ivy.maven.dir}/${name}-${version}.pom" />
<property name="build.ivy.maven.jar" location="${build.ivy.maven.dir}/${version}.jar" />
<!--this is the naming policy for artifacts we want pulled down-->
<property name="ivy.artifact.retrieve.pattern" value="${ant.project.name}/[conf]/[artifact]-[revision].[ext]"/>
<!--this is how artifacts that get built are named-->
<property name="ivy.publish.pattern" value="hadoop-[revision]-core.[ext]"/>
<property name="jar.name" location="${build.dir}/${final.name}.jar" />
<!-- the normal classpath -->
<path id="classpath">
<pathelement location="${build.classes}"/>
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
<exclude name="**/excluded/" />
</fileset>
<pathelement location="${conf.dir}"/>
<path refid="ivy-common.classpath"/>
</path>
<!-- the unit test classpath: uses test.src.dir for configuration -->
<path id="test.classpath">
<pathelement location="${test.build.extraconf}"/>
<pathelement location="${test.build.classes}" />
<pathelement location="${test.src.dir}"/>
<pathelement location="${build.dir}"/>
<pathelement location="${build.examples}"/>
<pathelement location="${build.tools}"/>
<fileset dir="${test.lib.dir}">
<include name="**/*.jar" />
<exclude name="**/excluded/" />
</fileset>
<path refid="classpath"/>
</path>
<!-- the cluster test classpath: uses conf.dir for configuration -->
<path id="test.cluster.classpath">
<path refid="classpath"/>
<pathelement location="${test.build.classes}" />
<pathelement location="${test.src.dir}"/>
<pathelement location="${build.dir}"/>
</path>
<!-- properties dependent on the items defined above. -->
<!--<available classname="${rat.reporting.classname}" classpathref="classpath" property="rat.present" value="true"/> -->
<!-- ====================================================== -->
<!-- Macro definitions -->
<!-- ====================================================== -->
<macrodef name="macro_tar" description="Worker Macro for tar">
<attribute name="param.destfile"/>
<element name="param.listofitems"/>
<sequential>
<tar compression="gzip" longfile="gnu"
destfile="@{param.destfile}">
<param.listofitems/>
</tar>
</sequential>
</macrodef>
<!-- ====================================================== -->
<!-- Stuff needed by all targets -->
<!-- ====================================================== -->
<target name="init" depends="ivy-retrieve-common">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes}"/>
<mkdir dir="${build.src}"/>
<mkdir dir="${test.build.dir}"/>
<mkdir dir="${test.build.classes}"/>
</target>
<!-- ====================================================== -->
<!-- Build properties file -->
<!-- ====================================================== -->
<target name="buildinfo">
<tstamp>
<format property="build_time" pattern="MM/dd/yyyy hh:mm aa" timezone="GMT"/>
</tstamp>
<exec executable="git" outputproperty="build_revision">
<arg value="rev-parse"/>
<arg value="HEAD"/>
</exec>
<exec executable="whoami" outputproperty="build_author"/>
<exec executable="uname" outputproperty="build_os">
<arg value="-a"/>
</exec>
<propertyfile file="${build.classes}/build.properties"
comment="This file is automatically generated - DO NOT EDIT">
<entry key="build_time" value="${build_time}"/>
<entry key="build_revision" value="${build_revision}"/>
<entry key="build_author" value="${build_author}"/>
<entry key="build_version" value="${version}"/>
<entry key="build_os" value="${build_os}"/>
</propertyfile>
</target>
<!-- ====================================================== -->
<!-- Compile the Java files -->
<!-- ====================================================== -->
<target name="compile-java" depends="init">
<javac
encoding="${build.encoding}"
srcdir="${java.src.dir}"
includes="**/*.java"
destdir="${build.classes}"
debug="${javac.debug}"
optimize="${javac.optimize}"
target="${javac.version}"
source="${javac.version}"
deprecation="${javac.deprecation}">
<compilerarg line="${javac.args} ${javac.args.warnings}" />
<classpath refid="classpath"/>
</javac>
<copy todir="${build.classes}">
<fileset dir="${java.src.dir}" includes="**/*.properties"/>
</copy>
</target>
<target name="compile-native" depends="compile-java">
<mkdir dir="${build.native}/lib"/>
<mkdir dir="${build.native}/src/com/hadoop/compression/lzo"/>
<javah classpath="${build.classes}"
destdir="${build.native}/src/com/hadoop/compression/lzo"
force="yes"
verbose="yes">
<class name="com.hadoop.compression.lzo.LzoCompressor" />
<class name="com.hadoop.compression.lzo.LzoDecompressor" />
</javah>
<exec dir="${build.native}" executable="sh" failonerror="true">
<env key="OS_NAME" value="${os.name}"/>
<env key="OS_ARCH" value="${os.arch}"/>
<env key="JVM_DATA_MODEL" value="${sun.arch.data.model}"/>
<env key="NATIVE_SRCDIR" value="${native.src.dir}"/>
<arg line="${native.src.dir}/configure"/>
</exec>
<exec dir="${build.native}" executable="${make.cmd}" failonerror="true">
<env key="OS_NAME" value="${os.name}"/>
<env key="OS_ARCH" value="${os.arch}"/>
<env key="JVM_DATA_MODEL" value="${sun.arch.data.model}"/>
<env key="HADOOP_NATIVE_SRCDIR" value="${native.src.dir}"/>
</exec>
<exec dir="${build.native}" executable="sh" failonerror="true">
<arg line="${build.native}/libtool --mode=install cp ${build.native}/libgplcompression.la ${build.native}/lib"/>
</exec>
</target>
<target name="compile" depends="compile-java"
description="Compile all">
</target>
<!-- ================================================================== -->
<!-- Make jar -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="jar" depends="compile-java, buildinfo" description="Make jar">
<jar jarfile="${build.dir}/${final.name}.jar"
basedir="${build.classes}">
<manifest>
<section name="com/hadoop/compression">
<attribute name="Implementation-Title"
value="Hadoop GPL Compression"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="GPL3"/>
</section>
</manifest>
</jar>
</target>
<!-- ================================================================== -->
<!-- Compile test code -->
<!-- ================================================================== -->
<target name="compile-java-test" depends="compile-java">
<javac
encoding="${build.encoding}"
srcdir="${test.src.dir}"
includes="com/hadoop/**/*.java"
destdir="${test.build.classes}"
debug="${javac.debug}"
optimize="${javac.optimize}"
target="${javac.version}"
source="${javac.version}"
deprecation="${javac.deprecation}">
<compilerarg line="${javac.args} ${javac.args.warnings}" />
<classpath refid="test.classpath"/>
</javac>
</target>
<!-- ================================================================== -->
<!-- Run unit tests -->
<!-- ================================================================== -->
<target name="test" depends="compile-java-test"
description="Run unit tests">
<delete dir="${test.build.data}"/>
<mkdir dir="${test.build.data}"/>
<copy todir="${test.build.data}">
<fileset dir="${test.input.data}"/>
</copy>
<delete dir="${test.log.dir}"/>
<mkdir dir="${test.log.dir}"/>
<junit showoutput="${test.output}"
printsummary="${test.junit.printsummary}"
haltonfailure="${test.junit.haltonfailure}"
fork="yes"
forkmode="${test.junit.fork.mode}"
maxmemory="${test.junit.maxmemory}"
dir="${basedir}" timeout="${test.timeout}"
errorProperty="tests.failed" failureProperty="tests.failed">
<sysproperty key="test.build.data" value="${test.build.data}"/>
<sysproperty key="test.cache.data" value="${test.cache.data}"/>
<sysproperty key="test.debug.data" value="${test.debug.data}"/>
<sysproperty key="hadoop.log.dir" value="${test.log.dir}"/>
<sysproperty key="test.src.dir" value="${test.src.dir}"/>
<sysproperty key="test.build.extraconf" value="${test.build.extraconf}" />
<sysproperty key="hadoop.policy.file" value="hadoop-policy.xml"/>
<sysproperty key="java.library.path"
value="${build.native}/lib:${lib.dir}/native/${build.platform}"/>
<sysproperty key="install.c++.examples" value="${install.c++.examples}"/>
<!-- set compile.c++ in the child jvm only if it is set -->
<syspropertyset dynamic="no">
<propertyref name="compile.c++"/>
</syspropertyset>
<classpath refid="${test.classpath.id}"/>
<formatter type="${test.junit.output.format}" />
<batchtest todir="${test.build.dir}" unless="testcase">
<fileset dir="${test.src.dir}"
includes="**/${test.include}.java"
excludes="**/${test.exclude}.java" />
</batchtest>
<batchtest todir="${test.build.dir}" if="testcase">
<fileset dir="${test.src.dir}" includes="**/${testcase}.java"/>
</batchtest>
</junit>
<fail if="tests.failed">Tests failed!</fail>
</target>
<!-- ================================================================== -->
<!-- Documentation -->
<!-- ================================================================== -->
<target name="docs" depends="javadoc"/>
<target name="javadoc-dev" description="Generate javadoc for hadoop developers">
<mkdir dir="${build.javadoc.dev}"/>
<javadoc
overview="${java.src.dir}/overview.html"
packagenames="com.hadoop.compression.*"
destdir="${build.javadoc.dev}"
author="true"
version="true"
use="true"
windowtitle="${Name} ${version} API"
doctitle="${Name} ${version} Developer API"
>
<packageset dir="${java.src.dir}"/>
<link href="${javadoc.link.java}"/>
<classpath >
<path refid="classpath" />
<fileset dir="src/contrib/">
<include name="*/lib/*.jar" />
</fileset>
<pathelement path="${java.class.path}"/>
</classpath>
<group title="Java" packages="com.hadoop.compression.*"/>
</javadoc>
</target>
<target name="javadoc" depends="compile, ivy-retrieve-javadoc"
description="Generate javadoc">
<mkdir dir="${build.javadoc}"/>
<javadoc
overview="${java.src.dir}/overview.html"
packagenames="com.hadoop.compression.*"
destdir="${build.javadoc}"
author="true"
version="true"
use="true"
windowtitle="${Name} ${version} API"
doctitle="${Name} ${version} API"
>
<packageset dir="${java.src.dir}"/>
<link href="${javadoc.link.java}"/>
<classpath >
<path refid="classpath" />
<path refid="javadoc-classpath"/>
<pathelement path="${java.class.path}"/>
<pathelement location="${build.tools}"/>
</classpath>
<group title="Java" packages="com.hadoop.compression.*"/>
</javadoc>
</target>
<!-- ================================================================== -->
<!-- D I S T R I B U T I O N -->
<!-- ================================================================== -->
<!-- -->
<!-- ================================================================== -->
<target name="package" depends="compile, jar, javadoc"
description="Build distribution">
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.dir}/lib"/>
<mkdir dir="${dist.dir}/docs"/>
<copy todir="${dist.dir}/lib" includeEmptyDirs="false" flatten="true">
<fileset dir="${common.ivy.lib.dir}"/>
</copy>
<copy todir="${dist.dir}/lib" includeEmptyDirs="false">
<fileset dir="lib">
<exclude name="**/native/**"/>
<exclude name="*hadoop*.jar"/>
</fileset>
</copy>
<copy todir="${dist.dir}">
<fileset file="${build.dir}/${final.name}*.jar"/>
</copy>
<exec dir="${dist.dir}" executable="sh" failonerror="true">
<env key="BASE_NATIVE_LIB_DIR" value="${lib.dir}/native"/>
<env key="BUILD_NATIVE_DIR" value="${build.dir}/native"/>
<env key="DIST_LIB_DIR" value="${dist.dir}/lib/native"/>
<arg line="${native.src.dir}/packageNativeHadoop.sh"/>
</exec>
<copy todir="${dist.dir}/docs">
<fileset dir="${build.docs}"/>
</copy>
<copy file="ivy.xml" tofile="${dist.dir}/ivy.xml"/>
<copy todir="${dist.dir}/ivy">
<fileset dir="ivy"/>
</copy>
<copy todir="${dist.dir}">
<fileset dir=".">
<include name="*.txt" />
</fileset>
</copy>
<copy todir="${dist.dir}/src" includeEmptyDirs="true">
<fileset dir="src" excludes="**/*.template **/docs/build/**/*"/>
</copy>
<copy todir="${dist.dir}/" file="build.xml"/>
</target>
<!-- ================================================================== -->
<!-- Make release tarball -->
<!-- ================================================================== -->
<target name="tar" depends="package" description="Make release tarball">
<macro_tar param.destfile="${build.dir}/${final.name}.tar.gz">
<param.listofitems>
<tarfileset dir="${build.dir}" mode="664">
<exclude name="${final.name}/bin/*" />
<include name="${final.name}/**" />
</tarfileset>
<tarfileset dir="${build.dir}" mode="755">
<include name="${final.name}/bin/*" />
</tarfileset>
</param.listofitems>
</macro_tar>
</target>
<!-- ================================================================== -->
<!-- Clean. Delete the build files, and their directories -->
<!-- ================================================================== -->
<target name="clean"
description="Clean. Delete the build files, and their directories">
<delete dir="${build.dir}"/>
</target>
<target name="ivy-init-dirs">
<mkdir dir="${build.ivy.dir}" />
<mkdir dir="${build.ivy.lib.dir}" />
<mkdir dir="${build.ivy.report.dir}" />
<mkdir dir="${build.ivy.maven.dir}" />
</target>
<target name="ivy-probe-antlib" >
<condition property="ivy.found">
<typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/>
</condition>
</target>
<target name="ivy-download" description="To download ivy" unless="offline">
<get src="${ivy_repo_url}" dest="${ivy.jar}" usetimestamp="true"/>
</target>
<!--
To avoid Ivy leaking things across big projects, always load Ivy in the same
classloader. Also note how we skip loading Ivy if it is already there, just
to make sure all is well.
-->
<target name="ivy-init-antlib" depends="ivy-download,ivy-init-dirs,ivy-probe-antlib" unless="ivy.found">
<typedef uri="antlib:org.apache.ivy.ant" onerror="fail"
loaderRef="ivyLoader">
<classpath>
<pathelement location="${ivy.jar}"/>
</classpath>
</typedef>
<fail >
<condition >
<not>
<typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/>
</not>
</condition>
You need Apache Ivy 2.0 or later from http://ant.apache.org/
It could not be loaded from ${ivy_repo_url}
</fail>
</target>
<target name="ivy-init" depends="ivy-init-antlib" >
<!--Configure Ivy by reading in the settings file
If anyone has already read in a settings file into this settings ID, it gets priority
-->
<ivy:configure settingsid="${ant.project.name}.ivy.settings" file="${ivysettings.xml}" override='false'/>
</target>
<target name="ivy-resolve" depends="ivy-init">
<ivy:resolve settingsRef="${ant.project.name}.ivy.settings"/>
</target>
<target name="ivy-resolve-common" depends="ivy-init">
<ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="common" />
</target>
<target name="ivy-resolve-javadoc" depends="ivy-init">
<ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="javadoc"/>
</target>
<target name="ivy-retrieve" depends="ivy-resolve"
description="Retrieve Ivy-managed artifacts">
<ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}"/>
</target>
<target name="ivy-retrieve-common" depends="ivy-resolve-common"
description="Retrieve Ivy-managed artifacts for the compile configurations">
<ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}"/>
<ivy:cachepath pathid="ivy-common.classpath" conf="common"/>
</target>
<target name="ivy-retrieve-javadoc" depends="ivy-resolve-javadoc"
description="Retrieve Ivy-managed artifacts for the javadoc configurations">
<ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}"/>
<ivy:cachepath pathid="javadoc-classpath" conf="javadoc"/>
</target>
<target name="ready-to-publish" depends="jar,ivy-resolve"/>
<target name="ivy-publish-local" depends="ready-to-publish,ivy-resolve">
<ivy:publish
settingsRef="${ant.project.name}.ivy.settings"
resolver="local"
pubrevision="${hadoop.version}"
overwrite="true"
artifactspattern="${build.dir}/${ivy.publish.pattern}" />
</target>
<!-- this is here for curiosity, to see how well the makepom task works
Answer: it depends whether you want transitive dependencies excluded or not
-->
<target name="makepom" depends="ivy-resolve">
<ivy:makepom settingsRef="${ant.project.name}.ivy.settings"
ivyfile="ivy.xml"
pomfile="${build.ivy.maven.dir}/generated.pom">
<ivy:mapping conf="default" scope="default"/>
<ivy:mapping conf="master" scope="master"/>
<ivy:mapping conf="runtime" scope="runtime"/>
</ivy:makepom>
</target>
<target name="copy-jar-to-maven" depends="ready-to-publish">
<copy file="${hadoop.jar}"
tofile="${build.ivy.maven.jar}"/>
<checksum file="${build.ivy.maven.jar}" algorithm="md5"/>
</target>
<target name="copypom" depends="ivy-init-dirs">
<presetdef name="expandingcopy" >
<copy overwrite="true">
<filterchain>
<expandproperties/>
</filterchain>
</copy>
</presetdef>
<expandingcopy file="ivy/hadoop-core.pom"
tofile="${build.ivy.maven.pom}"/>
<checksum file="${build.ivy.maven.pom}" algorithm="md5"/>
</target>
<target name="maven-artifacts" depends="copy-jar-to-maven,copypom" />
<target name="published" depends="ivy-publish-local,maven-artifacts">
</target>
</project>
Jump to Line
Something went wrong with that request. Please try again.