-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
269 lines (232 loc) · 11.6 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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<?xml version="1.0" encoding="UTF-8"?>
<project name="jbomutils" default="all" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
<description>Builds project</description>
<loadproperties srcfile="build.properties" />
<property name="src.dir" value="${basedir}/src" />
<property name="dist.dir" value="${basedir}/dist" />
<property name="dist.lib.dirname" value="lib" />
<property name="dist.lib.dir" value="${dist.dir}/${dist.lib.dirname}" />
<property name="compile.dir" value="${basedir}/build/classes"/>
<property name="lib.dir" value="${basedir}/lib" />
<property name="test.lib.dir" value="${basedir}/testlib" />
<property name="test.dir" value="${basedir}/test"/>
<property name="instr.dir" value="${basedir}/build/instr-classes"/>
<property name="coverage.dir" value="${basedir}/coverage"/>
<property name="compile.test.dir" value="${basedir}/build/test"/>
<property name="test.result.dir" value="${basedir}/reports/tests"/>
<property name="coverage.result.dir" value="${basedir}/reports/coverage"/>
<property name="release.dir" value="${basedir}/releases"/>
<property name="jar.filename" value="${prefix.filename}"/>
<property name="properties.name" value="app.properties"/>
<property name="resource.dir" value="${basedir}/resources"/>
<property name="javadoc.dir" value="${basedir}/javadoc"/>
<patternset id="compiler.resources">
<include name="**/?*.properties"/>
<include name="**/?*.xml"/>
<include name="**/?*.txt"/>
<include name="**/?*.gif"/>
<include name="**/?*.png"/>
<include name="**/?*.jpeg"/>
<include name="**/?*.jpg"/>
<include name="**/?*.html"/>
</patternset>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="${test.lib.dir}/jacocoant.jar"/>
</taskdef>
<target name="compile">
<mkdir dir="${compile.dir}"/>
<!-- <mkdir dir="${lib.dir}" /> -->
<javac srcdir="${src.dir}" destdir="${compile.dir}" includes="**/*.java" target="${target.java}" source="${target.java}" debug="true"
debuglevel="lines,vars,source" includeantruntime="false" encoding="utf-8">
<compilerarg line="-Xlint:unchecked"/> <!-- For Java 8: -Xdiags:verbose -->
<classpath>
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</classpath>
</javac>
<copy todir="${compile.dir}">
<fileset dir="${src.dir}">
<patternset refid="compiler.resources"/>
<type type="file"/>
</fileset>
</copy>
</target>
<target name="compile-tests">
<mkdir dir="${test.dir}" />
<delete dir="${compile.test.dir}"/>
<mkdir dir="${compile.test.dir}"/>
<javac srcdir="${test.dir}" destdir="${compile.test.dir}" includes="**/*.java" target="${target.java}" source="${target.java}" debug="true" includeantruntime="false" encoding="utf-8">
<classpath>
<pathelement path="${compile.dir}"/>
<!-- <fileset dir="${lib.dir}" includes="**/*.jar"/> -->
<fileset dir="${test.lib.dir}" includes="**/*.jar"/>
</classpath>
</javac>
</target>
<target name="test" depends="compile,compile-tests">
<delete dir="${test.result.dir}"/>
<mkdir dir="${test.result.dir}"/>
<mkdir dir="${test.result.dir}/raw/"/>
<taskdef classname="org.testng.TestNGAntTask" classpath="${test.lib.dir}/testng-6.8.jar" name="testng" />
<mkdir dir="${coverage.dir}" />
<jacoco:coverage destfile="${coverage.dir}/jacoco.exec">
<testng outputDir="${test.result.dir}" haltOnFailure="true" verbose="2" workingDir="${basedir}">
<classpath>
<pathelement path="${compile.test.dir}"/>
<pathelement path="${instr.dir}"/>
<pathelement path="${compile.dir}"/>
<fileset dir="${lib.dir}" includes="**/*.jar"/>
<fileset dir="${test.lib.dir}" includes="**/*.jar"/>
</classpath>
<jvmarg value="-noverify" />
<jvmarg value="-Demma.coverage.out.file=${coverage.dir}/coverage.emma"/>
<jvmarg value="-Demma.coverage.out.merge=true"/>
<classfileset dir="${compile.test.dir}" includes="**/*.class" />
</testng>
</jacoco:coverage>
<!-- Coverage report -->
<mkdir dir="${coverage.result.dir}"/>
<jacoco:report>
<!-- sourcepath="${src.dir}"-->
<executiondata>
<file file="${coverage.dir}/jacoco.exec" />
</executiondata>
<structure name="${project.name}">
<classfiles>
<fileset dir="${compile.dir}" />
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${src.dir}" />
</sourcefiles>
</structure>
<html destdir="${coverage.result.dir}" />
</jacoco:report>
</target>
<target name="release" depends="dist">
<mkdir dir="${release.dir}"/>
<copy file="${dist.dir}/${jar.filename}.jar" tofile="${release.dir}/${prefix.filename}_${version}${version.suffix}.jar" />
</target>
<target name="all" depends="clean,build,test,javadoc,release">
</target>
<target name="dist" depends="build">
<mkdir dir="${resource.dir}" />
<copy todir="${dist.dir}">
<fileset dir="${resource.dir}" includes="**/*.*"/>
</copy>
</target>
<target name="-timestamp">
<tstamp>
<format property="built.at" pattern="MM/dd/yyyy hh:mm aa" timezone="CET"/>
<format property="ver.date" pattern="yyyyddMM_hhmm" timezone="CET"/>
</tstamp>
<echo level="info" message="Version: ${version}"/>
</target>
<target name="build" depends="-timestamp,compile">
<mkdir dir="${dist.dir}"/>
<!--<mkdir dir="${dist.lib.dir}"/>
<copy todir="${dist.lib.dir}">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</copy>-->
<propertyfile file="${compile.dir}/${properties.name}" comment="This file is automatically generated - DO NOT EDIT">
<entry key="buildtime" value="${built.at}"/>
<entry key="version" value="${version}"/>
</propertyfile>
<pathconvert pathsep=" " property="manifestClassPath">
<fileset dir="${dist.dir}" includes="${dist.lib.dirname}/**/*.*"/>
<chainedmapper>
<flattenmapper/>
<globmapper from="*" to="${dist.lib.dirname}/*"/>
</chainedmapper>
</pathconvert>
<jar destfile="${dist.dir}/${jar.filename}.jar" basedir="${compile.dir}">
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
<attribute name="Class-Path" value="${manifestClassPath}"/>
</manifest>
</jar>
</target>
<target name="run" depends="build">
<java jar="${dist.dir}/${jar.filename}.jar" fork="true">
<arg line="${run.params}" />
</java>
</target>
<target name="javadoc">
<mkdir dir="${javadoc.dir}"/>
<javadoc sourcepath="${src.dir}" destdir="${javadoc.dir}" windowtitle="${project.name}"
useexternalfile="yes">
<fileset dir="${src.dir}" includes="**/*.java"/>
<!--<classpath>
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</classpath>-->
</javadoc>
</target>
<target name="clean">
<delete dir="${dist.dir}"/>
<delete dir="${compile.test.dir}"/>
<delete dir="${compile.dir}"/>
<delete dir="${coverage.dir}"/>
<delete dir="${test.result.dir}"/>
<delete dir="${instr.dir}"/>
</target>
<!-- Debug one test method (Netbeans IDE) -->
<target name="debug-test-method" depends="compile-tests">
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
<fail unless="test.method">Must select some method in the IDE or set test.method</fail>
<delete dir="${test.result.dir}"/>
<mkdir dir="${test.result.dir}"/>
<mkdir dir="${test.result.dir}/raw/"/>
<nbjpdastart addressproperty="jpda.address" name="ffdec" transport="dt_socket">
<classpath>
<pathelement path="${compile.dir}"/>
<!-- <fileset dir="${lib.dir}" includes="**/*.jar"/>-->
<fileset dir="${test.lib.dir}" includes="**/*.jar"/>
</classpath>
</nbjpdastart>
<taskdef classname="org.testng.TestNGAntTask" classpath="${test.lib.dir}/testng-6.8.jar" name="testng" />
<testng
outputDir="${test.result.dir}"
haltOnFailure="false" verbose="2" workingDir="${basedir}" methods="${test.class}.${test.method}">
<classpath>
<pathelement path="${compile.test.dir}"/>
<pathelement path="${instr.dir}"/>
<pathelement path="${compile.dir}"/>
<fileset dir="${lib.dir}" includes="**/*.jar"/>
<fileset dir="${test.lib.dir}" includes="**/*.jar"/>
</classpath>
<jvmarg value="-noverify" />
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<classfileset dir="${compile.test.dir}" includes="**/*.class" />
</testng>
</target>
<!-- Sample mkbom task -->
<target name="run-task-mkbom" depends="build">
<taskdef name="mkbom" classname="com.jpexs.jbomutils.ant.MkBomTask" classpath="${dist.dir}/${jar.filename}.jar" />
<mkbom destfile="${basedir}/Bom" verbose="true">
<tarfileset dir="${basedir}/base" prefix="data/">
<patternset>
<include name="**/*.jpg"/>
</patternset>
</tarfileset>
<tarfileset dir="${basedir}/src" prefix="source/">
<patternset>
<include name="**/*.java"/>
</patternset>
</tarfileset>
</mkbom>
</target>
<!-- Other tasks not (yet?) implemented -->
<target name="run-task-dumpbom" depends="build">
<taskdef name="dumpbom" classname="com.jpexs.jbomutils.ant.DumpBomTask" classpath="${dist.dir}/${jar.filename}.jar" />
<dumpbom />
</target>
<target name="run-task-lsbom" depends="build">
<taskdef name="lsbom" classname="com.jpexs.jbomutils.ant.LsBomTask" classpath="${dist.dir}/${jar.filename}.jar" />
<lsbom />
</target>
<target name="run-task-ls4mkbom" depends="build">
<taskdef name="ls4mkbom" classname="com.jpexs.jbomutils.ant.Ls4MkBomTask" classpath="${dist.dir}/${jar.filename}.jar" />
<ls4mkbom />
</target>
<target name="run-tasks" depends="run-task-mkbom,run-task-lsbom,run-task-ls4mkbom,run-task-dumpbom">
</target>
</project>