-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
225 lines (185 loc) · 8.22 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="jlibiada-data-mining" default="run">
<property name="ivy.install.version" value="2.2.0"/>
<property name="ivy.jar.dir" value="${basedir}/ivy"/>
<property name="ivy.lib.dir" value="lib"/>
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
<property name="jsch.jar.name" value="jsch-0.1.45.jar"/>
<property name="source" value="src"/>
<property name="source.main" value="${source}/main"/>
<property name="source.test" value="${source}/test"/>
<property name="build" value="build"/>
<property name="build.main" value="${build}/main"/>
<property name="build.test" value="${build}/test"/>
<property name="reports" value="reports"/>
<property name="reports.test.xml" value="${reports}/test/xml/"/>
<property name="dist" value="dist"/>
<path id="compile.classpath">
<fileset dir="${ivy.lib.dir}/compile">
<include name="*.jar"/>
</fileset>
</path>
<path id="test.compile.classpath">
<fileset dir="${ivy.lib.dir}/test">
<include name="*.jar"/>
</fileset>
<pathelement location="${build.main}"/>
</path>
<path id="test.classpath">
<path refid="test.compile.classpath"/>
<pathelement location="${build.test}"/>
</path>
<target name="init" depends="clean">
<mkdir dir="${dist}"/>
<mkdir dir="${build.main}"/>
<mkdir dir="${build.test}"/>
<mkdir dir="lib"/>
<mkdir dir="${reports.test.xml}"/>
</target>
<target name="compile" depends="init, install-ivy, download-ivy, ivy-retrieve">
<javac srcdir="${source.main}"
destdir="${build.main}"
includeantruntime="false"
debug="true">
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="archive" depends="compile">
<jar basedir="${build.main}" destfile="${dist}/jlibiada-data-mining.jar"/>
</target>
<target name="clean" depends="clean-cache, clean-ivy">
<delete dir="${dist}"/>
<delete dir="${build}"/>
<delete dir="${reports}"/>
</target>
<target name="test-compile" depends="compile">
<javac destdir="${build.test}"
debug="true"
includeantruntime="false"
srcdir="${source.test}">
<classpath refid="test.compile.classpath"/>
</javac>
</target>
<target name="test-basic" depends="test-compile">
<junit printsummary="false" haltonfailure="false">
<classpath refid="test.classpath"/>
<formatter type="xml"/>
<!--<test todir="${reports.test.xml}" name="test.FastChainAlgoritms.FastChain.Calculators.testMuCalculator"/>-->
<batchtest todir="${reports.test.xml}">
<fileset dir="${build.test}" includes="**/*.class"/>
</batchtest>
</junit>
</target>
<target name="jar-make" depends="test-basic">
<jar destfile="${dist}/jlibiada-data-mining.jar" basedir="${build.main}"/>
</target>
<target name="download-ivy" unless="skip.download">
<mkdir dir="${ivy.jar.dir}"/>
<!--
download Ivy from web site so that it can be used even without any special installation
-->
<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="install-ivy" depends="download-ivy" description="--> install ivy">
<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" classpath="${ivy.jar.file};${ivy.jar.dir}/${jsch.jar.name}"/>
</target>
<target name="clean-ivy" description="--> clean the ivy installation">
<!--<delete dir="${ivy.jar.dir}"/>-->
</target>
<!--
================================= target: clean-cache =================================
-->
<target name="clean-cache" depends="install-ivy" description="--> clean the ivy cache">
<ivy:cleancache/>
</target>
<target name="ivy-resolve">
<!--<ivy:configure file="${basedir}/ivyconf.xml"/>-->
<ivy:resolve />
</target>
<target name="ivy-retrieve" depends="ivy-resolve">
<ivy:retrieve pattern="${ivy.lib.dir}/[conf]/[artifact]-[revision].[ext]" sync="true"/>
</target>
<target name="ftp-publish" depends="jar-make">
<ivy:publish resolver="ssh-serv"
pubrevision="1.0"
overwrite="true"
artifactspattern="${dist}/[artifact].[ext]"/>
</target>
<!--!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
<property name="build" value="build"/>
<property name="build.main" value="${build}/main"/>
<property name="build.test" value="${build}/test"/>
<property name="build.instr" value="${build}/instr"/>
<property name="src" value="src"/>
<property name="src.main" value="${src}/main"/>
<property name="src.test" value="${src}/test"/>
<property name="lib" value="lib"/>
<property name="checkstyle.policy" location="checkstyle-policy.xml"/>
<property name="reports" location="reports/checkstyle"/>
<property name="checkstyle.report.xml" location="${reports}/checkstyle.xml" />
<property name="coverage.report.xml" location="${reports}/coverage.xml" />
<property name="cobertura.dir" value="/usr/share/java/cobertura"/>
<target name="checkstyle-init">
<path id="checkstyle.lib" >
<pathelement location="/usr/share/ant/lib/checkstyle-5.5-all.jar" />
</path>
<taskdef resource="checkstyletask.properties" classpathref="checkstyle.lib"/>
<mkdir dir="${reports}" />
</target>
<target name="checkstyle-run" depends="checkstyle-init">
<checkstyle failOnViolation="false"
failureProperty="checkstyle.failed"
config="${checkstyle.policy}">
<formatter type="plain"/>
<formatter type="xml" toFile="${checkstyle.report.xml}"/>
<fileset dir="${src}" includes="**/*.java"/>
</checkstyle>
</target>
<path id="cobertura.classpath">
<fileset dir="${cobertura.dir}">
<!--<include name="cobertura.jar" />-->
<include name="**/*.jar" />
</fileset>
</path>
<target name="cover-init">
<taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
</target>
<target name="cover-instrumentation" depends="cover-init">
<delete file="cobertura.ser"/>
<delete dir="${build.instr}" />
<cobertura-instrument todir="${build.instr}">
<fileset dir="${build}">
<include name="**/*.class"/>
<exclude name="**/*Test.class"/>
</fileset>
</cobertura-instrument>
</target>
<target name="cover-run" depends="cover-instrumentation">
<mkdir dir="${reports}/coverage/tests" />
<junit showoutput="true" printsummary="true" fork="yes">
<jvmarg value="-XX:-UseSplitVerifier"/>
<sysproperty key="net.sourceforge.cobertura.datafile" file="${basedir}/cobertura.ser"/>
<classpath location="${build.instr}" />
<classpath refid="test.classpath" />
<classpath refid="cobertura.classpath" />
<formatter type="xml"/>
<batchtest todir="${reports}/coverage/tests" unless="testcase">
<fileset dir="${src.test}">
<include name="**/*Test.java" />
</fileset>
</batchtest>
</junit>
</target>
<target name="cover-report" depends="cover-run">
<cobertura-report datafile="cobertura.ser" format="xml" srcdir="${src.main}" destdir="${reports}"/>
<cobertura-report datafile="cobertura.ser" format="html" srcdir="${src.main}" destdir="${reports}/coverage"/>
</target>
<target name="run" depends="ftp-publish">
<antcall target="checkstyle-run" />
<antcall target="cover-report"/>
</target>
</project>