-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.xml
122 lines (107 loc) · 4.43 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
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant"
name="social-network-workshop" basedir="." default="dist">
<property name="ivy.install.version" value="2.2.0" />
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME" />
</condition>
<property name="ivy.home" value="${user.home}/.ant" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<target name="download ivy" unless="offline">
<mkdir dir="${ivy.jar.dir}"/>
<get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="init ivy" depends="download ivy">
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<property name="main.src" location="${basedir}/src/main/java"/>
<property name="test.src" location="${basedir}/src/test/java"/>
<property name="test.resources" location="${basedir}/src/test/resources"/>
<property name="target" location="${basedir}/target"/>
<property name="target.classes" location="${target}/classes"/>
<property name="target.test" location="${target}/test-classes"/>
<property name="target.reports" location="${target}/reports"/>
<available property="dependencies.zip" value="${basedir}/dependencies.zip"
file="${basedir}/dependencies.zip"/>
<target name="clean">
<delete dir="${target}"/>
</target>
<target name="clean all" depends="clean">
<delete dir="${basedir}/lib"/>
</target>
<target name="download dependencies" unless="dependencies.zip"
depends="init ivy">
<ivy:retrieve />
</target>
<target name="unpack dependencies" if="dependencies.zip">
<mkdir dir="${basedir}/lib"/>
<unzip src="${dependencies.zip}" dest="${basedir}/lib" overwrite="false"/>
</target>
<target name="dependencies"
depends="download dependencies,unpack dependencies">
<path id="dependencies.path">
<fileset dir="${basedir}/lib" includes="*.jar"/>
</path>
</target>
<target name="package" depends="dependencies">
<mkdir dir="${target}"/>
<zip destfile="${target}/dependencies.zip" filesonly="true">
<fileset dir="${basedir}/lib" includes="*.jar"/>
</zip>
<exec executable="rst2html.py" failifexecutionfails="false"
output="${target}/README.html" errorproperty="rst2html.errors">
<arg value="${basedir}/README.rst"/>
</exec>
<echo message="${rst2html.errors}"/>
<zip destfile="${target}/${ant.project.name}.zip">
<fileset dir="${basedir}" includes="src/main/"/>
<fileset dir="${basedir}" includes="src/test/"/>
<fileset dir="${basedir}" includes="*.xml"/>
<fileset dir="${basedir}" includes="README.rst"/>
<fileset dir="${target}" includes="README.html"/>
<fileset dir="${target}" includes="dependencies.zip"/>
</zip>
</target>
<target name="compile" depends="dependencies">
<mkdir dir="${target.classes}"/>
<javac srcdir="${main.src}" destdir="${target.classes}"
classpathref="dependencies.path" debug="true"
debuglevel="lines,vars,source"/>
</target>
<target name="compile tests" depends="compile">
<mkdir dir="${target.test}"/>
<javac srcdir="${test.src}" destdir="${target.test}" debug="true"
debuglevel="lines,vars,source">
<classpath>
<path refid="dependencies.path"/>
<pathelement location="${target.classes}"/>
</classpath>
</javac>
</target>
<target name="test" depends="compile tests">
<mkdir dir="${target.reports}"/>
<junit failureproperty="test.failure">
<classpath>
<path refid="dependencies.path"/>
<pathelement location="${target.classes}"/>
<pathelement location="${target.test}"/>
<pathelement location="${test.resources}"/>
</classpath>
<batchtest todir="${target.reports}">
<fileset dir="${test.src}"/>
<formatter type="plain"/>
</batchtest>
</junit>
<fail if="test.failure" message="Tests failed"/>
</target>
<target name="dist" depends="compile,test">
<jar destfile="${target}/${ant.project.name}.jar"
basedir="${target.classes}"/>
</target>
</project>