-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
121 lines (103 loc) · 4.76 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
<!-- Ant build file for MiniConnectionPoolManager -->
<project name="miniConnectionPoolManager" default="package">
<property environment="env"/>
<!-- Main targets ===========================================================-->
<target name="clean" description="Deletes the target directory.">
<delete dir="target" failonerror="true"/>
</target>
<target name="compile" description="Compiles the main source files.">
<mkdir dir="target/classes"/>
<javac srcdir="src/main/java" destdir="target/classes"
deprecation="true" includeAntRuntime="false" debug="true" debuglevel="lines,source"
source="8" target="8">
<compilerarg line="-Xlint -Xlint:-path -Xlint:-options -Xmaxerrs 5 -Xmaxwarns 5"/>
</javac>
</target>
<target name="package" depends="compile" description="Builds the JAR file.">
<jar destfile="target/miniconnectionpoolmanager.jar">
<fileset dir="target/classes"/>
</jar>
</target>
<target name="javaDoc" description="Generates the API documentation (JavaDoc)">
<delete dir="target/javadoc" failonerror="true"/>
<mkdir dir="target/javadoc"/>
<javadoc sourcepath="src/main/java" destdir="target/javadoc" failonerror="true"
link="https://docs.oracle.com/javase/7/docs/api/"/>
</target>
<!-- Examples ===============================================================-->
<target name="compileExamples" depends="package, getExampleDependencies" description="Compiles the example source files.">
<mkdir dir="target/example-classes"/>
<javac srcdir="src/examples" destdir="target/example-classes"
deprecation="true" includeAntRuntime="false" debug="true" debuglevel="lines,source"
source="8" target="8">
<compilerarg line="-Xlint -Xlint:-path -Xlint:-options -Xmaxerrs 5 -Xmaxwarns 5"/>
<classpath>
<pathelement location="target/miniconnectionpoolmanager.jar"/>
<pathelement location="target/h2.jar"/>
<!-- <pathelement location="target/sqljdbc4.jar"/> -->
<!-- <pathelement location="target/sqlite-jdbc-3.14.2.1.jar"/> -->
</classpath>
</javac>
</target>
<target name="runSimpleTest" depends="compileExamples">
<java classname="SimpleTest" fork="true">
<classpath>
<pathelement location="target/example-classes"/>
<pathelement location="target/miniconnectionpoolmanager.jar"/>
<pathelement location="target/h2.jar"/>
</classpath>
</java>
</target>
<target name="runSpeedTest" depends="compileExamples">
<java classname="SpeedTest" fork="true">
<classpath>
<pathelement location="target/example-classes"/>
<pathelement location="target/miniconnectionpoolmanager.jar"/>
<pathelement location="target/h2.jar"/>
</classpath>
</java>
</target>
<!-- External dependencies for the example programs =========================-->
<property name="extH2JarFileVersion" value="2.1.210"/>
<property name="extH2JarFileUrl" value="https://repo1.maven.org/maven2/com/h2database/h2/${extH2JarFileVersion}/h2-${extH2JarFileVersion}.jar"/>
<target name="getExampleDependencies" description="Retrieves the required library JAR files for the xamples and stores them in the target directory"
depends="getH2JarFile">
</target>
<target name="getH2JarFile" unless="h2JarFileExists" depends="setH2JarFileExists">
<mkdir dir="target/classes"/>
<get src="${extH2JarFileUrl}" dest="target/h2.jar"/>
<!-- The "skipexisting" option of the "get" task emmits a warning message, so we don't use it and use the setH2JarFileExists target instead. -->
</target>
<target name="setH2JarFileExists">
<available property="h2JarFileExists" file="target/h2.jar"/>
</target>
<!-- Website update =========================================================-->
<target name="buildDistribZip" description="Builds the distribution ZIP file.">
<antcall target="clean"/>
<antcall target="package"/>
<antcall target="javaDoc"/>
<zip destfile="target/miniConnectionPoolManager.zip">
<zipfileset dir="."
includes="build.xml, CHANGES.txt, README.txt, MiniConnectionPoolManager.html, src/, target/miniconnectionpoolmanager.jar, target/javadoc/"/>
</zip>
</target>
<target name="updateWebsite">
<fail unless="env.miniConnectionPoolManagerWebsiteDir" message="Undefined website directory."/>
<property name="websiteDir" location="${env.miniConnectionPoolManagerWebsiteDir}"/>
<antcall target="buildDistribZip"/>
<copy todir="${websiteDir}" overwrite="true">
<fileset dir="src/main" includes="**/*.java"/>
<chainedmapper>
<flattenmapper/>
<mapper>
<globmapper from="*.java" to="*.java.txt"/>
<identitymapper/>
</mapper>
</chainedmapper>
</copy>
<delete dir="${websiteDir}/javadoc" failonerror="true"/>
<copy todir="${websiteDir}" overwrite="true">
<fileset dir="target" includes="miniConnectionPoolManager.zip, javadoc/"/>
</copy>
</target>
</project>