| <?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. |
| --> |
| |
| <!-- Imported by contrib/*/build.xml files to share generic targets. --> |
| |
| <project name="hadoopbuildcontrib"> |
| |
| <property name="name" value="${ant.project.name}"/> |
| <property name="root" value="${basedir}"/> |
| |
| <!-- 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}/${name}.build.properties" /> |
| <property file="${root}/build.properties" /> |
| |
| <property name="hadoop.root" location="${root}/../../../"/> |
| |
| <property name="src.dir" location="${root}/src/java"/> |
| <property name="src.test" location="${root}/src/test"/> |
| <property name="src.examples" location="${root}/src/examples"/> |
| |
| <available file="${src.examples}" type="dir" property="examples.available"/> |
| <available file="${src.test}" type="dir" property="test.available"/> |
| |
| <property name="conf.dir" location="${hadoop.root}/conf"/> |
| <property name="test.junit.output.format" value="plain"/> |
| <property name="test.output" value="no"/> |
| <property name="test.timeout" value="900000"/> |
| <property name="build.dir" location="${hadoop.root}/build/contrib/${name}"/> |
| <property name="build.classes" location="${build.dir}/classes"/> |
| <property name="build.test" location="${build.dir}/test"/> |
| <property name="build.examples" location="${build.dir}/examples"/> |
| <property name="hadoop.log.dir" location="${build.dir}/test/logs"/> |
| <!-- all jars together --> |
| <property name="javac.deprecation" value="off"/> |
| <property name="javac.debug" value="on"/> |
| |
| <property name="javadoc.link" |
| value="http://java.sun.com/j2se/1.4/docs/api/"/> |
| |
| <property name="build.encoding" value="ISO-8859-1"/> |
| |
| <fileset id="lib.jars" dir="${root}" includes="lib/*.jar"/> |
| |
| <!-- the normal classpath --> |
| <path id="classpath"> |
| <pathelement location="${build.classes}"/> |
| <fileset refid="lib.jars"/> |
| <pathelement location="${hadoop.root}/build/classes"/> |
| <fileset dir="${hadoop.root}/lib"> |
| <include name="**/*.jar" /> |
| </fileset> |
| </path> |
| |
| <!-- the unit test classpath --> |
| <path id="test.classpath"> |
| <pathelement location="${build.test}" /> |
| <pathelement location="${hadoop.root}/build/test/classes"/> |
| <pathelement location="${hadoop.root}/src/contrib/test"/> |
| <pathelement location="${conf.dir}"/> |
| <pathelement location="${hadoop.root}/build"/> |
| <path refid="classpath"/> |
| </path> |
| |
| |
| <!-- to be overridden by sub-projects --> |
| <target name="check-contrib"/> |
| <target name="init-contrib"/> |
| |
| <!-- ====================================================== --> |
| <!-- Stuff needed by all targets --> |
| <!-- ====================================================== --> |
| <target name="init" depends="check-contrib" unless="skip.contrib"> |
| <echo message="contrib: ${name}"/> |
| <mkdir dir="${build.dir}"/> |
| <mkdir dir="${build.classes}"/> |
| <mkdir dir="${build.test}"/> |
| <mkdir dir="${build.examples}"/> |
| <mkdir dir="${hadoop.log.dir}"/> |
| <antcall target="init-contrib"/> |
| </target> |
| |
| |
| <!-- ====================================================== --> |
| <!-- Compile a Hadoop contrib's files --> |
| <!-- ====================================================== --> |
| <target name="compile" depends="init" unless="skip.contrib"> |
| <echo message="contrib: ${name}"/> |
| <javac |
| encoding="${build.encoding}" |
| srcdir="${src.dir}" |
| includes="**/*.java" |
| destdir="${build.classes}" |
| debug="${javac.debug}" |
| deprecation="${javac.deprecation}"> |
| <classpath refid="classpath"/> |
| </javac> |
| </target> |
| |
| |
| <!-- ======================================================= --> |
| <!-- Compile a Hadoop contrib's example files (if available) --> |
| <!-- ======================================================= --> |
| <target name="compile-examples" depends="compile" if="examples.available"> |
| <echo message="contrib: ${name}"/> |
| <javac |
| encoding="${build.encoding}" |
| srcdir="${src.examples}" |
| includes="**/*.java" |
| destdir="${build.examples}" |
| debug="${javac.debug}"> |
| <classpath refid="classpath"/> |
| </javac> |
| </target> |
| |
| |
| <!-- ================================================================== --> |
| <!-- Compile test code --> |
| <!-- ================================================================== --> |
| <target name="compile-test" depends="compile" if="test.available"> |
| <echo message="contrib: ${name}"/> |
| <javac |
| encoding="${build.encoding}" |
| srcdir="${src.test}" |
| includes="**/*.java" |
| destdir="${build.test}" |
| debug="${javac.debug}"> |
| <classpath refid="test.classpath"/> |
| </javac> |
| </target> |
| |
| |
| <!-- ====================================================== --> |
| <!-- Make a Hadoop contrib's jar --> |
| <!-- ====================================================== --> |
| <target name="jar" depends="compile" unless="skip.contrib"> |
| <echo message="contrib: ${name}"/> |
| <jar |
| jarfile="${build.dir}/hadoop-${version}-${name}.jar" |
| basedir="${build.classes}" |
| /> |
| </target> |
| |
| |
| <!-- ====================================================== --> |
| <!-- Make a Hadoop contrib's examples jar --> |
| <!-- ====================================================== --> |
| <target name="jar-examples" depends="compile-examples" |
| if="examples.available" unless="skip.contrib"> |
| <echo message="contrib: ${name}"/> |
| <jar jarfile="${build.dir}/hadoop-${version}-${name}-examples.jar"> |
| <fileset dir="${build.classes}"> |
| </fileset> |
| <fileset dir="${build.examples}"> |
| </fileset> |
| </jar> |
| </target> |
| |
| <!-- ====================================================== --> |
| <!-- Package a Hadoop contrib --> |
| <!-- ====================================================== --> |
| <target name="package" depends="jar, jar-examples" unless="skip.contrib"> |
| <mkdir dir="${dist.dir}/contrib/${name}"/> |
| <copy todir="${dist.dir}/contrib/${name}" includeEmptyDirs="false" flatten="true"> |
| <fileset dir="${build.dir}"> |
| <include name="hadoop-${version}-${name}.jar" /> |
| </fileset> |
| </copy> |
| </target> |
| |
| <!-- ================================================================== --> |
| <!-- Run unit tests --> |
| <!-- ================================================================== --> |
| <target name="test" depends="compile-test, compile, compile-examples" if="test.available"> |
| <echo message="contrib: ${name}"/> |
| <delete dir="${hadoop.log.dir}"/> |
| <mkdir dir="${hadoop.log.dir}"/> |
| <junit |
| printsummary="yes" showoutput="${test.output}" |
| haltonfailure="no" fork="yes" maxmemory="256m" |
| errorProperty="tests.failed" failureProperty="tests.failed" |
| timeout="${test.timeout}"> |
| |
| <sysproperty key="test.build.data" value="${build.test}/data"/> |
| <sysproperty key="build.test" value="${build.test}"/> |
| <sysproperty key="contrib.name" value="${name}"/> |
| |
| <!-- requires fork=yes for: |
| relative File paths to use the specified user.dir |
| classpath to use build/contrib/*.jar |
| --> |
| <sysproperty key="user.dir" value="${build.test}/data"/> |
| |
| <sysproperty key="fs.default.name" value="${fs.default.name}"/> |
| <sysproperty key="hadoop.test.localoutputfile" value="${hadoop.test.localoutputfile}"/> |
| <sysproperty key="hadoop.log.dir" value="${hadoop.log.dir}"/> |
| <classpath refid="test.classpath"/> |
| <formatter type="${test.junit.output.format}" /> |
| <batchtest todir="${build.test}" unless="testcase"> |
| <fileset dir="${src.test}" |
| includes="**/Test*.java" excludes="**/${test.exclude}.java" /> |
| </batchtest> |
| <batchtest todir="${build.test}" if="testcase"> |
| <fileset dir="${src.test}" includes="**/${testcase}.java"/> |
| </batchtest> |
| </junit> |
| <fail if="tests.failed">Tests failed!</fail> |
| |
| </target> |
| |
| |
| <!-- ================================================================== --> |
| <!-- Clean. Delete the build files, and their directories --> |
| <!-- ================================================================== --> |
| <target name="clean"> |
| <echo message="contrib: ${name}"/> |
| <delete dir="${build.dir}"/> |
| </target> |
| |
| </project> |