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 | <project name="failmon" default="compile"> |
---|
21 | |
---|
22 | <import file="../build-contrib.xml"/> |
---|
23 | |
---|
24 | <property name="jarfile" value="${build.dir}/${name}.jar"/> |
---|
25 | |
---|
26 | <target name="jar" depends="compile" unless="skip.contrib"> |
---|
27 | <!-- Make sure that the hadoop jar has been created --> |
---|
28 | <!-- This works, but causes findbugs to fail |
---|
29 | <subant antfile="build.xml" target="jar"> |
---|
30 | <fileset dir="../../.." includes="build.xml"/> |
---|
31 | </subant> |
---|
32 | --> |
---|
33 | <!-- Copy the required files so that the jar can run independently |
---|
34 | of Hadoop source code --> |
---|
35 | |
---|
36 | <!-- create the list of files to add to the classpath --> |
---|
37 | <fileset dir="${hadoop.root}/lib" id="class.path"> |
---|
38 | <include name="**/*.jar" /> |
---|
39 | <exclude name="**/excluded/" /> |
---|
40 | </fileset> |
---|
41 | |
---|
42 | <pathconvert pathsep=" " property="failmon-class-path" refid="class.path"> |
---|
43 | <map from="${basedir}/" to=""/> |
---|
44 | </pathconvert> |
---|
45 | |
---|
46 | <echo message="contrib: ${name}"/> |
---|
47 | <jar jarfile="${jarfile}" basedir="${build.classes}"> |
---|
48 | <manifest> |
---|
49 | <attribute name="Main-Class" value="org.apache.hadoop.contrib.failmon.RunOnce"/> |
---|
50 | <attribute name="Class-Path" value="${failmon-class-path}"/> |
---|
51 | </manifest> |
---|
52 | </jar> |
---|
53 | |
---|
54 | </target> |
---|
55 | |
---|
56 | |
---|
57 | <!-- Override test target to copy sample data --> |
---|
58 | <target name="test" depends="compile-test, compile, compile-examples" if="test.available"> |
---|
59 | <echo message="contrib: ${name}"/> |
---|
60 | <delete dir="${hadoop.log.dir}"/> |
---|
61 | <mkdir dir="${hadoop.log.dir}"/> |
---|
62 | <delete dir="${build.test}/sample"/> |
---|
63 | <mkdir dir="${build.test}/sample"/> |
---|
64 | <copy todir="${build.test}/sample"> |
---|
65 | <fileset dir="${root}/sample"/> |
---|
66 | </copy> |
---|
67 | <junit |
---|
68 | printsummary="yes" showoutput="${test.output}" |
---|
69 | haltonfailure="no" fork="yes" maxmemory="256m" |
---|
70 | errorProperty="tests.failed" failureProperty="tests.failed" |
---|
71 | timeout="${test.timeout}"> |
---|
72 | |
---|
73 | <sysproperty key="test.build.data" value="${build.test}/data"/> |
---|
74 | <sysproperty key="build.test" value="${build.test}"/> |
---|
75 | <sysproperty key="contrib.name" value="${name}"/> |
---|
76 | |
---|
77 | <!-- requires fork=yes for: |
---|
78 | relative File paths to use the specified user.dir |
---|
79 | classpath to use build/contrib/*.jar |
---|
80 | --> |
---|
81 | <sysproperty key="user.dir" value="${build.test}/data"/> |
---|
82 | |
---|
83 | <sysproperty key="fs.default.name" value="${fs.default.name}"/> |
---|
84 | <sysproperty key="hadoop.test.localoutputfile" value="${hadoop.test.localoutputfile}"/> |
---|
85 | <sysproperty key="hadoop.log.dir" value="${hadoop.log.dir}"/> |
---|
86 | <classpath refid="test.classpath"/> |
---|
87 | <formatter type="${test.junit.output.format}" /> |
---|
88 | <batchtest todir="${build.test}" unless="testcase"> |
---|
89 | <fileset dir="${src.test}" |
---|
90 | includes="**/Test*.java" excludes="**/${test.exclude}.java" /> |
---|
91 | </batchtest> |
---|
92 | <batchtest todir="${build.test}" if="testcase"> |
---|
93 | <fileset dir="${src.test}" includes="**/${testcase}.java"/> |
---|
94 | </batchtest> |
---|
95 | </junit> |
---|
96 | <fail if="tests.failed">Tests failed!</fail> |
---|
97 | |
---|
98 | </target> |
---|
99 | |
---|
100 | <target name="tar" depends="jar"> |
---|
101 | |
---|
102 | <copy todir="."> |
---|
103 | <fileset dir="${hadoop.root}/build/contrib/failmon/" |
---|
104 | includes="failmon.jar"/> |
---|
105 | </copy> |
---|
106 | |
---|
107 | <tar tarfile="${name}.tar" |
---|
108 | basedir=".." |
---|
109 | includes="${name}/**" |
---|
110 | excludes="${name}/${name}.tar.gz, ${name}/src/**, ${name}/logs/**, ${name}/build.xml*"/> |
---|
111 | <gzip zipfile="${name}.tar.gz" src="${name}.tar"/> |
---|
112 | <delete file="${name}.tar"/> |
---|
113 | <delete file="${name}.jar"/> |
---|
114 | |
---|
115 | <move file="${name}.tar.gz" todir="${build.dir}"/> |
---|
116 | <echo message= "${hadoop.root}/build/contrib/failmon/${name}.jar"/> |
---|
117 | |
---|
118 | </target> |
---|
119 | |
---|
120 | </project> |
---|