[120] | 1 | <?xml version="1.0"?> |
---|
| 2 | |
---|
| 3 | <!-- |
---|
| 4 | Licensed to the Apache Software Foundation (ASF) under one or more |
---|
| 5 | contributor license agreements. See the NOTICE file distributed with |
---|
| 6 | this work for additional information regarding copyright ownership. |
---|
| 7 | The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
| 8 | (the "License"); you may not use this file except in compliance with |
---|
| 9 | the License. You may obtain a copy of the License at |
---|
| 10 | |
---|
| 11 | http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 12 | |
---|
| 13 | Unless required by applicable law or agreed to in writing, software |
---|
| 14 | distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 16 | See the License for the specific language governing permissions and |
---|
| 17 | limitations under the License. |
---|
| 18 | --> |
---|
| 19 | |
---|
| 20 | <!-- Imported by contrib/*/build.xml files to share generic targets. --> |
---|
| 21 | |
---|
| 22 | <project name="hadoopbuildcontrib" xmlns:ivy="antlib:org.apache.ivy.ant"> |
---|
| 23 | |
---|
| 24 | <property name="name" value="${ant.project.name}"/> |
---|
| 25 | <property name="root" value="${basedir}"/> |
---|
| 26 | |
---|
| 27 | <!-- Load all the default properties, and any the user wants --> |
---|
| 28 | <!-- to contribute (without having to type -D or edit this file --> |
---|
| 29 | <property file="${user.home}/${name}.build.properties" /> |
---|
| 30 | <property file="${root}/build.properties" /> |
---|
| 31 | |
---|
| 32 | <property name="hadoop.root" location="${root}/../../../"/> |
---|
| 33 | <property name="src.dir" location="${root}/src/java"/> |
---|
| 34 | <property name="src.test" location="${root}/src/test"/> |
---|
| 35 | <property name="src.examples" location="${root}/src/examples"/> |
---|
| 36 | |
---|
| 37 | <available file="${src.examples}" type="dir" property="examples.available"/> |
---|
| 38 | <available file="${src.test}" type="dir" property="test.available"/> |
---|
| 39 | |
---|
| 40 | <property name="conf.dir" location="${hadoop.root}/conf"/> |
---|
| 41 | <property name="test.junit.output.format" value="plain"/> |
---|
| 42 | <property name="test.output" value="no"/> |
---|
| 43 | <property name="test.timeout" value="900000"/> |
---|
| 44 | <property name="build.dir" location="${hadoop.root}/build/contrib/${name}"/> |
---|
| 45 | <property name="build.classes" location="${build.dir}/classes"/> |
---|
| 46 | <property name="build.test" location="${build.dir}/test"/> |
---|
| 47 | <property name="build.examples" location="${build.dir}/examples"/> |
---|
| 48 | <property name="hadoop.log.dir" location="${build.dir}/test/logs"/> |
---|
| 49 | <!-- all jars together --> |
---|
| 50 | <property name="javac.deprecation" value="off"/> |
---|
| 51 | <property name="javac.debug" value="on"/> |
---|
| 52 | <property name="build.ivy.lib.dir" value="${hadoop.root}/build/ivy/lib"/> |
---|
| 53 | |
---|
| 54 | <property name="javadoc.link" |
---|
| 55 | value="http://java.sun.com/j2se/1.4/docs/api/"/> |
---|
| 56 | |
---|
| 57 | <property name="build.encoding" value="ISO-8859-1"/> |
---|
| 58 | |
---|
| 59 | <fileset id="lib.jars" dir="${root}" includes="lib/*.jar"/> |
---|
| 60 | |
---|
| 61 | |
---|
| 62 | <!-- IVY properties set here --> |
---|
| 63 | <property name="ivy.dir" location="ivy" /> |
---|
| 64 | <property name="ivysettings.xml" location="${hadoop.root}/ivy/ivysettings.xml"/> |
---|
| 65 | <loadproperties srcfile="${ivy.dir}/libraries.properties"/> |
---|
| 66 | <loadproperties srcfile="${hadoop.root}/ivy/libraries.properties"/> |
---|
| 67 | <property name="ivy.jar" location="${hadoop.root}/ivy/ivy-${ivy.version}.jar"/> |
---|
| 68 | <property name="ivy_repo_url" |
---|
| 69 | value="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar" /> |
---|
| 70 | <property name="build.dir" location="build" /> |
---|
| 71 | <property name="build.ivy.dir" location="${build.dir}/ivy" /> |
---|
| 72 | <property name="build.ivy.lib.dir" location="${build.ivy.dir}/lib" /> |
---|
| 73 | <property name="build.ivy.report.dir" location="${build.ivy.dir}/report" /> |
---|
| 74 | <property name="common.ivy.lib.dir" location="${build.ivy.lib.dir}/${ant.project.name}/common"/> |
---|
| 75 | |
---|
| 76 | <!--this is the naming policy for artifacts we want pulled down--> |
---|
| 77 | <property name="ivy.artifact.retrieve.pattern" |
---|
| 78 | value="${ant.project.name}/[conf]/[artifact]-[revision].[ext]"/> |
---|
| 79 | |
---|
| 80 | <!-- the normal classpath --> |
---|
| 81 | <path id="contrib-classpath"> |
---|
| 82 | <pathelement location="${build.classes}"/> |
---|
| 83 | <fileset refid="lib.jars"/> |
---|
| 84 | <pathelement location="${hadoop.root}/build/classes"/> |
---|
| 85 | <fileset dir="${hadoop.root}/lib"> |
---|
| 86 | <include name="**/*.jar" /> |
---|
| 87 | </fileset> |
---|
| 88 | <path refid="${ant.project.name}.common-classpath"/> |
---|
| 89 | </path> |
---|
| 90 | |
---|
| 91 | <!-- the unit test classpath --> |
---|
| 92 | <path id="test.classpath"> |
---|
| 93 | <pathelement location="${build.test}" /> |
---|
| 94 | <pathelement location="${hadoop.root}/build/test/classes"/> |
---|
| 95 | <pathelement location="${hadoop.root}/src/contrib/test"/> |
---|
| 96 | <pathelement location="${conf.dir}"/> |
---|
| 97 | <pathelement location="${hadoop.root}/build"/> |
---|
| 98 | <pathelement location="${build.examples}"/> |
---|
| 99 | <path refid="contrib-classpath"/> |
---|
| 100 | </path> |
---|
| 101 | |
---|
| 102 | |
---|
| 103 | <!-- to be overridden by sub-projects --> |
---|
| 104 | <target name="check-contrib"/> |
---|
| 105 | <target name="init-contrib"/> |
---|
| 106 | |
---|
| 107 | <!-- ====================================================== --> |
---|
| 108 | <!-- Stuff needed by all targets --> |
---|
| 109 | <!-- ====================================================== --> |
---|
| 110 | <target name="init" depends="check-contrib" unless="skip.contrib"> |
---|
| 111 | <echo message="contrib: ${name}"/> |
---|
| 112 | <mkdir dir="${build.dir}"/> |
---|
| 113 | <mkdir dir="${build.classes}"/> |
---|
| 114 | <mkdir dir="${build.test}"/> |
---|
| 115 | <mkdir dir="${build.examples}"/> |
---|
| 116 | <mkdir dir="${hadoop.log.dir}"/> |
---|
| 117 | <antcall target="init-contrib"/> |
---|
| 118 | </target> |
---|
| 119 | |
---|
| 120 | |
---|
| 121 | <!-- ====================================================== --> |
---|
| 122 | <!-- Compile a Hadoop contrib's files --> |
---|
| 123 | <!-- ====================================================== --> |
---|
| 124 | <target name="compile" depends="init, ivy-retrieve-common" unless="skip.contrib"> |
---|
| 125 | <echo message="contrib: ${name}"/> |
---|
| 126 | <javac |
---|
| 127 | encoding="${build.encoding}" |
---|
| 128 | srcdir="${src.dir}" |
---|
| 129 | includes="**/*.java" |
---|
| 130 | destdir="${build.classes}" |
---|
| 131 | debug="${javac.debug}" |
---|
| 132 | deprecation="${javac.deprecation}"> |
---|
| 133 | <classpath refid="contrib-classpath"/> |
---|
| 134 | </javac> |
---|
| 135 | </target> |
---|
| 136 | |
---|
| 137 | |
---|
| 138 | <!-- ======================================================= --> |
---|
| 139 | <!-- Compile a Hadoop contrib's example files (if available) --> |
---|
| 140 | <!-- ======================================================= --> |
---|
| 141 | <target name="compile-examples" depends="compile" if="examples.available"> |
---|
| 142 | <echo message="contrib: ${name}"/> |
---|
| 143 | <javac |
---|
| 144 | encoding="${build.encoding}" |
---|
| 145 | srcdir="${src.examples}" |
---|
| 146 | includes="**/*.java" |
---|
| 147 | destdir="${build.examples}" |
---|
| 148 | debug="${javac.debug}"> |
---|
| 149 | <classpath refid="contrib-classpath"/> |
---|
| 150 | </javac> |
---|
| 151 | </target> |
---|
| 152 | |
---|
| 153 | |
---|
| 154 | <!-- ================================================================== --> |
---|
| 155 | <!-- Compile test code --> |
---|
| 156 | <!-- ================================================================== --> |
---|
| 157 | <target name="compile-test" depends="compile-examples" if="test.available"> |
---|
| 158 | <echo message="contrib: ${name}"/> |
---|
| 159 | <javac |
---|
| 160 | encoding="${build.encoding}" |
---|
| 161 | srcdir="${src.test}" |
---|
| 162 | includes="**/*.java" |
---|
| 163 | destdir="${build.test}" |
---|
| 164 | debug="${javac.debug}"> |
---|
| 165 | <classpath refid="test.classpath"/> |
---|
| 166 | </javac> |
---|
| 167 | </target> |
---|
| 168 | |
---|
| 169 | |
---|
| 170 | <!-- ====================================================== --> |
---|
| 171 | <!-- Make a Hadoop contrib's jar --> |
---|
| 172 | <!-- ====================================================== --> |
---|
| 173 | <target name="jar" depends="compile" unless="skip.contrib"> |
---|
| 174 | <echo message="contrib: ${name}"/> |
---|
| 175 | <jar |
---|
| 176 | jarfile="${build.dir}/hadoop-${version}-${name}.jar" |
---|
| 177 | basedir="${build.classes}" |
---|
| 178 | /> |
---|
| 179 | </target> |
---|
| 180 | |
---|
| 181 | |
---|
| 182 | <!-- ====================================================== --> |
---|
| 183 | <!-- Make a Hadoop contrib's examples jar --> |
---|
| 184 | <!-- ====================================================== --> |
---|
| 185 | <target name="jar-examples" depends="compile-examples" |
---|
| 186 | if="examples.available" unless="skip.contrib"> |
---|
| 187 | <echo message="contrib: ${name}"/> |
---|
| 188 | <jar jarfile="${build.dir}/hadoop-${version}-${name}-examples.jar"> |
---|
| 189 | <fileset dir="${build.classes}"> |
---|
| 190 | </fileset> |
---|
| 191 | <fileset dir="${build.examples}"> |
---|
| 192 | </fileset> |
---|
| 193 | </jar> |
---|
| 194 | </target> |
---|
| 195 | |
---|
| 196 | <!-- ====================================================== --> |
---|
| 197 | <!-- Package a Hadoop contrib --> |
---|
| 198 | <!-- ====================================================== --> |
---|
| 199 | <target name="package" depends="jar, jar-examples" unless="skip.contrib"> |
---|
| 200 | <mkdir dir="${dist.dir}/contrib/${name}"/> |
---|
| 201 | <copy todir="${dist.dir}/contrib/${name}" includeEmptyDirs="false" flatten="true"> |
---|
| 202 | <fileset dir="${build.dir}"> |
---|
| 203 | <include name="hadoop-${version}-${name}.jar" /> |
---|
| 204 | </fileset> |
---|
| 205 | </copy> |
---|
| 206 | </target> |
---|
| 207 | |
---|
| 208 | <!-- ================================================================== --> |
---|
| 209 | <!-- Run unit tests --> |
---|
| 210 | <!-- ================================================================== --> |
---|
| 211 | <target name="test" depends="compile-test, compile" if="test.available"> |
---|
| 212 | <echo message="contrib: ${name}"/> |
---|
| 213 | <delete dir="${hadoop.log.dir}"/> |
---|
| 214 | <mkdir dir="${hadoop.log.dir}"/> |
---|
| 215 | <junit |
---|
| 216 | printsummary="yes" showoutput="${test.output}" |
---|
| 217 | haltonfailure="no" fork="yes" maxmemory="256m" |
---|
| 218 | errorProperty="tests.failed" failureProperty="tests.failed" |
---|
| 219 | timeout="${test.timeout}"> |
---|
| 220 | |
---|
| 221 | <sysproperty key="test.build.data" value="${build.test}/data"/> |
---|
| 222 | <sysproperty key="build.test" value="${build.test}"/> |
---|
| 223 | <sysproperty key="contrib.name" value="${name}"/> |
---|
| 224 | |
---|
| 225 | <!-- requires fork=yes for: |
---|
| 226 | relative File paths to use the specified user.dir |
---|
| 227 | classpath to use build/contrib/*.jar |
---|
| 228 | --> |
---|
| 229 | <sysproperty key="user.dir" value="${build.test}/data"/> |
---|
| 230 | |
---|
| 231 | <sysproperty key="fs.default.name" value="${fs.default.name}"/> |
---|
| 232 | <sysproperty key="hadoop.test.localoutputfile" value="${hadoop.test.localoutputfile}"/> |
---|
| 233 | <sysproperty key="hadoop.log.dir" value="${hadoop.log.dir}"/> |
---|
| 234 | <classpath refid="test.classpath"/> |
---|
| 235 | <formatter type="${test.junit.output.format}" /> |
---|
| 236 | <batchtest todir="${build.test}" unless="testcase"> |
---|
| 237 | <fileset dir="${src.test}" |
---|
| 238 | includes="**/Test*.java" excludes="**/${test.exclude}.java" /> |
---|
| 239 | </batchtest> |
---|
| 240 | <batchtest todir="${build.test}" if="testcase"> |
---|
| 241 | <fileset dir="${src.test}" includes="**/${testcase}.java"/> |
---|
| 242 | </batchtest> |
---|
| 243 | </junit> |
---|
| 244 | <fail if="tests.failed">Tests failed!</fail> |
---|
| 245 | </target> |
---|
| 246 | |
---|
| 247 | <!-- ================================================================== --> |
---|
| 248 | <!-- Clean. Delete the build files, and their directories --> |
---|
| 249 | <!-- ================================================================== --> |
---|
| 250 | <target name="clean"> |
---|
| 251 | <echo message="contrib: ${name}"/> |
---|
| 252 | <delete dir="${build.dir}"/> |
---|
| 253 | </target> |
---|
| 254 | |
---|
| 255 | <target name="ivy-probe-antlib" > |
---|
| 256 | <condition property="ivy.found"> |
---|
| 257 | <typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/> |
---|
| 258 | </condition> |
---|
| 259 | </target> |
---|
| 260 | |
---|
| 261 | |
---|
| 262 | <target name="ivy-download" description="To download ivy " unless="offline"> |
---|
| 263 | <get src="${ivy_repo_url}" dest="${ivy.jar}" usetimestamp="true"/> |
---|
| 264 | </target> |
---|
| 265 | |
---|
| 266 | <target name="ivy-init-antlib" depends="ivy-download,ivy-probe-antlib" unless="ivy.found"> |
---|
| 267 | <typedef uri="antlib:org.apache.ivy.ant" onerror="fail" |
---|
| 268 | loaderRef="ivyLoader"> |
---|
| 269 | <classpath> |
---|
| 270 | <pathelement location="${ivy.jar}"/> |
---|
| 271 | </classpath> |
---|
| 272 | </typedef> |
---|
| 273 | <fail > |
---|
| 274 | <condition > |
---|
| 275 | <not> |
---|
| 276 | <typefound uri="antlib:org.apache.ivy.ant" name="cleancache"/> |
---|
| 277 | </not> |
---|
| 278 | </condition> |
---|
| 279 | You need Apache Ivy 2.0 or later from http://ant.apache.org/ |
---|
| 280 | It could not be loaded from ${ivy_repo_url} |
---|
| 281 | </fail> |
---|
| 282 | </target> |
---|
| 283 | |
---|
| 284 | <target name="ivy-init" depends="ivy-init-antlib"> |
---|
| 285 | <ivy:configure settingsid="${ant.project.name}.ivy.settings" file="${ivysettings.xml}"/> |
---|
| 286 | </target> |
---|
| 287 | |
---|
| 288 | <target name="ivy-resolve-common" depends="ivy-init"> |
---|
| 289 | <ivy:resolve settingsRef="${ant.project.name}.ivy.settings" conf="common" /> |
---|
| 290 | </target> |
---|
| 291 | |
---|
| 292 | <target name="ivy-retrieve-common" depends="ivy-resolve-common" |
---|
| 293 | description="Retrieve Ivy-managed artifacts for the compile/test configurations"> |
---|
| 294 | <ivy:retrieve settingsRef="${ant.project.name}.ivy.settings" |
---|
| 295 | pattern="${build.ivy.lib.dir}/${ivy.artifact.retrieve.pattern}" sync="true" /> |
---|
| 296 | <ivy:cachepath pathid="${ant.project.name}.common-classpath" conf="common" /> |
---|
| 297 | </target> |
---|
| 298 | </project> |
---|