forked from sgroschupf/zkclient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
176 lines (154 loc) · 7.47 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<project name="zkclient" xmlns:ivy="antlib:org.apache.ivy.ant">
<property file="build.properties" />
<target name="download-ivy" unless="ivyIsAvailable" description="--> downloads ivy from a maven repo">
<mkdir dir="${ivy.jar.dir}" />
<echo message="installing ivy..." />
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true" />
</target>
<target name="check-ivy-available">
<available file="${ivy.jar.file}" property="ivyIsAvailable" />
<antcall target="download-ivy" />
</target>
<target name="install-ivy" depends="check-ivy-available" description="--> install ivy">
<property environment="env" />
<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" />
<ivy:settings file="${root.dir}/ivy/ivysettings.xml" />
<available file="${it.src.dir}" type="dir" property="integration-test.exists" />
</target>
<target name="eclipse" depends="install-ivy" description="--> creates eclipse project files">
<ivy:resolve useOrigin="true" conf="test,eclipse"/>
<ivy:cachepath pathid="eclipse.path.id" conf="eclipse" />
<ivy:cachepath pathid="test.path.id" conf="test" />
<ivy:cachepath pathid="compile.path.id" conf="compile" />
<taskdef name="eclipse"
classname="prantl.ant.eclipse.EclipseTask"
classpathref="eclipse.path.id" />
<mkdir dir="${build.dir.main-classes}" />
<mkdir dir="${build.dir.test-classes}" />
<eclipse updatealways="true">
<settings>
<jdtcore compilercompliance="6.0" />
<resources encoding="UTF-8" />
</settings>
<project name="${ant.project.name}" />
<classpath>
<container path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6" />
<!-- each new module need to be added here -->
<source path="${main.src.dir}"
output="${build.dir.eclipse-main-classes}" />
<source path="${test.src.dir}"
output="${build.dir.eclipse-test-classes}" />
<source path="${test.res.dir}"
output="${build.dir.eclipse-test-classes}" />
<output path="${build.dir.eclipse-main-classes}" />
<library pathref="test.path.id" exported="false" />
<library pathref="compile.path.id" exported="true" />
</classpath>
</eclipse>
<concat destfile="${basedir.ivy.instance}/.settings/org.eclipse.jdt.core.prefs" append="true">
<filelist dir="${root.dir}/src/build/eclipse" files="formatter"/>
</concat>
<replace file="${basedir.ivy.instance}/.settings/org.eclipse.jdt.core.prefs" token="org.eclipse.jdt.core.compiler.compliance=6.0" value="org.eclipse.jdt.core.compiler.compliance=1.6" />
</target>
<target name="clean-eclipse" description="--> cleans eclipse files">
<delete file=".classpath" />
<delete file=".eclipse" />
<delete file=".project" />
<delete dir=".settings" />
<delete dir="${build.dir.eclipse}" />
</target>
<!-- Javadoc -->
<target name="javadoc" depends="jar" description="Generate javadoc">
<mkdir dir="${build.javadoc.dev}"/>
<javadoc
packagenames="org.I0Itec.*"
destdir="${build.javadoc}"
author="true"
version="true"
use="true"
>
<packageset dir="${main.src.dir}">
<include name="org/I0Itec/**"/>
</packageset>
<link href="${javadoc.link.java}"/>
<classpath refid="build.path.id" />
<classpath path="${main.res.dir}" />
</javadoc>
</target>
<target name="compile" depends="install-ivy" description="--> compile main classes">
<ivy:resolve useOrigin="true" conf="compile"/>
<mkdir dir="${build.dir.main-classes}" />
<ivy:cachepath pathid="build.path.id" conf="compile" />
<javac encoding="${build.encoding}" destdir="${build.dir.main-classes}" debug="${javac.debug}" optimize="${javac.optimize}" target="${javac.version}" source="${javac.version}" deprecation="${javac.deprecation}">
<src path="${main.src.dir}" />
<compilerarg line="${javac.args} ${javac.args.warnings}" />
<classpath refid="build.path.id" />
<classpath path="${main.res.dir}" />
</javac>
<copy todir="${build.dir.main-classes}" failonerror="false">
<fileset dir="${main.res.dir}"/>
</copy>
</target>
<target name="jar" depends="compile" description="--> builds jar file">
<tstamp>
<format property="timestamp" pattern="MMM dd yyyy, HH:mm:ss" />
</tstamp>
<jar jarfile="${build.dir}/${jar.name}" basedir="${build.dir.main-classes}" >
<fileset dir="${main.src.dir}" includes="**/*.java" />
</jar>
</target>
<target name="clean" description="--> clean">
<delete dir="${build.dir}" />
</target>
<target name="clean-cache" depends="install-ivy" description="--> clean the ivy cache">
<ivy:cleancache />
</target>
<target name="compile-test" depends="compile" description="--> compile test classes">
<echo>*** Building Tests Sources of ${ant.project.name} ***</echo>
<mkdir dir="${build.dir.test-classes}" />
<ivy:cachepath pathid="test.path.id" conf="test" />
<path id="test.path">
<path refid="test.path.id" />
<pathelement location="${build.dir.main-classes}" />
</path>
<javac encoding="${build.encoding}" srcdir="${test.src.dir}" includes="**/*.java" destdir="${build.dir.test-classes}" debug="${javac.debug}" optimize="${javac.optimize}" target="${javac.version}" source="${javac.version}" deprecation="${javac.deprecation}">
<compilerarg line="${javac.args} ${javac.args.warnings}" />
<classpath refid="test.path" />
</javac>
</target>
<target name="test" depends="compile-test" description="--> runs junit test classes">
<!-- Set deploy.mode if it hasn't been ... earlier definition overrides. -->
<property name="forkmode" value="once" />
<echo>forkmode=${forkmode}</echo>
<echo>log4j.properties=file:${unit.test.conf}/log4j.properties</echo>
<delete dir="${build.dir.test-reports}" />
<mkdir dir="${build.dir.test-reports}" />
<delete dir="${build.dir.test-data}" />
<mkdir dir="${build.dir.test-data}" />
<ivy:cachepath pathid="test.path.id" conf="test" />
<junit printsummary="yes" haltonfailure="no" forkmode="${forkmode}" fork="yes" maxmemory="256m" dir="${basedir}" errorProperty="tests.failed" failureProperty="tests.failed">
<sysproperty key="log4j.configuration" value="file:${unit.test.conf}/log4j.properties"/>
<classpath>
<pathelement location="${build.dir.main-classes}" />
<pathelement location="${build.dir.test-classes}" />
<pathelement location="${test.res.dir}" />
<path refid="test.path.id" />
</classpath>
<formatter type="plain" />
<formatter type="xml" />
<batchtest fork="yes" todir="${build.dir.test-reports}">
<fileset dir="${test.src.dir}">
<include name="**/*Test.java" />
<exclude name="**/Abstract*.java" />
</fileset>
</batchtest>
</junit>
<fail if="tests.failed">Tests failed!</fail>
</target>
<target name="install" depends="jar" description="--> copies jar file to build directory" >
<ivy:publish artifactspattern="build/[artifact]-[revision].[ext]" resolver="install" overwrite="true" pubrevision="${zkclient.version}" conf="compile, master"/>
</target>
</project>