-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
135 lines (113 loc) · 5.75 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
<?xml version="1.0" encoding="utf-8" ?>
<project name="Panto" default="snapshot" basedir=".">
<property name="target.version" value="1.1.1"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="lib.dir" value="${basedir}/vendor/lib"/>
<property name="buildlib.dir" value="${basedir}/vendor/buildlib"/>
<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>
<macrodef name="compile-module">
<attribute name="srcdir"/>
<attribute name="destdir"/>
<attribute name="classpathref"/>
<sequential>
<mkdir dir="@{destdir}"/>
<javac srcdir="@{srcdir}/java"
includes="**"
includeantruntime="false"
encoding="utf-8"
destdir="@{destdir}"
source="1.5"
target="1.5"
debug="true"
debuglevel="lines,source">
<classpath refid="@{classpathref}"/>
</javac>
<copy failonerror="false" todir="@{destdir}">
<fileset dir="@{srcdir}/resources" excludes="**/*.java"/>
</copy>
</sequential>
</macrodef>
<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}"/>
<property name="main.jar" value="${build.dir}/panto-${version.label}.jar"/>
<property name="sources.jar" value="${build.dir}/panto-${version.label}-sources.jar"/>
<property name="test.jar" value="${build.dir}/panto-tests-${version.label}.jar"/>
</target>
<target name="clean" description="Clean this project">
<delete dir="${build.dir}" failonerror="false"/>
<mkdir dir="${build.dir}"/>
</target>
<target name="jar-main" depends="clean,version">
<path id="compile-main.req">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</path>
<compile-module srcdir="${basedir}/src/main" destdir="${build.dir}/main" classpathref="compile-main.req"/>
<jar destfile="${main.jar}">
<fileset dir="${build.dir}/main"/>
<fileset dir="${basedir}" includes="LICENSE NOTICE README.md"/>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Implementation-Vendor" value="netmelody.org"/>
<attribute name="Implementation-Title" value="${ant.project.name}"/>
<attribute name="Implementation-Version" value="${version.label}"/>
<attribute name="Built-Date" value="${build.timestamp}"/>
</manifest>
</jar>
<jar destfile="${sources.jar}">
<fileset dir="${basedir}/src/main"/>
<fileset dir="${basedir}" includes="LICENSE NOTICE README.md"/>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Implementation-Vendor" value="netmelody.org"/>
<attribute name="Implementation-Title" value="${ant.project.name}"/>
<attribute name="Implementation-Version" value="${version.label}-sources"/>
<attribute name="Built-Date" value="${build.timestamp}"/>
</manifest>
</jar>
</target>
<target name="jar-test" depends="clean,jar-main">
<path id="compile-test.req">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
<fileset file="${main.jar}"/>
<fileset dir="${buildlib.dir}" includes="**/*.jar"/>
</path>
<compile-module srcdir="${basedir}/src/test" destdir="${build.dir}/test" classpathref="compile-test.req"/>
<jar destfile="${test.jar}">
<fileset dir="${build.dir}/test"/>
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Implementation-Vendor" value="netmelody.org"/>
<attribute name="Implementation-Title" value="${ant.project.name} Tests"/>
<attribute name="Implementation-Version" value="${version.label}"/>
<attribute name="Built-Date" value="${build.timestamp}"/>
</manifest>
</jar>
</target>
<target name="jar" description="Create jar files" depends="jar-main,jar-test"/>
<target name="test" description="Test this project" depends="jar">
<mkdir dir="${build.dir}/testreport"/>
<mkdir dir="${build.dir}/tmp"/>
<junit printsummary="yes" haltonfailure="yes" fork="true" includeantruntime="true" forkmode="once" tempdir="${build.dir}/tmp">
<classpath>
<pathelement location="${main.jar}"/>
<fileset dir="${buildlib.dir}" includes="**/*.jar"/>
<pathelement location="${test.jar}"/>
</classpath>
<formatter type="plain"/>
<batchtest fork="yes" todir="${build.dir}/testreport">
<zipfileset src="${test.jar}">
<include name="org/netmelody/panto/**/*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"/>
</project>