-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
105 lines (93 loc) · 3.23 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
<project name="PWTrigger" default="dist">
<property name="src-dir" location="src" />
<property name="dist-dir" location="dist" />
<property name="docs-dir" location="docs" />
<property name="bin-dir" location="bin" />
<property name="lib-dir" value="lib"/>
<property name="test-src-dir" value="test"/>
<property name="test-bin-dir" value="test-bin"/>
<path id="classpath.base">
</path>
<path id="class.path">
<fileset dir="." >
<include name="${lib-dir}/**/*.jar"/>
</fileset>
</path>
<pathconvert property="class-path" dirsep="/" pathsep=" " refid="class.path">
<map from="${basedir}${file.separator}lib" to="lib" />
</pathconvert>
<path id="test.classpath">
<pathelement location="${test-bin-dir}"/>
<fileset dir="${lib-dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="init" description="Creates the needed directories.">
<mkdir dir="${bin-dir}"/>
<mkdir dir="${dist-dir}"/>
<mkdir dir="${docs-dir}"/>
<mkdir dir="${test-bin-dir}"/>
</target>
<target name="clean" description="Cleans up the build and dist directories.">
<delete dir="${bin-dir}"/>
<delete dir="${dist-dir}"/>
<delete dir="${docs-dir}"/>
<delete dir="${test-bin-dir}"/>
</target>
<target name="compile" depends="init" description="Compiles the source files to the bin directory">
<javac srcdir="${src-dir}" destdir="${bin-dir}">
<classpath refid="class.path"/>
</javac>
<copy todir="${bin-dir}/resources">
<fileset dir="resources"/>
</copy>
<copy todir="${bin-dir}/lib">
<fileset dir="lib"/>
</copy>
</target>
<target name="compile-test" depends="init" description="Compiles the source files to the bin directory">
<javac srcdir="${src-dir}" destdir="${test-bin-dir}">
<classpath refid="class.path"/>
</javac>
<javac srcdir="${test-src-dir}" destdir="${test-bin-dir}">
<classpath refid="class.path"/>
</javac>
<copy todir="${test-bin-dir}/resources">
<fileset dir="resources"/>
</copy>
<copy todir="${test-bin-dir}/lib">
<fileset dir="lib"/>
</copy>
</target>
<target name="dist" depends="compile" description="Packages up PWTrigger into PWTrigger.jar">
<jar destfile="${dist-dir}/PWTrigger.jar" basedir="${bin-dir}">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="fr.ipgp.pwtrigger.PWTrigger" />
<attribute name="Class-Path" value="${class-path}" />
</manifest>
</jar>
<copy todir="${dist-dir}/resources">
<fileset dir="resources"/>
</copy>
<copy todir="${dist-dir}/lib">
<fileset dir="lib"/>
</copy>
</target>
<target name="javadoc" description="Generates Javadoc for the project">
<javadoc packagenames="fr.ipgp.*" sourcepath="${src-dir}" destdir="${docs-dir}" windowtitle="PWTrigger Documentation">
<classpath refid="class.path"/>
</javadoc>
</target>
<target name="test" depends="compile-test" description="Performs unit tests for the project">
<junit fork="yes" haltonfailure="yes">
<formatter type="plain" usefile="false" />
<classpath refid="test.classpath" />
<batchtest>
<fileset dir="${test-bin-dir}" includes="**/Test*.class"/>
</batchtest>
</junit>
</target>
<target name="rebuild" depends="clean,dist" description="Cleans and build">
</target>
</project>