-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.xml
97 lines (96 loc) · 3.93 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
<?xml version="1.0"?>
<project name="clockwork" default="dist" basedir=".">
<description>Build file for Clockwork SMS Java wrapper</description>
<!-- set global properties for this build -->
<property name="src" location="src/main/java"/>
<property name="test" location="src/test/java"/>
<property name="build" location="build"/>
<property name="lib" location="lib"/>
<property name="dist" location="dist"/>
<property name="reports" location="${dist}/reports"/>
<property name="version" value="1.2.1"/>
<!-- define Maven coordinates -->
<property name="groupId" value="com.clockworksms" />
<property name="artifactId" value="clockwork" />
<!-- define artifacts' name, which follows the convention of Maven -->
<property name="jar" value="${dist}/lib/${artifactId}-${version}.jar" />
<property name="javadoc-jar" value="${dist}/lib/${artifactId}-${version}-javadoc.jar" />
<property name="sources-jar" value="${dist}/lib/${artifactId}-${version}-sources.jar" />
<tstamp>
<format property="TODAY" pattern="yyyy-MM-dd HH:mm:ss"/>
</tstamp>
<!-- Define the classpath which includes the junit.jar and the classes after compiling-->
<path id="junit.class.path">
<pathelement location="lib/junit-4.8.1.jar"/>
<fileset dir="${lib}" includes="*.jar"/>
<pathelement location="${build}"/>
</path>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
<target name="init" depends="clean">
<!-- Create directory structures -->
<mkdir dir="${build}"/>
<mkdir dir="${dist}"/>
<mkdir dir="${reports}"/>
<mkdir dir="${reports}/raw/"/>
<mkdir dir="${reports}/html/"/>
</target>
<target name="compile" depends="init" description="compile the source ">
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}" includeantruntime="false">
<classpath refid="junit.class.path"/>
</javac>
<javac srcdir="${test}" destdir="${build}" includeantruntime="false">
<classpath refid="junit.class.path"/>
</javac>
</target>
<target name="run-tests" depends="compile" description="run your test suite">
<junit printsummary="yes" haltonfailure="yes" showoutput="yes">
<classpath refid="junit.class.path"/>
<batchtest fork="yes" todir="${reports}/raw/">
<formatter type="xml"/>
<fileset dir="${test}">
<include name="**/*Test*.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="test" depends="run-tests">
<junitreport todir="${reports}">
<fileset dir="${reports}/raw/">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${reports}/html/"/>
</junitreport>
</target>
<target name="jar" depends="compile">
<mkdir dir="${dist}"/>
<manifest file="${build}/MANIFEST.MF">
<attribute name="Built-By" value="clockworksms.com"/>
<attribute name="Main-Class" value="com.clockworksms.CommandLineClient"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Built-Date" value="${TODAY}"/>
</manifest>
<jar jarfile="${jar}" basedir="${build}" includes="**/*.class" excludes="**/*Test*.class" manifest="${build}/MANIFEST.MF"/>
</target>
<target name="javadoc">
<javadoc access="public" destdir="${dist}/javadoc" author="true" version="true" use="true" windowtitle="Clockwork SMS Java Wrapper API">
<fileset dir="${src}" defaultexcludes="yes">
<include name="**/*.java"/>
</fileset>
</javadoc>
</target>
<target name="dist" depends="jar, javadoc" description="generate the distribution">
<!-- build the javadoc jar -->
<jar jarfile="${javadoc-jar}">
<fileset dir="${dist}/javadoc" />
</jar>
<!-- build the sources jar -->
<jar jarfile="${sources-jar}">
<fileset dir="${src}" />
</jar>
</target>
</project>