-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.xml
157 lines (121 loc) · 5.98 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
<!--
Copyright 2011 Felix Drueke
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="ivyp4resolver" default="build" xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="lib.dir" value="${basedir}/lib" />
<property name="src.dir" value="${basedir}/src" />
<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="build.dir" value="${basedir}/build" />
<property name="dist.dir" value="${build.dir}/dist" />
<property name="classes.dir" value="${build.dir}/classes" />
<property name="junit.report.dir" location="${build.dir}/junit" />
<ivy:settings file="ivysettings.xml" />
<property file="build.properties" />
<!-- override this if you intend to publish a new version -->
<property name="version" value="0" />
<target name="resolvedeps">
<ivy:resolve />
<!-- paths used for compilation -->
<ivy:cachepath pathid="compile.classpath" conf="build" />
<!-- classpath used when compiling and running tests -->
<ivy:cachepath pathid="test.classpath" conf="unittest" />
<!-- classpath used when running findbugs -->
<ivy:cachepath pathid="findbugs.classpath" conf="findbugs" />
</target>
<target name="clean" description="">
<delete dir="${build.dir}" />
</target>
<target name="compile" depends="resolvedeps,compile-source, compile-test" />
<target name="compile-source">
<mkdir dir="${classes.dir}" />
<javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="compile.classpath" debug="true" source="1.5" target="1.5" />
</target>
<target name="compile-test" depends="compile-source">
<mkdir dir="${classes.dir}" />
<javac srcdir="${test.dir}" destdir="${classes.dir}" classpathref="test.classpath" debug="true"/>
</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" />
<junit printsummary="yes" failureproperty="testfailed" showoutput="true" fork="true">
<classpath refid="test-classpath" />
<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="jar" depends="compile" description="Build a jar file for this project">
<tstamp>
<format property="BUILD-DATETIME" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>
<mkdir dir="${dist.dir}" />
<echo message="Generating ${dist.dir}/${ant.project.name}.jar with version ${version}" />
<jar destfile="${dist.dir}/${ant.project.name}-${version}.jar" update="true">
<fileset dir="${classes.dir}">
<exclude name="**/*Test*" />
<exclude name="**/test*" />
</fileset>
<manifest>
<attribute name="Build-Version" value="${version}" />
<attribute name="Build-DateTime" value="${BUILD-DATETIME}" />
</manifest>
</jar>
</target>
<target name="build-jar" depends="jar" />
<target name="build" depends="build-jar" />
<target name="build-dist" depends="build-bin, build-src" />
<!-- builds the binary zip file -->
<target name="build-bin" depends="build-jar">
<tar destfile="${dist.dir}/${ant.project.name}-${version}-bin.tgz" compression="gzip">
<zipfileset dir="${dist.dir}" includes="${ant.project.name}.jar" prefix="${ant.project.name}-${version}" />
<zipfileset dir="${basedir}" includes="*.txt" excludes="TODO.txt" prefix="${ant.project.name}-${version}" />
<tarfileset refid="dependencies" prefix="${ant.project.name}-${version}/lib" />
</tar>
</target>
<!-- builds the source zip file -->
<target name="build-src" depends="build-jar">
<tar destfile="${dist.dir}/${ant.project.name}-${version}-src.tgz" compression="gzip">
<zipfileset dir="${basedir}" excludes="build/**/*, build, .*, build.properties, ivysettings.xml, .settings/**/*, deb.xml, test/conf/test.properties" prefix="${ant.project.name}-${version}" />
</tar>
</target>
<target name="findbugs" depends="resolvedeps">
<ivy:retrieve organisation="edu.umd.cs" module="findbugs" pattern="lib-findbugs/[artifact].[ext]" sync="true" inline="true" log="download-only" type="jar,report" />
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="lib-findbugs/findbugs-ant.jar" />
<path id="local.findbugs.classpath">
<fileset dir="lib-findbugs">
<include name="*.jar" />
</fileset>
</path>
<pathconvert property="local.findbugs.classpath" refid="local.findbugs.classpath" />
<findbugs classpath="${local.findbugs.classpath}" pluginList=""
output="html"
outputFile="ivyp4resolver-findbugs-results.html" >
<sourcePath path="${basedir}/src" />
<class location="${dist.dir}/${ant.project.name}.jar" />
<auxClasspath>
<path refid="compile.classpath" />
</auxClasspath>
</findbugs>
</target>
</project>