-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmybuild.xml
240 lines (168 loc) · 8.52 KB
/
mybuild.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
<?xml version="1.0"?>
<!-- ===================================================================== -->
<!-- Spreadsheet build file -->
<!-- ===================================================================== -->
<!-- Defined the variables JAVA_HOME and ANT_HOME -->
<project name="jpa-derby-test" default="jar" basedir=".">
<property environment="env"/>
<property name="app.name" value="jpa-derby-test"/>
<property name="meta.dir" value="${basedir}/meta"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="src.test.dir" value="${basedir}/test"/>
<property name="properties.dir" value="${basedir}/properties"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="build.classes.dir" value="${build.dir}/classes"/>
<property name="build.classes.test.dir" value="${build.dir}/test"/>
<property name="build.lib.dir" value="${build.dir}/lib"/>
<property name="build.report.dir" value="${build.dir}/report"/>
<property name="dist.dir" value="${basedir}/dist"/>
<property name="db.dir" value="${basedir}/myDB"/>
<!-- ===================================================================== -->
<!-- Classpath -->
<!-- ===================================================================== -->
<path id="classpath">
<fileset dir="${basedir}/lib">
<include name="**/*.jar"/>
</fileset>
<pathelement location="${build.classes.dir}"/>
<pathelement location="${build.classes.test.dir}"/>
</path>
<!-- =================================================================== -->
<!-- Prepares the build directory -->
<!-- =================================================================== -->
<target name="prepare" >
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes.dir}"/>
<mkdir dir="${build.classes.test.dir}"/>
<mkdir dir="${build.lib.dir}"/>
<mkdir dir="${build.report.dir}"/>
<mkdir dir="${build.report.dir}/html"/>
<mkdir dir="${dist.dir}"/>
<!-- Copy the library jar files -->
<copy todir="${build.lib.dir}">
<fileset dir = "${basedir}/lib">
</fileset>
</copy>
<copy todir="${build.classes.dir}">
<fileset dir = "${src.dir}">
<include name="META-INF/**"/>
</fileset>
</copy>
</target>
<!-- =================================================================== -->
<!-- Compiles the source code -->
<!-- =================================================================== -->
<target name="compile.java" depends="prepare">
<javac srcdir="${src.dir}"
destdir="${build.classes.dir}"
debug="on"
deprecation="on"
optimize="off"
includes="**">
<classpath refid="classpath"/>
</javac>
</target>
<!-- =================================================================== -->
<!-- Compiles the tests -->
<!-- =================================================================== -->
<target name="compile.test" depends="compile.java">
<javac srcdir="${src.test.dir}"
destdir="${build.classes.test.dir}"
debug="on"
deprecation="on"
optimize="off"
includes="**">
<classpath refid="classpath"/>
</javac>
</target>
<!-- =================================================================== -->
<!-- Compiles everything -->
<!-- =================================================================== -->
<target name="compile" depends="compile.java, compile.test"/>
<!-- =================================================================== -->
<!-- Builds application: jpa-derby-test.jar -->
<!-- =================================================================== -->
<target name="jar" depends="compile">
<jar jarfile="${basedir}/${app.name}.jar"
manifest="${meta.dir}/manifest.mf">
<fileset dir="${build.classes.dir}">
<include name="**"/>
</fileset>
<fileset dir="${basedir}">
<include name="lib/**"/>
</fileset>
</jar>
<move file="${app.name}.jar" todir="${dist.dir}"/>
</target>
<!-- =================================================================== -->
<!-- Performs unit tests -->
<!-- =================================================================== -->
<target name="test" depends="compile">
<junit printsummary="yes" haltonerror="yes" haltonfailure="yes"
fork="yes">
<!-- fork="yes" would not force to include junit.jar in apache-ant/lib -->
<formatter type = "xml" />
<classpath>
<path refid="classpath"/>
</classpath>
<batchtest todir="${build.report.dir}" >
<fileset dir="${src.test.dir}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${build.report.dir}">
<fileset dir="${build.report.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report todir="${build.report.dir}/html"/>
</junitreport>
</target>
<!-- =================================================================== -->
<!-- Cleans up DB -->
<!-- =================================================================== -->
<target name="cleandb">
<delete dir="${db.dir}"/>
</target>
<!-- =================================================================== -->
<!-- Cleans up generated stuff -->
<!-- =================================================================== -->
<target name="clean" >
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
<delete dir="${db.dir}"/>
<delete>
<fileset dir="${basedir}" includes="**/*.jdbc"/>
<fileset dir="${basedir}" includes="**/*.log"/>
</delete>
</target>
<!-- =================================================================== -->
<!-- SONAR -->
<!-- =================================================================== -->
<target name="sonar">
<property name="sonar.projectKey" value="org.codehaus.sonar:fofo" />
<property name="sonar.projectName" value="FOFO" />
<property name="sonar.projectVersion" value="1.0" />
<property name="sonar.sources" value="${src.dir}" />
<property name="sonar.tests" value="${src.test.dir}" />
<property name="sonar.binaries" value="${build.classes.dir}" />
<property name="sonar.dynamicAnalysis" value="reuseReports" />
<property name="sonar.surefire.reportsPath" value="${build.report.dir}" />
<property name="sonar.core.codeCoveragePlugin" value="jacoco" />
<!--<property name="sonar.jacoco.reportPath" value="${build.report.dir}/coverage/jacoco.exec" />-->
<!-- Sonar DB connection -->
<property name="sonar.jdbc.url" value="jdbc:h2:tcp://localhost:9092/sonar" />
<property name="sonar.jdbc.driverClassName" value="org.h2.Driver" />
<property name="sonar.jdbc.username" value="sonar" />
<property name="sonar.jdbc.password" value="sonar" />
<!-- Sonar server URL -->
<property name="sonar.host.url" value="http://localhost:9000" />
<!-- Ant Task -->
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<classpath path="$ANT_HOME/lib/" />
</taskdef>
<!-- Execute Sonar -->
<sonar:sonar xmlns:sonar="antlib:org.sonar.ant"/>
</target>
</project>