forked from commoncrawl/commoncrawl-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
132 lines (120 loc) · 4.11 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<project name="Common Crawl Examples" default="dist" basedir=".">
<description>
Common Crawl Examples Build File
</description>
<!-- set global properties for this build -->
<property name="name" value="commoncrawl-examples" />
<loadfile srcfile="${basedir}/VERSION" property="version">
<filterchain>
<striplinebreaks />
</filterchain>
</loadfile>
<!-- include any user specific or environment specifc build properties -->
<property file="${user.home}/build.properties"/>
<property file="${basedir}/build.properties"/>
<!-- ensure that 'hadoop.path' is set -->
<fail message="Please define the 'hadoop.path' and 'pig.path' properties in the 'build.properties' file">
<condition>
<or>
<not>
<isset property="hadoop.path"/>
</not>
<not>
<isset property="pig.path"/>
</not>
</or>
</condition>
</fail>
<property name="lib" location="lib" />
<property name="src" location="src/java" />
<property name="build" location="build"/>
<property name="dist" location="dist" />
<property name="test" location="test" />
<target name="init">
<tstamp/>
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init"
description="compile the source" >
<echo message=""/>
<echo message="Building '${name}': Version ${version}"/>
<echo message=""/>
<javac srcdir="${src}" destdir="${build}" debug="on" debuglevel="lines,vars,source" target="1.6">
<compilerarg value="-Xlint"/>
<classpath>
<pathelement path="${classpath}"/>
<fileset dir="${hadoop.path}">
<include name="**/commons-logging-*.jar"/>
<include name="**/hadoop-core-*.jar"/>
<include name="**/log4j-*.jar"/>
<include name="**/junit-*.jar"/>
<include name="**/commons-io-*.jar"/>
</fileset>
<fileset dir="${pig.path}">
<include name="**/pig-*withouthadoop.jar"/>
</fileset>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<mkdir dir="${dist}/lib"/>
<mkdir dir="${build}/lib"/>
<jar jarfile="${dist}/lib/${name}-${version}.jar" basedir="${build}">
<zipfileset dir="lib" prefix="lib" >
<include name="**/*.jar" />
</zipfileset>
</jar>
</target>
<target name="compile-tests" depends="dist"
description="compile test cases" >
<mkdir dir="${build}-test"/>
<javac srcdir="${test}" destdir="${build}-test" debug="on" debuglevel="lines,vars,source" target="1.6">
<compilerarg value="-Xlint"/>
<classpath>
<pathelement path="${classpath}"/>
<pathelement path="/usr/share/java/junit.jar"/>
<fileset dir="${hadoop.path}">
<include name="**/hadoop-core-*.jar"/>
<include name="**/log4j-*.jar"/>
</fileset>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
<pathelement path="${dist}/lib/${name}-${version}.jar"/>
</classpath>
</javac>
</target>
<target name="test" depends="compile-tests"
description="run Junit test cases" >
<junit printsummary="true">
<classpath>
<pathelement path="${classpath}"/>
<pathelement path="/usr/share/java/junit.jar"/>
<fileset dir="${hadoop.path}">
<include name="**/hadoop-core-*.jar"/>
<include name="**/log4j-*.jar"/>
</fileset>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
<pathelement path="${dist}/lib/${name}-${version}.jar"/>
<pathelement path="${build}-test"/>
</classpath>
<batchtest>
<fileset dir="${build}-test"/>
<formatter type="plain" usefile="false"/>
</batchtest>
</junit>
</target>
<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${build}-test"/>
<delete dir="${dist}"/>
</target>
</project>