-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
88 lines (77 loc) · 2.86 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
<project name="book-redesign" default="dist" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- Define basic properties -->
<property name="src" location="src/main/java"/>
<property name="build" location="ant-build"/>
<property name="dist" location="dist"/>
<property name="test.src" value="src/test/java"/>
<property name="test.build" value="ant-build-test"/>
<property name="test.reports" value="ant-test-results"/>
<!-- Create build directory -->
<target name="init">
<mkdir dir="${build}"/>
<mkdir dir="${test.reports}"/>
</target>
<!-- Compile sources -->
<target name="compile" depends="init">
<javac srcdir="${src}" destdir="${build}"/>
</target>
<target name="compile-test" depends="compile, resolve" description="Compile tests">
<mkdir dir="${test.build}"/>
<javac srcdir="${test.src}" destdir="${test.build}" includeantruntime="false"
debug="true">
<classpath>
<path refid="test.path"/>
<pathelement path="${build}"/>
</classpath>
</javac>
</target>
<!-- Distribute jar -->
<target name="dist" depends="compile">
<mkdir dir="${dist}/lib"/>
<jar jarfile="${dist}/lib/book-redesign.jar" basedir="${build}"/>
</target>
<!-- Run JUnit Tests -->
<target name="test" depends="compile-test">
<mkdir dir="${test.src}"/>
<junitlauncher haltOnFailure="true" printSummary="true">
<classpath>
<path refid="test.path"/>
<pathelement path="${build}"/>
<pathelement path="${test.build}"/>
</classpath>
<testclasses outputdir="${test.reports}">
<fileset dir="${test.build}">
<include name="**/*Test.class"/>
</fileset>
<listener type="legacy-xml" sendSysOut="true" sendSysErr="true"/>
<listener type="legacy-plain" sendSysOut="true" />
</testclasses>
</junitlauncher>
<junitreport todir="${test.reports}">
<fileset dir="${test.reports}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${test.reports}/html"/>
</junitreport>
</target>
<!-- Cleanup build and distribution -->
<target name="clean" description="clean up">
<delete dir="${build}"/>
<delete dir="${dist}"/>
<delete dir="${test.build}"/>
<delete dir="${test.reports}"/>
</target>
<available classname="org.apache.ivy.Main" property="ivy.installed"/>
<!-- Ivy Setup -->
<target name="install-ivy" unless="ivy.installed">
<mkdir dir="${user.home}/.ant/lib"/>
<get dest="${user.home}/.ant/lib/ivy.jar"
src="http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.5.0/ivy-2.5.0.jar"/>
</target>
<!-- Resolve dependencies via ivy -->
<target name="resolve" depends="install-ivy">
<ivy:retrieve/>
<ivy:cachepath pathid="compile.path" conf="compile"/>
<ivy:cachepath pathid="test.path" conf="test"/>
</target>
</project>