forked from stleary/JSON-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
161 lines (129 loc) · 5.31 KB
/
build.xml
File metadata and controls
161 lines (129 loc) · 5.31 KB
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
<?xml version="1.0" encoding="UTF-8"?>
<project name="JSON-java">
<property name="src.dir" value="src/main" />
<property name="src.java.dir" value="${src.dir}/java" />
<property name="test.dir" value="src/test" />
<property name="test.java.dir" value="${test.dir}/java" />
<property name="build.dir" value="build" />
<property name="build.classes.dir" value="${build.dir}/classes" />
<property name="dist.dir" value="dist" />
<property name="build.reports.dir" value="${build.dir}/reports" />
<property name="junit.reports.dir" value="${build.reports.dir}/junit" />
<property name="junit.reports.xml.dir" value="${junit.reports.dir}/xml" />
<property name="junit.reports.html.dir" value="${junit.reports.dir}/html" />
<property name="junit.test.pattern" value="**/*Test.java" />
<property name="cobertura.reports.dir" value="${build.reports.dir}/cobertura" />
<property name="cobertura.reports.xml.dir" value="${cobertura.reports.dir}/xml" />
<property name="cobertura.reports.html.dir" value="${cobertura.reports.dir}/html" />
<property name="lib.dir" value="lib" />
<property name="lib.test.dir" value="${lib.dir}/test" />
<property name="build.test.classes.dir" value="${build.dir}/test/classes" />
<property name="cobertura.instrumented.dir" value="${build.dir}/test/instrumented-classes" />
<target name="init">
<mkdir dir="${build.classes.dir}" />
<mkdir dir="${build.test.classes.dir}" />
<mkdir dir="${dist.dir}" />
<mkdir dir="${junit.reports.xml.dir}" />
<mkdir dir="${junit.reports.html.dir}" />
<mkdir dir="${cobertura.reports.xml.dir}" />
<mkdir dir="${cobertura.reports.html.dir}" />
</target>
<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
<target name="compile">
<javac srcdir="${src.java.dir}" destdir="${build.classes.dir}" debug="on" includeantruntime="false" source="1.6" target="1.6" />
</target>
<!--
Now for the compile classpaths
-->
<path id="test.compile.classpath">
<fileset dir="${lib.test.dir}" includes="**/*.jar" />
<pathelement path="${build.classes.dir}/" />
</path>
<!--
Now for the test classpath
-->
<path id="test.classpath">
<fileset dir="${lib.test.dir}" includes="**/*.jar" />
<fileset dir="${build.test.classes.dir}">
<include name="**/*.class" />
<include name="**/*.properties" />
</fileset>
</path>
<path id="cobertura.classpath">
<fileset dir="${lib.test.dir}" includes="**/*.jar" />
</path>
<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
<!--
Compile all of the test cases
-->
<target name="compile-test" depends="compile" description="[cobertura-build] Compile all of the test code sources">
<javac srcdir="${test.java.dir}" destdir="${build.test.classes.dir}" debug="on" includeantruntime="false">
<classpath path="${build.classes.dir}" />
<classpath refid="test.classpath" />
</javac>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.java.dir}">
<include name="**/*.properties" />
</fileset>
</copy>
</target>
<!--
-->
<target name="cobertura" depends="compile-test" description="[cobertura-build] Run the junit tests, compile the cobertura reports">
<delete file="cobertura.ser" />
<cobertura-instrument todir="${cobertura.instrumented.dir}">
<includeClasses regex=".*" />
<excludeClasses regex="org.apache.log4j.*" />
<excludeClasses regex=".*\.Test.*" />
<instrumentationClasspath>
<pathelement location="${build.classes.dir}" />
</instrumentationClasspath>
</cobertura-instrument>
<junit fork="yes" failureProperty="test.failed" printsummary="true" showoutput="true">
<!--
Specify the name of the coverage data file to use.
The value specified below is the default.
-->
<sysproperty key="net.sourceforge.cobertura.datafile" file="${basedir}/cobertura.ser" />
<!--
Note the classpath order: instrumented classes are before the
original (uninstrumented) classes. This is important.
-->
<classpath location="${cobertura.instrumented.dir}" />
<classpath location="${build.classes.dir}" />
<classpath location="${build.test.classes.dir}" />
<!--
The instrumented classes reference classes used by the
Cobertura runtime, so Cobertura and its dependencies
must be on your classpath.
-->
<classpath refid="cobertura.classpath" />
<formatter type="xml" />
<batchtest todir="${junit.reports.xml.dir}" unless="testcase">
<fileset dir="${test.java.dir}">
<include name="${junit.test.pattern}" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${junit.reports.xml.dir}" >
<fileset dir="${junit.reports.xml.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${junit.reports.html.dir}"/>
</junitreport>
<!-- Now generate the report -->
<cobertura-report format="html" destdir="${cobertura.reports.html.dir}" srcdir="${src.java.dir}" />
<cobertura-report format="xml" destdir="${cobertura.reports.xml.dir}" srcdir="${src.java.dir}" />
<fail if="${test.failed}" message="JUnit Tests Failed!!" />
</target>
<target name="dist" depends="clean,init,compile,cobertura" description="build the distributable jar file">
<jar destfile="dist/${ant.project.name}.jar">
<fileset dir="${build.classes.dir}">
<include name="**/*.*"/>
</fileset>
</jar>
</target>
</project>