-
Notifications
You must be signed in to change notification settings - Fork 138
/
build.xml
112 lines (102 loc) · 4.34 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
<project name="apgdiff" default="jar" basedir=".">
<property name="name" value="Another PostgreSQL Diff Tool"/>
<property name="version" value="2.7"/>
<property name="build" value="build"/>
<property name="dist" value="dist"/>
<property name="build.output" value="${build}/classes"/>
<property name="dist.javadoc" value="${dist}/javadoc"/>
<property name="build.final.name" value="${ant.project.name}-${version}"/>
<property name="lib" value="lib"/>
<property name="test.reports" value="${build}/test-reports"/>
<property name="test.output" value="${build}/test-classes"/>
<property name="src" value="src/main/java"/>
<property name="src.resources" value="src/main/resources"/>
<property name="test.src" value="src/test/java"/>
<property name="test.resources.src" value="src/test/resources"/>
<property name="source" value="1.8"/>
<property name="target" value="1.8"/>
<property name="main.class" value="cz.startnet.utils.pgdiff.Main"/>
<path id="build.classpath">
<fileset dir="${lib}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="init" description="Initializes build environment">
<tstamp/>
</target>
<target name="clean" description="Clean the output directory">
<delete dir="${build}"/>
<delete dir="${dist}"/>
<delete dir="${lib}"/>
</target>
<target name="compile" depends="init,get-deps"
description="Compile the code">
<mkdir dir="${build.output}"/>
<javac destdir="${build.output}" srcdir="${src}" source="${source}"
target="${target}" debug="true" deprecation="true"
optimize="false"/>
<copy todir="${build.output}">
<fileset dir="${src.resources}"/>
</copy>
</target>
<target name="jar" depends="compile" description="Clean the JAR">
<mkdir dir="${dist}"/>
<jar jarfile="${dist}/${build.final.name}.jar"
basedir="${build.output}">
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
</manifest>
</jar>
</target>
<target name="compile-tests" depends="compile"
description="Compile the test code">
<mkdir dir="${test.output}"/>
<javac destdir="${test.output}" srcdir="${test.src}" source="${source}"
target="${target}" debug="true" deprecation="true"
optimize="false">
<classpath>
<path refid="build.classpath"/>
<pathelement location="${build.output}"/>
</classpath>
</javac>
<copy todir="${test.output}">
<fileset dir="${test.resources.src}"/>
</copy>
</target>
<target name="test" depends="compile-tests"
description="Run the test cases">
<mkdir dir="${test.reports}"/>
<junit printSummary="yes" haltonerror="true" haltonfailure="true"
fork="false" dir=".">
<sysproperty key="basedir" value="."/>
<formatter type="plain" usefile="false"/>
<classpath>
<path refid="build.classpath"/>
<pathelement location="${build.output}"/>
<pathelement location="${test.output}"/>
</classpath>
<batchtest todir="${test.reports}">
<fileset dir="${test.src}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="get-deps" description="Download all dependencies"
unless="noget">
<mkdir dir="${lib}"/>
<get src="http://central.maven.org/maven2/junit/junit/4.8.1/junit-4.8.1.jar"
dest="${lib}/junit.jar"/>
<get src="http://central.maven.org/maven2/org/hamcrest/hamcrest-all/1.1/hamcrest-all-1.1.jar"
dest="${lib}/hamcrest-all.jar"/>
</target>
<target name="javadoc" description="Generates javadoc">
<delete dir="doc"/>
<mkdir dir="doc"/>
<javadoc packagenames="cz.*" sourcepath="${src}"
destdir="${dist.javadoc}" classpathref="build.classpath"
author="true" version="true" private="false" use="true"
splitindex="true" windowtitle="${name} ${version}"
doctitle="${name} ${version}"/>
</target>
</project>