123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491 |
- <?xml version="1.0"?>
- <!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
- <project name="Hadoop-Core" default="compile"
- xmlns:ivy="antlib:org.apache.ivy.ant"
- xmlns:artifact="urn:maven-artifact-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-core"/>
- <property name="name" value="hadoop-core"/>
- <property name="version" value="0.22.0-SNAPSHOT"/>
- <property name="final.name" value="${name}-${version}"/>
- <property name="test.final.name" value="${name}-test-${version}"/>
- <property name="year" value="2009"/>
- <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="conf.dir" value="${basedir}/conf"/>
- <property name="contrib.dir" value="${basedir}/src/contrib"/>
- <property name="docs.src" value="${basedir}/src/docs"/>
- <property name="src.docs.cn" value="${basedir}/src/docs/cn"/>
- <property name="changes.src" value="${docs.src}/changes"/>
- <property name="build.dir" value="${basedir}/build"/>
- <property name="build.classes" value="${build.dir}/classes"/>
- <property name="build.src" value="${build.dir}/src"/>
- <property name="build.webapps" value="${build.dir}/webapps"/>
- <!-- 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.docs.cn" value="${build.dir}/docs/cn"/>
- <property name="build.javadoc" value="${build.docs}/api"/>
- <property name="build.javadoc.timestamp" value="${build.javadoc}/index.html" />
- <property name="build.javadoc.dev" value="${build.docs}/dev-api"/>
- <property name="build.encoding" value="ISO-8859-1"/>
- <property name="install.c++" value="${build.dir}/c++/${build.platform}"/>
- <property name="test.src.dir" value="${basedir}/src/test"/>
- <property name="test.build.dir" value="${build.dir}/test"/>
- <property name="test.generated.dir" value="${test.build.dir}/src"/>
- <property name="test.build.data" value="${test.build.dir}/data"/>
- <property name="test.cache.data" value="${test.build.dir}/cache"/>
- <property name="test.debug.data" value="${test.build.dir}/debug"/>
- <property name="test.log.dir" value="${test.build.dir}/logs"/>
- <property name="test.build.classes" value="${test.build.dir}/classes"/>
- <property name="test.build.extraconf" value="${test.build.dir}/extraconf"/>
- <property name="test.build.javadoc" value="${test.build.dir}/docs/api"/>
- <property name="test.build.javadoc.dev" value="${test.build.dir}/docs/dev-api"/>
- <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="test.core.build.classes" value="${test.build.dir}/core/classes"/>
- <property name="javadoc.link.java"
- value="http://java.sun.com/javase/6/docs/api/"/>
- <property name="javadoc.packages" value="org.apache.hadoop.*"/>
- <property name="javadoc.maxmemory" value="512m" />
- <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="off"/>
- <property name="javac.version" value="1.6"/>
- <property name="javac.args" value=""/>
- <property name="javac.args.warnings" value="-Xlint:unchecked"/>
- <property name="clover.db.dir" location="${build.dir}/test/clover/db"/>
- <property name="clover.report.dir" location="${build.dir}/test/clover/reports"/>
- <property name="rat.reporting.classname" value="rat.Report"/>
- <property name="jdiff.build.dir" value="${build.docs}/jdiff"/>
- <property name="jdiff.xml.dir" value="${lib.dir}/jdiff"/>
- <property name="jdiff.stable" value="0.20.1"/>
- <property name="jdiff.stable.javadoc"
- value="http://hadoop.apache.org/core/docs/r${jdiff.stable}/api/"/>
- <property name="scratch.dir" value="${user.home}/tmp"/>
- <property name="svn.cmd" value="svn"/>
- <property name="grep.cmd" value="grep"/>
- <property name="patch.cmd" value="patch"/>
- <property name="make.cmd" value="make"/>
-
- <!-- IVY properteis set here -->
- <property name="ivy.repo.dir" value="${user.home}/ivyrepo" />
- <property name="ivy.dir" location="ivy" />
- <loadproperties srcfile="${ivy.dir}/libraries.properties"/>
- <property name="asfrepo" value="https://repository.apache.org/content/repositories/snapshots"/>
- <property name="mvnrepo" value="http://repo2.maven.org/maven2"/>
- <property name="ivy.jar" location="${ivy.dir}/ivy-${ivy.version}.jar"/>
- <property name="ant_task.jar" location="${ivy.dir}/maven-ant-tasks-${ant-task.version}.jar"/>
- <property name="ant_task_repo_url"
- value="${mvnrepo}/org/apache/maven/maven-ant-tasks/${ant-task.version}/maven-ant-tasks-${ant-task.version}.jar"/>
- <property name="ivy_repo_url" value="${mvnrepo}/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar"/>
- <property name="ivysettings.xml" location="${ivy.dir}/ivysettings.xml" />
- <property name="ivy.org" value="org.apache.hadoop"/>
- <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="pom.xml" location="${build.ivy.maven.dir}/pom.xml"/>
- <property name="hadoop-core.pom" location="${ivy.dir}/hadoop-core.xml"/>
- <property name="build.ivy.maven.core.jar" location="${build.ivy.maven.dir}/hadoop-core-${version}.jar"/>
- <property name="hadoop-core-test.pom" location="${ivy.dir}/hadoop-core-test.xml" />
- <property name="build.ivy.maven.core-test.jar" location="${build.ivy.maven.dir}/hadoop-core-test-${version}.jar"/>
- <!--this is the naming policy for artifacts we want pulled down-->
- <property name="ivy.module" location="hadoop-core" />
- <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="[artifact]-[revision].[ext]"/>
- <property name="hadoop-core.jar" location="${build.dir}/${final.name}.jar" />
- <property name="hadoop-core-test.jar" location="${build.dir}/${test.final.name}.jar" />
- <!-- jdiff.home property set -->
- <property name="jdiff.home" value="${build.ivy.lib.dir}/${ant.project.name}/jdiff"/>
- <property name="jdiff.jar" value="${jdiff.home}/jdiff-${jdiff.version}.jar"/>
- <property name="xerces.jar" value="${jdiff.home}/xerces-${xerces.version}.jar"/>
- <property name="clover.jar" location="${clover.home}/lib/clover.jar"/>
- <available property="clover.present" file="${clover.jar}" />
- <!-- check if clover reports should be generated -->
- <condition property="clover.enabled">
- <and>
- <isset property="run.clover"/>
- <isset property="clover.present"/>
- </and>
- </condition>
- <!-- the normal classpath -->
- <path id="classpath">
- <pathelement location="${build.classes}"/>
- <pathelement location="${conf.dir}"/>
- <path refid="ivy-common.classpath"/>
- </path>
- <path id="test.classpath">
- <pathelement location="${test.build.extraconf}"/>
- <pathelement location="${test.core.build.classes}" />
- <pathelement location="${test.src.dir}"/>
- <pathelement location="${build.dir}"/>
- <pathelement location="${build.examples}"/>
- <pathelement location="${build.tools}"/>
- <pathelement path="${clover.jar}"/>
- <path refid="ivy-test.classpath"/>
- <path refid="classpath"/>
- </path>
- <!--
- <path id="test.hdfs.classpath">
- <pathelement location="${test.hdfs.build.classes}" />
- <path refid="test.classpath"/>
- </path>
- <path id="test.mapred.classpath">
- <pathelement location="${test.mapred.build.classes}" />
- <path refid="test.hdfs.classpath"/>
- </path>
- <path id="test.hdfs.with.mr.classpath">
- <pathelement location="${test.hdfs.with.mr.build.classes}" />
- <path refid="test.mapred.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>
- <!-- ====================================================== -->
- <!-- 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="${build.webapps}"/>
-
- <mkdir dir="${test.build.dir}"/>
- <mkdir dir="${test.build.classes}"/>
- <mkdir dir="${test.build.extraconf}"/>
- <tempfile property="touch.temp.file" destDir="${java.io.tmpdir}"/>
- <touch millis="0" file="${touch.temp.file}">
- <fileset dir="${conf.dir}" includes="**/*.template"/>
- <fileset dir="${contrib.dir}" includes="**/*.template"/>
- </touch>
- <delete file="${touch.temp.file}"/>
- <!-- copy all of the jsp and static files -->
- <copy todir="${conf.dir}" verbose="true">
- <fileset dir="${conf.dir}" includes="**/*.template"/>
- <mapper type="glob" from="*.template" to="*"/>
- </copy>
- <copy todir="${contrib.dir}" verbose="true">
- <fileset dir="${contrib.dir}" includes="**/*.template"/>
- <mapper type="glob" from="*.template" to="*"/>
- </copy>
- <exec executable="sh">
- <arg line="src/saveVersion.sh ${version} ${build.dir}"/>
- </exec>
-
- <exec executable="sh">
- <arg line="src/fixFontsPath.sh ${src.docs.cn}"/>
- </exec>
- </target>
- <import file="${test.src.dir}/aop/build/aop.xml"/>
- <!-- ====================================================== -->
- <!-- Compile the Java files -->
- <!-- ====================================================== -->
- <target name="record-parser" depends="init" if="javacc.home">
- <javacc
- target="${java.src.dir}/org/apache/hadoop/record/compiler/generated/rcc.jj"
- outputdirectory="${java.src.dir}/org/apache/hadoop/record/compiler/generated"
- javacchome="${javacc.home}" />
- </target>
-
- <target name="compile-rcc-compiler" depends="init, record-parser">
- <javac
- encoding="${build.encoding}"
- srcdir="${java.src.dir}"
- includes="org/apache/hadoop/record/compiler/**/*.java"
- destdir="${build.classes}"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- target="${javac.version}"
- source="${javac.version}"
- deprecation="${javac.deprecation}">
- <compilerarg line="${javac.args}"/>
- <classpath refid="classpath"/>
- </javac>
-
- <taskdef name="recordcc" classname="org.apache.hadoop.record.compiler.ant.RccTask">
- <classpath refid="classpath" />
- </taskdef>
- </target>
-
- <target name="compile-core-classes" depends="init, compile-rcc-compiler">
- <!-- Compile Java files (excluding JSPs) checking warnings -->
- <javac
- encoding="${build.encoding}"
- srcdir="${java.src.dir};${build.src}"
- includes="org/apache/hadoop/**/*.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"/>
- <fileset dir="${java.src.dir}" includes="core-default.xml"/>
- </copy>
-
- </target>
- <target name="compile-native">
- <antcall target="compile-core-native">
- <param name="compile.native" value="true"/>
- </antcall>
- </target>
- <target name="compile-core-native" depends="compile-core-classes"
- if="compile.native">
-
- <mkdir dir="${build.native}/lib"/>
- <mkdir dir="${build.native}/src/org/apache/hadoop/io/compress/zlib"/>
- <javah
- classpath="${build.classes}"
- destdir="${build.native}/src/org/apache/hadoop/io/compress/zlib"
- force="yes"
- verbose="yes"
- >
- <class name="org.apache.hadoop.io.compress.zlib.ZlibCompressor" />
- <class name="org.apache.hadoop.io.compress.zlib.ZlibDecompressor" />
- </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="HADOOP_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}/lib/libhadoop.la ${build.native}/lib"/>
- </exec>
- </target>
- <target name="compile-core"
- depends="clover,compile-core-classes,
- compile-core-native"
- description="Compile core only">
- </target>
- <target name="compile-contrib" depends="compile-core">
- <subant target="compile" inheritall="true">
- <property name="version" value="${version}"/>
- <fileset file="${contrib.dir}/build.xml"/>
- </subant>
- </target>
-
- <target name="compile" depends="compile-core, compile-contrib" description="Compile core, contrib">
- </target>
- <!-- ================================================================== -->
- <!-- Make hadoop-core.jar -->
- <!-- ================================================================== -->
- <!-- -->
- <!-- ================================================================== -->
- <target name="jar" depends="compile-core" description="Make hadoop-core.jar">
- <tar compression="gzip" destfile="${build.classes}/bin.tgz">
- <tarfileset dir="bin" mode="755"/>
- </tar>
- <property name="jar.properties.list" value="commons-logging.properties, log4j.properties, hadoop-metrics.properties" />
- <jar jarfile="${build.dir}/${final.name}.jar"
- basedir="${build.classes}">
- <manifest>
- <section name="org/apache/hadoop">
- <attribute name="Implementation-Title" value="${ant.project.name}"/>
- <attribute name="Implementation-Version" value="${version}"/>
- <attribute name="Implementation-Vendor" value="Apache"/>
- </section>
- </manifest>
- <fileset dir="${conf.dir}" includes="${jar.properties.list}" />
- <fileset file="${jar.extra.properties.list}" />
- </jar>
- </target>
- <!-- ================================================================== -->
- <!-- Make the Hadoop metrics jar. (for use outside Hadoop) -->
- <!-- ================================================================== -->
- <!-- -->
- <!-- ================================================================== -->
- <target name="metrics.jar" depends="compile-core" description="Make the Hadoop metrics jar. (for use outside Hadoop)">
- <jar jarfile="${build.dir}/hadoop-metrics-${version}.jar"
- basedir="${build.classes}">
- <include name="**/metrics/**" />
- <exclude name="**/package.html" />
- </jar>
- </target>
- <target name="generate-test-records" depends="compile-rcc-compiler">
- <recordcc destdir="${test.generated.dir}">
- <fileset dir="${test.src.dir}"
- includes="**/*.jr" />
- </recordcc>
- </target>
- <target name="generate-avro-records" depends="init, ivy-retrieve-test">
- <taskdef name="schema" classname="org.apache.avro.specific.SchemaTask">
- <classpath refid="test.classpath"/>
- </taskdef>
- <schema destdir="${test.generated.dir}">
- <fileset dir="${test.src.dir}">
- <include name="**/*.avsc" />
- </fileset>
- </schema>
- </target>
- <!-- ================================================================== -->
- <!-- Compile test code -->
- <!-- ================================================================== -->
- <!-- This is a wrapper for fault-injection needs-->
- <target name="-classes-compilation"
- depends="compile-core-classes, compile-core-test"/>
- <target name="compile-core-test" depends="compile-core-classes, ivy-retrieve-test, generate-test-records, generate-avro-records">
- <mkdir dir="${test.core.build.classes}"/>
- <javac
- encoding="${build.encoding}"
- srcdir="${test.generated.dir}"
- includes="org/apache/hadoop/**/*.java"
- destdir="${test.core.build.classes}"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- target="${javac.version}"
- source="${javac.version}"
- deprecation="${javac.deprecation}">
- <compilerarg line="${javac.args}"/>
- <classpath refid="test.classpath"/>
- </javac>
- <javac
- encoding="${build.encoding}"
- srcdir="${test.src.dir}/core"
- includes="org/apache/hadoop/**/*.java"
- destdir="${test.core.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>
- <taskdef
- name="paranamer"
- classname="com.thoughtworks.paranamer.ant.ParanamerGeneratorTask">
- <classpath refid="classpath" />
- </taskdef>
- <paranamer sourceDirectory="${test.src.dir}/core"
- outputDirectory="${test.core.build.classes}"/>
- <delete dir="${test.cache.data}"/>
- <mkdir dir="${test.cache.data}"/>
- <copy file="${test.src.dir}/core/org/apache/hadoop/cli/testConf.xml" todir="${test.cache.data}"/>
- </target>
- <!-- ================================================================== -->
- <!-- Make hadoop-test.jar -->
- <!-- ================================================================== -->
- <!-- -->
- <!-- ================================================================== -->
- <target name="jar-test" depends="compile-core-test" description="Make hadoop-test.jar">
- <copy todir="${test.build.classes}">
- <fileset dir="${test.core.build.classes}"/>
- </copy>
- <jar jarfile="${build.dir}/${test.final.name}.jar"
- basedir="${test.build.classes}">
- <manifest>
- <attribute name="Main-Class"
- value="org/apache/hadoop/test/CoreTestDriver"/>
- <section name="org/apache/hadoop">
- <attribute name="Implementation-Title" value="${ant.project.name}"/>
- <attribute name="Implementation-Version" value="${version}"/>
- <attribute name="Implementation-Vendor" value="Apache"/>
- </section>
- </manifest>
- </jar>
- </target>
- <!-- ================================================================== -->
- <!-- Fault injection customization section.
- These targets ought to be copied over to other projects and modified
- as needed -->
- <!-- ================================================================== -->
- <target name="run-test-core-fault-inject" depends="injectfaults"
- description="Run full set of the unit tests with fault injection">
- <macro-run-tests-fault-inject target.name="run-test-core"
- testcasesonly="false"/>
- </target>
- <target name="jar-test-fault-inject" depends="injectfaults"
- description="Make hadoop-test-fi.jar">
- <macro-jar-test-fault-inject
- target.name="jar-test"
- jar.final.name="test.final.name"
- jar.final.value="${test.final.name}-fi" />
- </target>
- <target name="jar-fault-inject" depends="injectfaults"
- description="Make hadoop-fi.jar">
- <macro-jar-fault-inject
- target.name="jar"
- jar.final.name="final.name"
- jar.final.value="${final.name}-fi" />
- </target>
- <!--This target is not included into the the top level list of target
- for it serves a special "regression" testing purpose of non-FI tests in
- FI environment -->
- <target name="run-fault-inject-with-testcaseonly" depends="injectfaults">
- <fail unless="testcase">Can't run this target without -Dtestcase setting!
- </fail>
- <macro-run-tests-fault-inject target.name="run-test-core"
- testcasesonly="true"/>
- </target>
- <!-- ================================================================== -->
- <!-- End of Fault injection customization section -->
- <!-- ================================================================== -->
- <condition property="tests.notestcase">
- <and>
- <isfalse value="${test.fault.inject}"/>
- <not>
- <isset property="testcase"/>
- </not>
- </and>
- </condition>
- <condition property="tests.notestcase.fi">
- <and>
- <not>
- <isset property="testcase" />
- </not>
- <istrue value="${test.fault.inject}" />
- </and>
- </condition>
- <condition property="tests.testcase">
- <and>
- <isfalse value="${test.fault.inject}" />
- <isset property="testcase" />
- </and>
- </condition>
- <condition property="tests.testcaseonly">
- <istrue value="${special.fi.testcasesonly}" />
- </condition>
- <condition property="tests.testcase.fi">
- <and>
- <istrue value="${test.fault.inject}" />
- <isset property="testcase" />
- <isfalse value="${special.fi.testcasesonly}" />
- </and>
- </condition>
-
- <!-- ================================================================== -->
- <!-- Run unit tests -->
- <!-- ================================================================== -->
- <target name="run-test-core" depends="compile-core-test" description="Run core unit tests">
- <delete dir="${test.build.data}"/>
- <mkdir dir="${test.build.data}"/>
- <delete dir="${test.log.dir}"/>
- <mkdir dir="${test.log.dir}"/>
- <copy file="${test.src.dir}/hadoop-policy.xml"
- todir="${test.build.extraconf}" />
- <copy file="${test.src.dir}/fi-site.xml"
- todir="${test.build.extraconf}" />
- <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">
- <jvmarg value="-ea" />
- <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}/core"/>
- <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 io.compression.codec.lzo.class in the child jvm only if it is set -->
- <syspropertyset dynamic="no">
- <propertyref name="io.compression.codec.lzo.class"/>
- </syspropertyset>
- <!-- set compile.c++ in the child jvm only if it is set -->
- <syspropertyset dynamic="no">
- <propertyref name="compile.c++"/>
- </syspropertyset>
- <classpath refid="test.classpath"/>
- <syspropertyset id="FaultProbabilityProperties">
- <propertyref regex="fi.*"/>
- </syspropertyset>
- <formatter type="${test.junit.output.format}" />
- <batchtest todir="${test.build.dir}" if="tests.notestcase">
- <fileset dir="${test.src.dir}/core"
- includes="**/${test.include}.java"
- excludes="**/${test.exclude}.java" />
- </batchtest>
- <batchtest todir="${test.build.dir}" if="tests.notestcase.fi">
- <fileset dir="${test.src.dir}/aop"
- includes="**/${test.include}.java"
- excludes="**/${test.exclude}.java" />
- </batchtest>
- <batchtest todir="${test.build.dir}" if="tests.testcase">
- <fileset dir="${test.src.dir}/core" includes="**/${testcase}.java"/>
- </batchtest>
- <batchtest todir="${test.build.dir}" if="tests.testcase.fi">
- <fileset dir="${test.src.dir}/aop" includes="**/${testcase}.java"/>
- </batchtest>
- <!--The following batch is for very special occasions only when
- a non-FI tests are needed to be executed against FI-environment -->
- <batchtest todir="${test.build.dir}" if="tests.testcaseonly">
- <fileset dir="${test.src.dir}/core" includes="**/${testcase}.java"/>
- </batchtest>
- </junit>
- <antcall target="checkfailure"/>
- </target>
- <target name="checkfailure" if="tests.failed">
- <touch file="${test.build.dir}/testsfailed"/>
- <fail unless="continueOnFailure">Tests failed!</fail>
- </target>
- <target name="test-contrib" depends="compile, compile-core-test" description="Run contrib unit tests">
- <subant target="test" inheritall="true">
- <property name="version" value="${version}"/>
- <property name="clover.jar" value="${clover.jar}"/>
- <fileset file="${contrib.dir}/build.xml"/>
- </subant>
- </target>
- <target name="test-core" description="Run core unit tests">
- <delete file="${test.build.dir}/testsfailed"/>
- <property name="continueOnFailure" value="true"/>
- <antcall target="run-test-core"/>
- <antcall target="run-test-core-fault-inject"/>
- <available file="${test.build.dir}/testsfailed" property="testsfailed"/>
- <fail if="testsfailed">Tests failed!</fail>
- </target>
- <target name="test" depends="jar-test,test-core" description="Run all unit tests">
- <subant target="test-contrib" inheritall="true">
- <fileset dir="." includes="build.xml"/>
- </subant>
- </target>
- <!-- Run all unit tests, not just Test*, and use non-test configuration. -->
- <target name="test-cluster" description="Run all unit tests, not just Test*, and use non-test configuration.">
- <antcall target="test">
- <param name="test.include" value="*"/>
- <param name="test.classpath.id" value="test.cluster.classpath"/>
- </antcall>
- </target>
- <target name="nightly" depends="test, tar">
- </target>
-
- <!-- ================================================================== -->
- <!-- Run optional third-party tool targets -->
- <!-- ================================================================== -->
- <target name="checkstyle" depends="ivy-retrieve-checkstyle,check-for-checkstyle" if="checkstyle.present"
- description="Run optional third-party tool targets">
- <taskdef resource="checkstyletask.properties">
- <classpath refid="checkstyle-classpath"/>
- </taskdef>
-
- <mkdir dir="${test.build.dir}"/>
-
- <checkstyle config="${test.src.dir}/checkstyle.xml"
- failOnViolation="false">
- <fileset dir="${java.src.dir}" includes="**/*.java" excludes="**/generated/**"/>
- <formatter type="xml" toFile="${test.build.dir}/checkstyle-errors.xml"/>
- </checkstyle>
-
- <xslt style="${test.src.dir}/checkstyle-noframes-sorted.xsl"
- in="${test.build.dir}/checkstyle-errors.xml"
- out="${test.build.dir}/checkstyle-errors.html"/>
- </target>
-
- <target name="check-for-checkstyle">
- <available property="checkstyle.present" resource="checkstyletask.properties">
- <classpath refid="checkstyle-classpath"/>
- </available>
- </target>
- <property name="findbugs.home" value=""/>
- <target name="findbugs" depends="check-for-findbugs, jar" if="findbugs.present" description="Run findbugs if present">
- <property environment="env"/>
- <property name="findbugs.out.dir" value="${test.build.dir}/findbugs"/>
- <property name="findbugs.exclude.file" value="${test.src.dir}/findbugsExcludeFile.xml"/>
- <property name="findbugs.report.htmlfile" value="${findbugs.out.dir}/hadoop-findbugs-report.html"/>
- <property name="findbugs.report.xmlfile" value="${findbugs.out.dir}/hadoop-findbugs-report.xml"/>
- <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
- classpath="${findbugs.home}/lib/findbugs-ant.jar" />
- <mkdir dir="${findbugs.out.dir}"/>
- <findbugs home="${findbugs.home}" output="xml:withMessages"
- outputFile="${findbugs.report.xmlfile}" effort="max"
- excludeFilter="${findbugs.exclude.file}" jvmargs="-Xmx512M">
- <auxClasspath>
- <fileset dir="${env.ANT_HOME}/lib">
- <include name="ant.jar"/>
- <include name="ant-launcher.jar"/>
- </fileset>
- <fileset dir="${build.ivy.lib.dir}/${ant.project.name}/common">
- <include name="**/*.jar"/>
- </fileset>
- </auxClasspath>
- <sourcePath path="${java.src.dir}"/>
- <class location="${basedir}/build/${final.name}.jar" />
- </findbugs>
- <xslt style="${findbugs.home}/src/xsl/default.xsl"
- in="${findbugs.report.xmlfile}"
- out="${findbugs.report.htmlfile}"/>
- </target>
-
- <target name="check-for-findbugs">
- <available property="findbugs.present"
- file="${findbugs.home}/lib/findbugs.jar" />
- </target>
- <!-- ================================================================== -->
- <!-- Documentation -->
- <!-- ================================================================== -->
-
- <target name="docs" depends="forrest.check" description="Generate forrest-based documentation.
- To use, specify -Dforrest.home=<base of Apache Forrest installation> on the command line." if="forrest.home">
- <exec dir="${docs.src}" executable="${forrest.home}/bin/forrest"
- failonerror="true">
- <env key="JAVA_HOME" value="${java5.home}"/>
- </exec>
- <copy todir="${build.docs}">
- <fileset dir="${docs.src}/build/site/" />
- </copy>
- <copy file="${docs.src}/releasenotes.html" todir="${build.docs}"/>
- <style basedir="${java.src.dir}" destdir="${build.docs}"
- includes="core-default.xml" style="conf/configuration.xsl"/>
- <antcall target="changes-to-html"/>
- <antcall target="cn-docs"/>
- </target>
- <target name="cn-docs" depends="forrest.check, init" description="Generate forrest-based Chinese documentation.
- To use, specify -Dforrest.home=<base of Apache Forrest installation> on the command line."
- if="forrest.home">
- <exec dir="${src.docs.cn}" executable="${forrest.home}/bin/forrest" failonerror="true">
- <env key="LANG" value="en_US.utf8"/>
- <env key="JAVA_HOME" value="${java5.home}"/>
- </exec>
- <copy todir="${build.docs.cn}">
- <fileset dir="${src.docs.cn}/build/site/" />
- </copy>
- <style basedir="${java.src.dir}" destdir="${build.docs.cn}"
- includes="core-default.xml" style="conf/configuration.xsl"/>
- <antcall target="changes-to-html"/>
- </target>
- <target name="forrest.check" unless="forrest.home" depends="java5.check">
- <fail message="'forrest.home' is not defined. Please pass
- -Dforrest.home=<base of Apache Forrest installation> to Ant on the command-line." />
- </target>
- <target name="java5.check" unless="java5.home">
- <fail message="'java5.home' is not defined. Forrest requires Java 5.
- Please pass -Djava5.home=<base of Java 5 distribution> to Ant on the command-line." />
- </target>
-
- <target name="javadoc-dev" depends="compile, ivy-retrieve-javadoc" description="Generate javadoc for hadoop developers">
- <mkdir dir="${build.javadoc.dev}"/>
- <javadoc
- overview="${java.src.dir}/overview.html"
- packagenames="org.apache.hadoop.*"
- destdir="${build.javadoc.dev}"
- author="true"
- version="true"
- use="true"
- windowtitle="${Name} ${version} API"
- doctitle="${Name} ${version} Developer API"
- bottom="Copyright &copy; ${year} The Apache Software Foundation"
- maxmemory="${javadoc.maxmemory}">
- <packageset dir="${java.src.dir}"/>
- <packageset dir="src/contrib/failmon/src/java/"/>
- <link href="${javadoc.link.java}"/>
- <classpath >
- <path refid="classpath" />
- <fileset dir="src/contrib/">
- <include name="*/lib/*.jar" />
- </fileset>
- <path refid="javadoc-classpath"/>
- <pathelement path="${java.class.path}"/>
- <pathelement location="${build.tools}"/>
- </classpath>
- <group title="Core" packages="org.apache.*"/>
- <group title="contrib: FailMon" packages="org.apache.hadoop.contrib.failmon*"/>
- </javadoc>
- </target>
- <target name="javadoc-uptodate" depends="compile, ivy-retrieve-javadoc">
- <uptodate property="javadoc.is.uptodate">
- <srcfiles dir="${src.dir}">
- <include name="**/*.java" />
- <include name="**/*.html" />
- </srcfiles>
- <mapper type="merge" to="${build.javadoc.timestamp}" />
- </uptodate>
- </target>
-
- <target name="javadoc" description="Generate javadoc" depends="javadoc-uptodate"
- unless="javadoc.is.uptodate">
- <mkdir dir="${build.javadoc}"/>
- <javadoc
- overview="${java.src.dir}/overview.html"
- packagenames="org.apache.hadoop.*"
- destdir="${build.javadoc}"
- author="true"
- version="true"
- use="true"
- windowtitle="${Name} ${version} API"
- doctitle="${Name} ${version} API"
- bottom="Copyright &copy; ${year} The Apache Software Foundation"
- maxmemory="${javadoc.maxmemory}">
- <packageset dir="${java.src.dir}"/>
- <packageset dir="src/contrib/failmon/src/java/"/>
-
- <link href="${javadoc.link.java}"/>
- <classpath >
- <path refid="classpath" />
- <fileset dir="src/contrib/">
- <include name="*/lib/*.jar" />
- </fileset>
- <path refid="javadoc-classpath"/>
- <pathelement path="${java.class.path}"/>
- <pathelement location="${build.tools}"/>
- </classpath>
- <group title="Core" packages="org.apache.*"/>
- <group title="contrib: FailMon" packages="org.apache.hadoop.contrib.failmon*"/>
- </javadoc>
- </target>
- <target name="api-xml" depends="ivy-retrieve-jdiff,javadoc,write-null">
- <javadoc maxmemory="${javadoc.maxmemory}">
- <doclet name="jdiff.JDiff"
- path="${jdiff.jar}:${xerces.jar}">
- <param name="-apidir" value="${jdiff.xml.dir}"/>
- <param name="-apiname" value="hadoop-core ${version}"/>
- </doclet>
- <packageset dir="src/java"/>
- <classpath >
- <path refid="classpath" />
- <path refid="jdiff-classpath" />
- <pathelement path="${java.class.path}"/>
- </classpath>
- </javadoc>
- </target>
-
- <target name="write-null">
- <exec executable="touch">
- <arg value="${jdiff.home}/Null.java"/>
- </exec>
- </target>
- <target name="api-report" depends="ivy-retrieve-jdiff,api-xml">
- <mkdir dir="${jdiff.build.dir}"/>
- <javadoc sourcepath="src/java"
- destdir="${jdiff.build.dir}"
- sourceFiles="${jdiff.home}/Null.java"
- maxmemory="${javadoc.maxmemory}">
- <doclet name="jdiff.JDiff"
- path="${jdiff.jar}:${xerces.jar}">
- <param name="-oldapi" value="hadoop-core ${jdiff.stable}"/>
- <param name="-newapi" value="hadoop-core ${version}"/>
- <param name="-oldapidir" value="${jdiff.xml.dir}"/>
- <param name="-newapidir" value="${jdiff.xml.dir}"/>
- <param name="-javadocold" value="${jdiff.stable.javadoc}"/>
- <param name="-javadocnew" value="../../api/"/>
- <param name="-stats"/>
- </doclet>
- <classpath >
- <path refid="classpath" />
- <path refid="jdiff-classpath"/>
- <pathelement path="${java.class.path}"/>
- </classpath>
- </javadoc>
- </target>
-
- <target name="changes-to-html" description="Convert CHANGES.txt into an html file">
- <mkdir dir="${build.docs}"/>
- <exec executable="perl" input="CHANGES.txt" output="${build.docs}/changes.html" failonerror="true">
- <arg value="${changes.src}/changes2html.pl"/>
- </exec>
- <copy todir="${build.docs}">
- <fileset dir="${changes.src}" includes="*.css"/>
- </copy>
- </target>
- <!-- ================================================================== -->
- <!-- D I S T R I B U T I O N -->
- <!-- ================================================================== -->
- <!-- -->
- <!-- ================================================================== -->
- <target name="package" depends="compile, jar, javadoc, docs, api-report, jar-test"
- description="Build distribution">
- <mkdir dir="${dist.dir}"/>
- <mkdir dir="${dist.dir}/lib"/>
- <mkdir dir="${dist.dir}/contrib"/>
- <mkdir dir="${dist.dir}/bin"/>
- <mkdir dir="${dist.dir}/docs"/>
- <mkdir dir="${dist.dir}/docs/api"/>
- <mkdir dir="${dist.dir}/docs/jdiff"/>
- <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/**"/>
- </fileset>
- </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>
- <subant target="package" inheritall="true">
- <!--Pass down the version in case its needed again and the target
- distribution directory so contribs know where to install to.-->
- <property name="version" value="${version}"/>
- <property name="dist.dir" value="${dist.dir}"/>
- <fileset file="${contrib.dir}/build.xml"/>
- </subant>
- <copy todir="${dist.dir}">
- <fileset file="${build.dir}/${final.name}.jar"/>
- <fileset file="${build.dir}/${test.final.name}.jar"/>
- </copy>
-
- <copy todir="${dist.dir}/bin">
- <fileset dir="bin"/>
- </copy>
- <copy todir="${dist.dir}/conf">
- <fileset dir="${conf.dir}" excludes="**/*.template"/>
- </copy>
- <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"/>
- <chmod perm="ugo+x" type="file" parallel="false">
- <fileset dir="${dist.dir}/bin"/>
- <fileset dir="${dist.dir}/src/contrib/">
- <include name="*/bin/*" />
- </fileset>
- <fileset dir="${dist.dir}/src/contrib/ec2/bin/image"/>
- </chmod>
- </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/*" />
- <exclude name="${final.name}/contrib/*/bin/*" />
- <exclude name="${final.name}/src/contrib/ec2/bin/*" />
- <exclude name="${final.name}/src/contrib/ec2/bin/image/*" />
- <include name="${final.name}/**" />
- </tarfileset>
- <tarfileset dir="${build.dir}" mode="755">
- <include name="${final.name}/bin/*" />
- <include name="${final.name}/contrib/*/bin/*" />
- <include name="${final.name}/src/contrib/ec2/bin/*" />
- <include name="${final.name}/src/contrib/ec2/bin/image/*" />
- </tarfileset>
- </param.listofitems>
- </macro_tar>
- </target>
- <target name="bin-package" depends="compile, jar, jar-test"
- description="assembles artifacts for binary target">
- <mkdir dir="${dist.dir}"/>
- <mkdir dir="${dist.dir}/lib"/>
- <mkdir dir="${dist.dir}/contrib"/>
- <mkdir dir="${dist.dir}/bin"/>
- <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/**"/>
- </fileset>
- </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>
- <subant target="package" inheritall="true">
- <!--Pass down the version in case its needed again and the target
- distribution directory so contribs know where to install to.-->
- <property name="version" value="${version}"/>
- <property name="dist.dir" value="${dist.dir}"/>
- <fileset file="${contrib.dir}/build.xml"/>
- </subant>
- <copy todir="${dist.dir}">
- <fileset file="${build.dir}/${final.name}.jar"/>
- </copy>
-
- <copy todir="${dist.dir}/bin">
- <fileset dir="bin"/>
- </copy>
- <copy todir="${dist.dir}/conf">
- <fileset dir="${conf.dir}" excludes="**/*.template"/>
- </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}/" file="build.xml"/>
- <chmod perm="ugo+x" type="file" parallel="false">
- <fileset dir="${dist.dir}/bin"/>
- </chmod>
- </target>
- <target name="binary" depends="bin-package" description="Make tarball without source and documentation">
- <macro_tar param.destfile="${build.dir}/${final.name}-bin.tar.gz">
- <param.listofitems>
- <tarfileset dir="${build.dir}" mode="664">
- <exclude name="${final.name}/bin/*" />
- <exclude name="${final.name}/src/**" />
- <exclude name="${final.name}/docs/**" />
- <include name="${final.name}/**" />
- </tarfileset>
- <tarfileset dir="${build.dir}" mode="755">
- <include name="${final.name}/bin/*" />
- </tarfileset>
- </param.listofitems>
- </macro_tar>
- </target>
-
- <target name="ant-task-download" description="To download mvn-ant-task" unless="offline">
- <get src="${ant_task_repo_url}" dest="${ant_task.jar}" usetimestamp="true"/>
- </target>
- <target name="mvn-taskdef" depends="ant-task-download">
- <path id="mvn-ant-task.classpath" path="${ant_task.jar}"/>
- <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
- uri="urn:maven-artifact-ant"
- classpathref="mvn-ant-task.classpath"/>
- </target>
- <target name="mvn-install" depends="mvn-taskdef,jar,jar-test,set-version"
- description="To install hadoop core and test jars to local filesystem's m2 cache">
- <artifact:pom file="${hadoop-core.pom}" id="hadoop.core"/>
- <artifact:pom file="${hadoop-core-test.pom}" id="hadoop.core.test"/>
- <artifact:install file="${hadoop-core.jar}">
- <pom refid="hadoop.core"/>
- </artifact:install>
- <artifact:install file="${hadoop-core-test.jar}">
- <pom refid="hadoop.core.test"/>
- </artifact:install>
- </target>
- <target name="mvn-deploy" depends="mvn-taskdef, jar, jar-test, set-version"
- description="To deploy hadoop core and test jar's to apache snapshot's repository">
- <artifact:pom file="${hadoop-core.pom}" id="hadoop.core"/>
- <artifact:pom file="${hadoop-core-test.pom}" id="hadoop.core.test"/>
- <artifact:install-provider artifactId="wagon-http" version="1.0-beta-2"/>
- <artifact:deploy file="${hadoop-core.jar}">
- <remoteRepository id="apache.snapshots.https" url="${asfrepo}"/>
- <pom refid="hadoop.core"/>
- </artifact:deploy>
- <artifact:deploy file="${hadoop-core-test.jar}">
- <remoteRepository id="apache.snapshots.https" url="${asfrepo}"/>
- <pom refid="hadoop.core.test"/>
- </artifact:deploy>
- </target>
-
- <target name="set-version">
- <delete file="${basedir}/ivy/hadoop-core.xml"/>
- <delete file="${basedir}/ivy/hadoop-core-test.xml"/>
- <copy file="${basedir}/ivy/hadoop-core-template.xml" tofile="${basedir}/ivy/hadoop-core.xml"/>
- <copy file="${basedir}/ivy/hadoop-core-test-template.xml" tofile="${basedir}/ivy/hadoop-core-test.xml"/>
- <replaceregexp byline="true">
- <regexp pattern="@version"/>
- <substitution expression="${version}"/>
- <fileset dir="${basedir}/ivy">
- <include name="hadoop-core.xml"/>
- <include name="hadoop-core-test.xml"/>
- </fileset>
- </replaceregexp>
- </target>
- <!-- ================================================================== -->
- <!-- Perform audit activities for the release -->
- <!-- ================================================================== -->
- <target name="rats-taskdef" depends="ivy-retrieve-releaseaudit">
- <typedef format="xml" resource="org/apache/rat/anttasks/antlib.xml" uri="antlib:org.apache.rat.anttasks"
- classpathref="releaseaudit-classpath"/>
- </target>
- <target name="releaseaudit" depends="package, rats-taskdef" description="Release Audit activities">
- <rat:report xmlns:rat="antlib:org.apache.rat.anttasks">
- <fileset dir="${dist.dir}">
- <exclude name="**/CHANGES.txt"/>
- <exclude name="**/conf/*"/>
- <exclude name="**/docs/"/>
- <exclude name="lib/jdiff/"/>
- <exclude name="**/native/*"/>
- <exclude name="**/native/config/*"/>
- <exclude name="**/VERSION"/>
- <exclude name="**/*.json"/>
- <exclude name="**/hod/*.txt"/>
- </fileset>
- </rat:report>
- </target>
- <!-- ================================================================== -->
- <!-- Clean. Delete the build files, and their directories -->
- <!-- ================================================================== -->
- <target name="clean" depends="clean-contrib, clean-fi" description="Clean. Delete the build files, and their directories">
- <delete dir="${build.dir}"/>
- <delete file="${basedir}/ivy/hadoop-core.xml"/>
- <delete file="${basedir}/ivy/hadoop-core-test.xml"/>
- <delete dir="${docs.src}/build"/>
- <delete dir="${src.docs.cn}/build"/>
- </target>
- <target name="veryclean" depends="clean" description="Delete mvn ant task jar and ivy ant taks jar">
- <delete file="${ant_task.jar}"/>
- <delete file="${ivy.jar}"/>
- </target>
- <!-- ================================================================== -->
- <!-- Clean contrib target. For now, must be called explicitly -->
- <!-- Using subant instead of ant as a workaround for 30569 -->
- <!-- ================================================================== -->
- <target name="clean-contrib">
- <subant target="clean" inheritall="true">
- <fileset file="src/contrib/build.xml"/>
- </subant>
- </target>
-
- <target name="clover" depends="clover.setup, clover.info" description="Instrument the Unit tests using Clover.
- To use, specify -Dclover.home=<base of clover installation> -Drun.clover=true on the command line."/>
- <target name="clover.setup" if="clover.enabled">
- <taskdef resource="cloverlib.xml" classpath="${clover.jar}"/>
- <mkdir dir="${clover.db.dir}"/>
- <clover-setup initString="${clover.db.dir}/hadoop_coverage.db">
- <fileset dir="src" includes="java/**/*"/>
- </clover-setup>
- </target>
- <target name="clover.info" unless="clover.present">
- <echo>
- Clover not found. Code coverage reports disabled.
- </echo>
- </target>
- <target name="clover.check">
- <fail unless="clover.present">
- ##################################################################
- Clover not found.
- Please specify -Dclover.home=<base of clover installation>
- on the command line.
- ##################################################################
- </fail>
- </target>
- <target name="generate-clover-reports" depends="clover.check, clover">
- <mkdir dir="${clover.report.dir}"/>
- <clover-report>
- <current outfile="${clover.report.dir}" title="${final.name}">
- <format type="html"/>
- </current>
- </clover-report>
- <clover-report>
- <current outfile="${clover.report.dir}/clover.xml" title="${final.name}">
- <format type="xml"/>
- </current>
- </clover-report>
- </target>
- <target name="findbugs.check" depends="check-for-findbugs" unless="findbugs.present">
- <fail message="'findbugs.home' is not defined. Please pass -Dfindbugs.home=<base of Findbugs installation> to Ant on the command-line." />
- </target>
- <target name="patch.check" unless="patch.file">
- <fail message="'patch.file' is not defined. Please pass -Dpatch.file=<location of patch file> to Ant on the command-line." />
- </target>
- <target name="test-patch" depends="patch.check,findbugs.check,forrest.check">
- <exec executable="bash" failonerror="true">
- <arg value="${basedir}/src/test/bin/test-patch.sh"/>
- <arg value="DEVELOPER"/>
- <arg value="${patch.file}"/>
- <arg value="${scratch.dir}"/>
- <arg value="${svn.cmd}"/>
- <arg value="${grep.cmd}"/>
- <arg value="${patch.cmd}"/>
- <arg value="${findbugs.home}"/>
- <arg value="${forrest.home}"/>
- <arg value="${basedir}"/>
- <arg value="${java5.home}"/>
- </exec>
- </target>
- <target name="hudson-test-patch" depends="findbugs.check,forrest.check">
- <exec executable="bash" failonerror="true">
- <arg value="${basedir}/src/test/bin/test-patch.sh"/>
- <arg value="HUDSON"/>
- <arg value="${scratch.dir}"/>
- <arg value="${support.dir}"/>
- <arg value="${ps.cmd}"/>
- <arg value="${wget.cmd}"/>
- <arg value="${jiracli.cmd}"/>
- <arg value="${svn.cmd}"/>
- <arg value="${grep.cmd}"/>
- <arg value="${patch.cmd}"/>
- <arg value="${findbugs.home}"/>
- <arg value="${forrest.home}"/>
- <arg value="${eclipse.home}"/>
- <arg value="${python.home}"/>
- <arg value="${basedir}"/>
- <arg value="${trigger.url}"/>
- <arg value="${jira.passwd}"/>
- <arg value="${java5.home}"/>
- <arg value="${curl.cmd}"/>
- <arg value="${defect}"/>
- </exec>
- </target>
-
- <target name="eclipse-files" depends="init"
- description="Generate files for Eclipse">
- <pathconvert property="eclipse.project">
- <path path="${basedir}"/>
- <regexpmapper from="^.*/([^/]+)$$" to="\1" handledirsep="yes"/>
- </pathconvert>
- <copy todir="." overwrite="true">
- <fileset dir=".eclipse.templates">
- <exclude name="**/README.txt"/>
- </fileset>
- <filterset>
- <filter token="PROJECT" value="${eclipse.project}"/>
- </filterset>
- </copy>
- </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>
- <property name="ivyresolvelog" value="download-only"/>
- <property name="ivyretrievelog" value="quiet"/>
- <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'
- realm="Sonatype Nexus Repository Manager"/>
- </target>
- <target name="ivy-resolve" depends="ivy-init">
- <ivy:resolve settingsRef="${ant.project.name}.ivy.settings"
- log="${ivyresolvelog}"/>
- </target>
- <target name="ivy-resolve-javadoc" depends="ivy-init">
- <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="javadoc"
- log="${ivyresolvelog}"/>
- </target>
- <target name="ivy-resolve-releaseaudit" depends="ivy-init">
- <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="releaseaudit"
- log="${ivyresolvelog}"/>
- </target>
- <target name="ivy-resolve-test" depends="ivy-init">
- <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="test"
- log="${ivyresolvelog}"/>
- </target>
- <target name="ivy-resolve-common" depends="ivy-init">
- <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="common"
- log="${ivyresolvelog}"/>
- </target>
- <target name="ivy-resolve-jdiff" depends="ivy-init">
- <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="jdiff"
- log="${ivyresolvelog}"/>
- </target>
- <target name="ivy-resolve-checkstyle" depends="ivy-init">
- <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="checkstyle"
- log="${ivyresolvelog}"/>
- </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}"
- log="${ivyretrievelog}"/>
- </target>
- <target name="ivy-retrieve-checkstyle" depends="ivy-resolve-checkstyle"
- description="Retrieve Ivy-managed artifacts for the checkstyle configurations">
- <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
- pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}"
- log="${ivyretrievelog}"/>
- <ivy:cachepath pathid="checkstyle-classpath" conf="checkstyle"/>
- </target>
- <target name="ivy-retrieve-jdiff" depends="ivy-resolve-jdiff"
- description="Retrieve Ivy-managed artifacts for the jdiff configurations">
- <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
- pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}"
- log="${ivyretrievelog}"/>
- <ivy:cachepath pathid="jdiff-classpath" conf="jdiff"/>
- </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}"
- log="${ivyretrievelog}"/>
- <ivy:cachepath pathid="javadoc-classpath" conf="javadoc"/>
- </target>
- <target name="ivy-retrieve-test" depends="ivy-resolve-test"
- description="Retrieve Ivy-managed artifacts for the test configurations">
- <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings"
- pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}"
- log="${ivyretrievelog}"/>
- <ivy:cachepath pathid="ivy-test.classpath" conf="test"/>
- </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}"
- log="${ivyretrievelog}"/>
- <ivy:cachepath pathid="ivy-common.classpath" conf="common"/>
- </target>
- <target name="ivy-retrieve-releaseaudit" depends="ivy-resolve-releaseaudit"
- 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}"
- log="${ivyretrievelog}"/>
- <ivy:cachepath pathid="releaseaudit-classpath" conf="releaseaudit"/>
- </target>
- <target name="ivy-report" depends="ivy-resolve-releaseaudit"
- description="Generate">
- <ivy:report todir="${build.ivy.report.dir}" settingsRef="${ant.project.name}.ivy.settings"/>
- <echo>
- Reports generated:${build.ivy.report.dir}
- </echo>
- </target>
- </project>
|