-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
97 lines (81 loc) · 3.37 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
<project name="postmark4j" default="dist">
<defaultexcludes add="**/.git/**,**/.gitignore"/>
<dirname property="base.dir" file="${ant.file}"/>
<property name="src.dir" value="${base.dir}/src"/>
<property name="lib.dir" value="${base.dir}/lib"/>
<property name="javadoc.dir" value="${base.dir}/javadoc"/>
<property file="${base.dir}/build.properties"/>
<property file="${src.dir}/version.properties"/>
<property name="jar.file" value="${base.dir}/${ant.project.name}-${version}.jar"/>
<property name="zip.file" value="${base.dir}/${ant.project.name}-${version}.zip"/>
<property name="test.dir" value="${base.dir}/test"/>
<property name="test.src.dir" value="${test.dir}/src"/>
<property name="test.lib.dir" value="${test.dir}/lib"/>
<target name="build" description="Build jar with options specified in build.properties">
<tempfile property="build.dir" prefix="${ant.project.name}-build-"/>
<mkdir dir="${build.dir}"/>
<javac srcdir="${src.dir}" destdir="${build.dir}" debug="${debug}">
<classpath>
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</classpath>
</javac>
<copy todir="${build.dir}">
<fileset dir="${src.dir}" includes="**/*.properties"/>
</copy>
<!--
There must be a better way to do this, but I'm working from a castle in the
French countryside with no access to internet, so just doing what works.
-->
<condition property="runIncludeSourcesTarget">
<or>
<equals arg1="${includeSources}" arg2="true" casesensitive="false" trim="true"/>
<equals arg1="${includeSources}" arg2="yes" casesensitive="false" trim="true"/>
<equals arg1="${includeSources}" arg2="on" casesensitive="false" trim="true"/>
<equals arg1="${includeSources}" arg2="t" casesensitive="false" trim="true"/>
</or>
</condition>
<antcall target="copy-sources"/>
<jar basedir="${build.dir}" jarfile="${jar.file}"/>
<delete dir="${build.dir}"/>
</target>
<target name="copy-sources" if="runIncludeSourcesTarget" description="Optionally copy sources into built jar">
<copy todir="${build.dir}">
<fileset dir="${src.dir}" includes="**/*.java"/>
</copy>
</target>
<target name="javadoc" description="Generate javadocs from sources">
<mkdir dir="${javadoc.dir}"/>
<javadoc destdir="${javadoc.dir}" sourcepath="${src.dir}" access="public">
<classpath>
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</classpath>
</javadoc>
</target>
<target name="dist" depends="build, javadoc" description="">
<zip file="${zip.file}">
<fileset dir="${base.dir}" excludes="${zip.file}"/>
</zip>
</target>
<taskdef name="testng" classname="org.testng.TestNGAntTask" classpath="${test.lib.dir}/testng-6.2.jar"/>
<target name="test" depends="build">
<tempfile property="test.build.dir" prefix="${ant.project.name}-test-"/>
<mkdir dir="${test.build.dir}"/>
<javac srcdir="test/src" destdir="${test.build.dir}">
<classpath>
<fileset dir="${lib.dir}" includes="**/*.jar"/>
<fileset dir="${test.lib.dir}" includes="**/*.jar"/>
<file file="${jar.file}"/>
</classpath>
</javac>
<testng>
<classpath>
<fileset dir="${lib.dir}" includes="**/*.jar"/>
<fileset dir="${test.lib.dir}" includes="**/*.jar"/>
<pathelement location="${test.build.dir}"/>
<file file="${jar.file}"/>
</classpath>
<classfileset dir="${test.build.dir}" includes="**/*.class"/>
</testng>
<delete dir="${test.build.dir}"/>
</target>
</project>