-
Notifications
You must be signed in to change notification settings - Fork 26
/
build.xml
164 lines (142 loc) · 4.99 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
164
<?xml version="1.0" encoding="UTF-8"?>
<project name="tigase-server" default="jar" basedir=".">
<property file="build.properties"/>
<import file="ant-definitions.xml"/>
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<!-- <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/> -->
<!-- Global properties for this build -->
<property name="cvs-package" value="${projectname}"/>
<target name="prepare" description="Prepare build structures">
<tstamp/>
</target>
<target name="prepare-dist" description="Calculate build version">
<!-- Get revision number -->
<exec executable="svnversion">
<redirector outputproperty="build-no" errorproperty="error-property">
<outputfilterchain>
<tokenfilter>
<containsregex
pattern="[^0-9]*([0-9]+).*" replace="\1"/>
</tokenfilter>
</outputfilterchain>
</redirector>
</exec>
<property name="version" value="${ver}-b${build-no}"/>
<property name="dist" value="dist/${projectname}-${jarfile}-${version}"/>
</target>
<target name="prepare-dev" description="Create development version">
<!-- Get revision number -->
<property name="build-no" value="DEV"/>
<property name="version" value="${ver}-b${build-no}"/>
<property name="dist" value="dist/${projectname}-${jarfile}-${version}"/>
</target>
<target name="jar-file" description="Create jar file, called from other targets">
<compile srcdir="${src}" xlint="-Xlint:all,-path"/>
<jarfile
filename="${projectname}-${jarfile}"
excludes="**/*TestCase*.*,TestAll.*"/>
</target>
<target name="jar" depends="prepare,prepare-dev,jar-file"
description="Build jar file for ${projectname} ${jarfile}">
</target>
<target name="jar-dist" depends="prepare,prepare-dist,jar-file"
description="Build jar file for ${projectname} ${jarfile}">
</target>
<target name="jar-unittests" depends="prepare"
description="Prepare jar file with all classes including unittests classes">
<delete dir="${build}"/>
<compile
srcdir="${src}:${unittests}"
deprecation="on"
xlint="-Xlint:all"/>
<jarfile filename="unittests-${projectname}-${jarfile}"/>
<unitgen input="${src}" output="${unittests}" update="true">
<classpath>
<pathelement location="${jars}/unittests-${projectname}-${jarfile}.jar"/>
<fileset dir="${libs}">
<include name="**/*.jar"/>
</fileset>
</classpath>
</unitgen>
</target>
<target name="jar-all" depends="clean,prepare,jar,jar-unittests"
description="Builds all jar for the project.">
</target>
<target name="docs" depends="prepare"
description="Make Server javadoc">
<docs packages="${javadoc-package}"
destdir="docs"/>
</target>
<target name="dist"
depends="clean-all,prepare-dist,jar-dist,docs"
description="Create ${projectname} ${jarfile} binary distribution file">
<distbin packagename="${projectname}-${jarfile}"
docsdir="docs"/>
</target>
<target name="dist-src" depends="prepare,prepare-dist"
description="Create distribution package with all source files">
<distsrc packagename="${projectname}-${jarfile}" cvsroot="${svnroot}"
cvspackage="${cvspackage}"/>
</target>
<target name="dist-deb" depends="prepare,prepare-dist"
description="Create Debian package">
<distdeb version="${ver}" build="${build-no}" cvsroot="${svnroot}" />
</target>
<target name="pmd">
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
<pmd shortFilenames="true" targetjdk="1.5">
<ruleset>unusedcode</ruleset>
<ruleset>basic</ruleset>
<ruleset>design</ruleset>
<ruleset>logging-java</ruleset>
<ruleset>naming</ruleset>
<ruleset>optimizations</ruleset>
<ruleset>strings</ruleset>
<ruleset>sunsecure</ruleset>
<formatter type="html" toFile="pmd_report.html"/>
<fileset dir="${src}">
<include name="**/*.java"/>
</fileset>
</pmd>
</target>
<target name="run-unittests" depends="prepare,jar-unittests"
description="Run all JUnit tests for built package">
<mkdir dir="${reports}"/>
<junit printsummary="yes" haltonfailure="no">
<classpath>
<pathelement location="${jars}/unittests-${projectname}-${jarfile}.jar"/>
<fileset dir="${libs}">
<include name="**/*.jar"/>
</fileset>
</classpath>
<batchtest fork="yes" todir="${reports}">
<formatter type="xml"/>
<fileset dir="${build}">
<include name="**/*TestCase.class"/>
<exclude name="**/TestAll.class"/>
</fileset>
</batchtest>
</junit>
<junitreport>
<fileset dir="${reports}">
<include name="TEST-*.xml"/>
</fileset>
<report format="noframes"/>
</junitreport>
</target>
<target name="clean" description="Clean build directories">
<delete dir="${build}"/>
</target>
<target name="clean-all" depends="clean" description="Clean all extra files">
<delete file="sample-junit-target.xml"/>
<delete dir="${jars}"/>
<delete dir="dist"/>
<delete dir="docs-${jarfile}"/>
<delete dir="target"/>
<delete>
<fileset dir="." includes="*.log"/>
<fileset dir="." includes="*.lck"/>
<fileset dir="." includes="*.cache"/>
</delete>
</target>
</project>