-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
81 lines (71 loc) · 2.88 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
<project name="LogAnalyzer" basedir="." default="main">
<property name="src.dir" value="src"/>
<property name="test.dir" value="test/"/>
<property name="build.dir" value="build"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<property name="main-class" value="net.moc.LogAnalyzer.LogAnalyzer"/>
<property name="lib.dir" value="lib"/>
<property name="hadoop.lib.dir" value="/opt/local/share/java/hadoop-0.20.203.0/" />
<property name="output.dir" value="output"/>
<path id="classpath">
<fileset dir="${hadoop.lib.dir}" includes="**/*.jar"></fileset>
<pathelement location="${lib.dir}/json_simple-1.1.jar" />
<pathelement location="${lib.dir}/UserAgentUtils-1.5.jar" />
<pathelement location="${lib.dir}/maxmindgeoip.jar" />
</path>
<path id="classpath.test">
<pathelement location="${lib.dir}/junit.jar" />
<pathelement location="${classes.dir}" />
<path refid="classpath" />
</path>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="compile">
<mkdir dir="${classes.dir}"/>
<javac includeantruntime="false" srcdir="${src.dir}" destdir="${classes.dir}" >
<classpath refid="classpath"/>
</javac>
</target>
<target name="compile-test" depends="compile">
<mkdir dir="${classes.dir}"/>
<javac includeantruntime="false" srcdir="${test.dir}" destdir="${classes.dir}" >
<classpath refid="classpath.test"/>
</javac>
</target>
<target name="test" depends="compile-test">
<junit>
<classpath refid="classpath.test" />
<formatter type="brief" usefile="false" />
<test name="net.moc.LogAnalyzer.ApachCombinedRegexLogEntryTest" />
<test name="net.moc.LogAnalyzer.ApacheCombinedLogEntryFactoryTest" />
<test name="net.moc.LogAnalyzer.LogEntryCountTest" />
</junit>
</target>
<target name="jar" depends="compile">
<mkdir dir="${classes.dir}/res"/>
<copy file="res/GeoIP.dat" todir="${classes.dir}/res"/>
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
<zipgroupfileset dir="${lib.dir}" includes="*.jar,*.dat" />
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
</jar>
</target>
<target name="run" depends="jar">
<delete dir="${output.dir}"/>
<java jar="${jar.dir}/${ant.project.name}.jar" fork="true">
<arg value="browser"/>
<arg value="res/access-sample.log"/>
<arg value="output"/>
<classpath>
<path refid="classpath"/>
<path location="${jar.dir}/${ant.project.name}.jar"/>
</classpath>
</java>
</target>
<target name="clean-build" depends="clean,jar"/>
<target name="main" depends="clean,run"/>
</project>