-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.xml
163 lines (149 loc) · 5.16 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<project name="libzen" default="jar">
<!-- directory / file definition -->
<property name="BinaryName" value="libzen" />
<property name="source_dir" value="src" />
<property name="build_dir" value="build" />
<property name="root_dir" value="." />
<property name="jline_jar" value="ext/jline-1.0.jar" />
<property name="lib.cobertura.dir" location="/opt/java/cobertura" />
<property name="lib.pmd.dir" location="/opt/java/pmd" />
<condition property="have.cobertura">
<available file="${lib.cobertura.dir}" />
</condition>
<condition property="have.pmd">
<available file="${lib.pmd.dir}" />
</condition>
<!-- ================================== -->
<!-- BUILD -->
<!-- ================================== -->
<target name="build">
<mkdir dir="${build_dir}" />
<javac srcdir="${source_dir}" destdir="${build_dir}" target="1.7" source="1.7"
debug="yes" debuglevel="lines,vars,source" includeantruntime="false">
<classpath path="ext/asm-all-4.0.jar" />
<classpath path="${jline_jar}" />
<include name="**/*.java" />
<exclude name="**/*Test.java" />
<compilerarg value="-Xlint:deprecation" />
<compilerarg value="-Xlint:unchecked" />
</javac>
</target>
<!-- ================================== -->
<!-- GENERATE JAR -->
<!-- ================================== -->
<target name="jar" depends="build">
<jar jarfile="${BinaryName}.jar">
<fileset dir="${build_dir}" includes="**/*.class" />
<fileset dir="." includes="lib/**/*.zen" />
<exclude name="**/*Test.class" />
<manifest>
<attribute name="Main-Class" value="zen.main.ZenMain" />
</manifest>
<zipfileset src="ext/asm-all-4.0.jar" />
<zipfileset src="${jline_jar}" />
</jar>
</target>
<!-- ================================== -->
<!-- CLEAN -->
<!-- ================================== -->
<target name="clean">
<delete>
<fileset dir="${build_dir}" includes="**/*.class"/>
</delete>
<delete file="${BinaryName}.jar" />
</target>
<!-- ================================== -->
<!-- TEST -->
<!-- ================================== -->
<target name="pre-test" depends="build">
<javac srcdir="${source_dir}" destdir="${build_dir}" target="1.7" source="1.7"
debug="yes" debuglevel="lines,vars,source" includeantruntime="false">
<classpath path="ext/asm-all-4.0.jar" />
<classpath path="ext/junit-4.10.jar" />
<classpath path="${jline_jar}" />
<include name="**/*Test.java" />
</javac>
</target>
<target name="pre-coverage" depends="pre-test" if="have.cobertura">
<property name="run_coverage" location="true" />
<delete file="cobertura.ser" />
<path id="cobertura.classpath">
<fileset dir="${lib.cobertura.dir}">
<include name="*.jar"/>
</fileset>
</path>
<taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
<cobertura-instrument todir="${build_dir}/instrumented">
<fileset dir="${build_dir}" includes="**/*.class" />
</cobertura-instrument>
</target>
<target name="run-test1" if="run_coverage">
<mkdir dir="${build_dir}/test-reports" />
<junit fork="yes" forkmode="once">
<classpath location="${build_dir}/instrumented"/>
<classpath location="${build_dir}"/>
<classpath>
<fileset dir="${lib.cobertura.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="ext">
<include name="**/*.jar" />
</fileset>
</classpath>
<batchtest todir="${build_dir}/test-reports">
<fileset dir="${build_dir}/instrumented">
<include name="**/*Test*" />
</fileset>
</batchtest>
<formatter type="xml" usefile="true" />
</junit>
</target>
<target name="run-test2" unless="run_coverage">
<mkdir dir="${build_dir}/test-reports" />
<junit fork="yes" forkmode="once">
<classpath location="${build_dir}"/>
<classpath>
<fileset dir="ext">
<include name="**/*.jar" />
</fileset>
</classpath>
<batchtest todir="${build_dir}/test-reports">
<fileset dir="${build_dir}">
<include name="**/*Test*" />
</fileset>
</batchtest>
<formatter type="xml" usefile="true" />
</junit>
</target>
<target name="post-coverage" if="run_coverage">
<cobertura-report destdir="build/coverage" format="xml">
<fileset dir="${source_dir}" includes="**/*.java"/>
</cobertura-report>
</target>
<target name="test" depends="pre-coverage, run-test1, run-test2, post-coverage">
</target>
<!-- ================================== -->
<!-- PMD -->
<!-- ================================== -->
<path id="pmd.classpath">
<fileset dir="${lib.pmd.dir}">
<include name="*.jar"/>
</fileset>
</path>
<target name="pmd" depends="build">
<taskdef classpathref="pmd.classpath" name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
<pmd shortFilenames="true">
<sourceLanguage name="java" version="1.7"/>
<ruleset>java-basic</ruleset>
<ruleset>java-imports</ruleset>
<ruleset>java-strings</ruleset>
<formatter type="xml" toFile="${build_dir}/pmd.xml" />
<!--
<formatter type="text" toConsole="true" />
//-->
<fileset dir="${source_dir}">
<include name="**/*.java" />
</fileset>
</pmd>
</target>
</project>