forked from tim-group/java-statsd-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
98 lines (88 loc) · 5.59 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
<?xml version="1.0" encoding="utf-8" ?>
<project name="java-statsd-client" default="snapshot" basedir=".">
<property name="target.version" value="3.1.0"/>
<property name="build.dir" value="${basedir}/build"/>
<tstamp><format property="build.number" pattern="yyyyMMddHHmmss" timezone="GMT"/></tstamp>
<tstamp><format property="build.timestamp" pattern="yyyy-MM-dd HH:mm:ss" timezone="GMT"/></tstamp>
<target name="-version-for-snapshot" unless="version.label">
<property name="version.label" value="${target.version}-SNAPSHOT-${build.number}"/>
</target>
<target name="-version-for-release" unless="version.label">
<property name="version.label" value="${target.version}"/>
</target>
<target name="-version" depends="-version-for-snapshot,-version-for-release">
<echo message="Building version ${version.label}"/>
</target>
<target name="clean" description="Clean this project">
<delete dir="${build.dir}" failonerror="false"/>
<mkdir dir="${build.dir}"/>
</target>
<target name="jar" description="Create Jar files" depends="clean,-version">
<mkdir dir="${build.dir}/main.classes"/>
<javac srcdir="${basedir}/src/main/java" destdir="${build.dir}/main.classes" includes="**"
includeantruntime="false" encoding="utf-8" source="1.6" target="1.6" debug="true" debuglevel="lines,source"/>
<jar destfile="${build.dir}/${ant.project.name}-${version.label}.jar">
<fileset dir="${build.dir}/main.classes"/>
<fileset dir="${basedir}" includes="LICENSE README.md"/>
<manifest>
<attribute name="Implementation-Title" value="${ant.project.name}"/>
<attribute name="Implementation-Vendor" value="YouDevise"/>
<attribute name="Implementation-Version" value="${version.label}"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Built-Date" value="${build.timestamp}"/>
</manifest>
</jar>
<jar destfile="${build.dir}/${ant.project.name}-${version.label}-sources.jar">
<fileset dir="${basedir}/src/main/java"/>
<fileset dir="${basedir}" includes="LICENSE"/>
</jar>
<mkdir dir="${build.dir}/test.classes"/>
<zip destfile="${build.dir}/test-compiledeps.jar"><zipgroupfileset dir="${basedir}/vendor/buildlib" includes="**/*.jar"/></zip>
<javac srcdir="${basedir}/src/test/java" destdir="${build.dir}/test.classes" includes="**"
includeantruntime="false" encoding="utf-8" source="1.6" target="1.6" debug="true" debuglevel="lines,source"
classpath="${build.dir}/test-compiledeps.jar:${build.dir}/${ant.project.name}-${version.label}.jar"/>
<jar destfile="${build.dir}/${ant.project.name}-test-${version.label}.jar">
<fileset dir="${build.dir}/test.classes"/>
<zipfileset src="${build.dir}/test-compiledeps.jar" excludes="**/META-INF/**"/>
</jar>
</target>
<target name="-jar-javadoc">
<mkdir dir="${build.dir}/javadoc"/>
<javadoc packagenames="*" sourcepath="${basedir}/src/main/java" defaultexcludes="yes"
destdir="${build.dir}/javadoc" author="true" version="true" use="true" windowtitle="${ant.project.name}"/>
<jar destfile="${build.dir}/${ant.project.name}-${version.label}-javadoc.jar">
<fileset dir="${build.dir}/javadoc"/>
<fileset dir="${basedir}" includes="LICENSE README.md"/>
</jar>
</target>
<target name="test" description="Test this project" depends="jar">
<mkdir dir="${build.dir}/testreport"/>
<mkdir dir="${build.dir}/test.tmp"/>
<junit printsummary="yes" haltonfailure="yes" forkmode="once" tempdir="${build.dir}/test.tmp">
<classpath>
<pathelement location="${build.dir}/${ant.project.name}-${version.label}.jar"/>
<pathelement location="${build.dir}/${ant.project.name}-test-${version.label}.jar"/>
</classpath>
<formatter type="xml"/>
<batchtest fork="yes" todir="${build.dir}/testreport">
<zipfileset src="${build.dir}/${ant.project.name}-test-${version.label}.jar">
<include name="com/timgroup/statsd/**/*Test.class"/>
</zipfileset>
</batchtest>
</junit>
</target>
<target name="snapshot" description="Create a tested snapshot jar file" depends="test"/>
<target name="release" description="Create a tested release jar file" depends="-version-for-release,snapshot"/>
<target name="bundle" description="Create a release bundle for deployment to maven central" depends="release,-jar-javadoc">
<copy file="${ant.project.name}.pom" tofile="${build.dir}/${ant.project.name}-${version.label}.pom">
<filterset><filter token="VERSION" value="${version.label}"/></filterset>
</copy>
<exec executable="gpg" dir="${build.dir}"><arg value="-ab"/><arg value="${ant.project.name}-${version.label}.pom"/></exec>
<exec executable="gpg" dir="${build.dir}"><arg value="-ab"/><arg value="${ant.project.name}-${version.label}.jar"/></exec>
<exec executable="gpg" dir="${build.dir}"><arg value="-ab"/><arg value="${ant.project.name}-${version.label}-javadoc.jar"/></exec>
<exec executable="gpg" dir="${build.dir}"><arg value="-ab"/><arg value="${ant.project.name}-${version.label}-sources.jar"/></exec>
<jar destfile="${build.dir}/bundle.jar">
<fileset dir="${build.dir}" includes="${ant.project.name}-${version.label}*"/>
</jar>
</target>
</project>