-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathcommon.xml
More file actions
190 lines (155 loc) · 7.71 KB
/
common.xml
File metadata and controls
190 lines (155 loc) · 7.71 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<?xml version="1.0" encoding="UTF-8"?>
<project name="common" basedir=".">
<property file="build.properties" />
<property name="lib.dir" location="lib" />
<property name="bin.dir" location="bin" />
<property name="src.dir" location="src" />
<property name="java.src.dir" location="${src.dir}/java" />
<property name="thrift.src.dir" location="${src.dir}/thrift" />
<property name="generated.src.dir" location="${src.dir}/generated" />
<property name="web.src.dir" location="${src.dir}/web" />
<property name="conf.dir" location="${src.dir}/conf" />
<property name="src.conf.dir" location="${src.dir}/conf" />
<property name="test.dir" location="test" />
<property name="test.conf.dir" location="${test.dir}/conf" />
<property name="test.data.dir" location="${test.dir}/data" />
<property name="test.java.dir" location="${test.dir}/java" />
<property name="build.dir" location="build" />
<property name="classes.dir" location="${build.dir}/classes" />
<property name="javadoc.dir" location="${build.dir}/javadoc" />
<property name="javadoc.includes" value="fm/last/**/*" />
<property name="dist.dir" location="${build.dir}/dist" />
<property name="junit.report.dir" location="${build.dir}/junit" />
<property name="checkstyle.report.dir" value="${build.dir}/checkstyle" />
<property name="findbugs.report.dir" value="${build.dir}/findbugs" />
<property name="cobertura.dir" value="${build.dir}/cobertura" />
<property name="cobertura.report.dir" value="${cobertura.dir}/report" />
<property name="cobertura.classes.dir" value="${cobertura.dir}/classes" />
<property name="cobertura.datafile" value="${cobertura.dir}/cobertura.ser" />
<property name="ear.file" value="${ant.project.name}.ear" />
<property name="jar.file" value="${ant.project.name}.jar" />
<property name="war.file" value="${ant.project.name}.war" />
<property name="tgz.file" value="${ant.project.name}.tgz" />
<!-- override the following if you install ivy/ant elsewhere or your svn auth details are different -->
<!-- override this fileset to include extra files in the jar that gets built by build-jar -->
<fileset dir="." includes="${jar.file.includes}" id="jar-fileset" />
<!-- by default we include all jars under lib in this, override to narrow down -->
<fileset dir="${lib.dir}" id="lib.fileset">
<include name="*.jar" />
</fileset>
<!-- classpath used for compiling -->
<path id="compile-classpath">
<fileset refid="lib.fileset" />
<fileset dir="${lib.dir}">
<include name="junit.jar" />
</fileset>
</path>
<!-- classpath used for compiling test classes, override this if you need extra entries to compile your tests -->
<path id="test-compile-classpath">
<path refid="compile-classpath" />
</path>
<!-- base classpath used when running tests -->
<path id="test-classpath">
<pathelement location="${test.conf.dir}" />
<!-- put instrumented classes higher up in classpath so they will be used if available -->
<pathelement location="${cobertura.classes.dir}" />
<pathelement location="${classes.dir}" />
<path refid="compile-classpath" />
</path>
<!-- extra classpath that can be used when running tests, override this if you need extra entries to run your tests -->
<path id="additional-test-classpath" />
<!-- classpath that can be used to run compiled classes -->
<path id="run-classpath">
<path refid="compile-classpath" />
<pathelement path="${conf.dir}" />
<pathelement location="${classes.dir}" />
</path>
<target name="init" description="Initialise everything needed by other targets">
<mkdir dir="${build.dir}" />
</target>
<target name="clean" description="Remove files and folders from previous builds">
<delete dir="${build.dir}" />
</target>
<target name="compile" depends="compile-source, compile-test" />
<target name="compile-source" depends="init" description="Compile the Java source code">
<mkdir dir="${classes.dir}" />
<javac srcdir="${java.src.dir}" destdir="${classes.dir}" debug="true" fork="true">
<classpath refid="compile-classpath" />
</javac>
<echo message="Sources compiled" />
</target>
<target name="compile-test" depends="compile-source" description="Compile the Java test source code">
<mkdir dir="${classes.dir}" />
<javac srcdir="${test.java.dir}" destdir="${classes.dir}" debug="true">
<classpath>
<path refid="test-compile-classpath" />
</classpath>
</javac>
<echo message="Test Sources compiled" />
</target>
<target name="test" depends="compile" description="Run the unit tests">
<delete dir="${junit.report.dir}" />
<mkdir dir="${junit.report.dir}" />
<property name="junit.includes" value="**/*Test.java" />
<property name="junit.excludes" value="nothing.by.default" />
<property name="junit.fork" value="true" />
<property name="junit.forkmode" value="perTest" />
<junit printsummary="yes" failureproperty="testfailed" showoutput="true" fork="${junit.fork}" forkmode="${junit.forkmode}">
<sysproperty key="net.sourceforge.cobertura.datafile" file="${cobertura.datafile}" />
<classpath refid="additional-test-classpath" />
<classpath location="${cobertura.classes.dir}" />
<classpath refid="test-classpath" />
<classpath location="${lib.dir}/cobertura.jar" />
<formatter type="xml" usefile="true" />
<batchtest todir="${junit.report.dir}">
<fileset dir="${test.java.dir}" includes="${junit.includes}" excludes="${junit.excludes}" />
</batchtest>
</junit>
<junitreport todir="${junit.report.dir}">
<fileset dir="${junit.report.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="noframes" todir="${junit.report.dir}" />
</junitreport>
<fail if="testfailed" message="Some test(s) failed. See '${junit.report.dir}' for details." />
</target>
<!-- target name="javadoc" depends="retrieve" -->
<target name="javadoc">
<tstamp>
<format property="YEAR" pattern="yyyy" />
</tstamp>
<javadoc destdir="${javadoc.dir}" author="true" version="true" use="true" windowtitle="${ant.project.name} API" classpathref="compile-classpath">
<fileset dir="${java.src.dir}" defaultexcludes="yes">
<include name="${javadoc.includes}" />
</fileset>
<bottom>
<![CDATA[<i>Copyright © ${YEAR} Last.fm. All Rights Reserved.</i>]]>
</bottom>
</javadoc>
</target>
<!-- we assume jar is the default build target, override this if not the case -->
<target name="build" depends="build-jar" description="Builds this project" />
<target name="build-jar" depends="compile-source" description="Builds this project's jar file(s)">
<!-- these can be overridden in child build files if you need to customise what goes into your jar -->
<property name="jar.classes.include" value="**/*" />
<property name="jar.classes.exclude" value="**/*Test*, fm/last/test/**/*" />
<property name="dist.jar.filename" value="${jar.file}"/>
<mkdir dir="${dist.dir}" />
<tstamp>
<format property="BUILD-DATETIME" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>
<jar destfile="${dist.dir}/${dist.jar.filename}" update="true">
<fileset dir="${classes.dir}" excludes="${jar.classes.exclude}" includes="${jar.classes.include}" />
<!-- set this in child files to add extra stuff to jar -->
<fileset refid="jar-fileset" />
<manifest>
<attribute name="Build-Version" value="${version}" />
<attribute name="Build-DateTime" value="${BUILD-DATETIME}" />
</manifest>
</jar>
<echo message="Build-Version set to ${version}" />
<echo message="Build-DateTime set to ${BUILD-DATETIME}" />
</target>
<target name="dist" depends="build, javadoc" />
<target name="all" depends="javadoc, build" />
</project>