-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.xml
121 lines (103 loc) · 4.53 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
<project name="lightweight_trie" default="dist" basedir=".">
<property name="version" value="0.1.0" />
<property environment="env" />
<property name="src" location="src" />
<property name="src.java" location="${src}/java" />
<property name="build" location="build" />
<property name="build.classes" location="${build}/classes" />
<property name="src.test" location="test" />
<property name="build.test" location="${build}/test" />
<property name="lib" location="lib" />
<property name="test.junit.output.format" value="plain"/>
<property name="test.timeout" value="2000000"/>
<property name="test.src.dir" location="${basedir}/test/java"/>
<property name="test.log.dir" value="${build.test}/log"/>
<property name="test.port" value="9090" />
<property name="jar.file" location="${build}/lightweight-${version}.jar" />
<property name="thrift.compiler" value="thrift" />
<fileset id="jars" dir="${lib}" includes="*.jar" />
<path id="compile.classpath">
<fileset id="jars" dir="${lib}" includes="*.jar" />
</path>
<target name="classpath">
<property name="cp" refid="test.run.classpath"/>
<echo message="Classpath: ${cp}"/>
</target>
<path id="test.classpath">
<path refid="compile.classpath" />
<pathelement location="${jar.file}" />
<pathelement location="${build.test}" />
</path>
<target name="clean" description="Trash all build outputs">
<delete dir="${build}" />
<delete dir="${build.test}" />
</target>
<target name="init">
<mkdir dir="${build}"/>
<mkdir dir="${build.classes}"/>
</target>
<target name="compile" depends="init">
<javac srcdir="${src.java}" destdir="${build.classes}" debug="true" classpathref="compile.classpath" />
</target>
<target name="init-test">
<mkdir dir="${build.test}" />
</target>
<target name="compile-test" depends="dist,init-test">
<javac debug="true" srcdir="${test.src.dir}" destdir="${build.test}" classpathref="test.classpath" />
</target>
<target name="test" depends="compile-test" description="Run the unit test suite">
<mkdir dir="${test.log.dir}"/>
<junit
printsummary="yes" showoutput="${test.output}"
haltonfailure="no" fork="once" maxmemory="512m"
errorProperty="tests.failed" failureProperty="tests.failed"
timeout="${test.timeout}"
>
<sysproperty key="build.test" value="${build.test}"/>
<sysproperty key="test.port" value="${test.port}" />
<classpath refid="test.classpath"/>
<formatter type="${test.junit.output.format}" />
<batchtest todir="${test.log.dir}" unless="testcase">
<fileset dir="${test.src.dir}" includes="**/Test*.java" />
</batchtest>
<batchtest todir="${test.log.dir}" if="testcase">
<fileset dir="${test.src.dir}" includes="**/${testcase}.java" />
</batchtest>
</junit>
<fail if="tests.failed">Tests failed!</fail>
</target>
<target name="debug-test" if="testcase" description="Run a single unit test specified via '-Dtestcase [testcase]', pausing for an external debugger to connect">
<fileset id="selected.test.case" dir="${test.src.dir}" includes="**/${testcase}.java" />
<pathconvert refid="selected.test.case" property="testcase.exists" setonempty="false" />
<fail unless="testcase.exists">Specified testcase was not found!</fail>
<property name="debug.port" value="3408"/>
<junit
printsummary="yes" showoutput="${test.output}"
haltonfailure="no" fork="yes" forkmode="once" maxmemory="512m"
errorProperty="tests.failed" failureProperty="tests.failed"
timeout="${test.timeout}"
>
<sysproperty key="build.test" value="${build.test}"/>
<!-- <jvmarg value="-Djava.library.path=${env.HADOOP_HOME}/lib/native/${build.platform}" /> -->
<classpath refid="test.classpath"/>
<formatter type="${test.junit.output.format}" />
<batchtest todir="${test.log.dir}" if="testcase">
<fileset dir="${test.src.dir}" includes="**/${testcase}.java" />
</batchtest>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,address=${debug.port},suspend=y"/>
</junit>
<fail if="tests.failed">Tests failed!</fail>
</target>
<target name="dist" depends="compile" description="Build a distributable jar">
<jar jarfile="${jar.file}">
<fileset dir="${build.classes}">
<include name="**/*.class" />
<!-- <include name="META-INF/*.txt" /> -->
</fileset>
<fileset dir="${src.java}">
<include name="**/*.java" />
</fileset>
</jar>
</target>
</project>