-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
269 lines (221 loc) · 8.31 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="portableab" default="build" basedir=".">
<description>Portable AddressBook application, Juan Timoteo Ponce Ortiz. UAGRM.</description>
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="urn:maven-artifact-ant" classpath="lib/maven-ant-tasks-2.1.0.jar"/>
<echo>maven.repo.local=${maven.repo.local}</echo>
<target name="mvn-init" unless="mvn.classpath" xmlns:artifact="urn:maven-artifact-ant">
<artifact:pom file="${basedir}/pom.xml" id="maven.project"/>
<artifact:dependencies fileSetId="mvn.classpath">
<pom refid="maven.project"/>
</artifact:dependencies>
</target>
<property file="build.properties" />
<import file="${classpath.location}" />
<path id="compile.classpath">
<fileset dir="lib" includes="*.jar" />
<fileset refid="mvn.classpath" />
</path>
<path id="src.path">
<pathelement location="${project.src}" />
</path>
<path id="run.classpath">
<path refid="compile.classpath" />
<path location="${project.build}" />
<path location="${project.config}" />
<path location="${project.resources}" />
</path>
<path id="test.classpath">
<path refid="run.classpath" />
<path refid="junit.classpath" />
</path>
<target name="init">
<mkdir dir="${project.config}" />
<mkdir dir="${project.resources}" />
<mkdir dir="${project.src}" />
<mkdir dir="${project.test}" />
<mkdir dir="${project.lib}" />
</target>
<target name="compile-test" depends="compile">
<javac encoding="iso-8859-1" destdir="${project.build}" classpathref="test.classpath" includes="**/*.java" debug="true">
<src path="${project.test}" />
</javac>
</target>
<target name="prepare" depends="mvn-init">
<mkdir dir="${project.build}" />
</target>
<target name="build" depends="compile,mvn-init" description="Build the project incrementally.">
</target>
<target name="clean">
<delete dir="${project.build}" />
</target>
<target name="compile" depends="prepare" description="Compile the sources (checked in and generated)">
<copy todir="${project.build}">
<fileset dir="${project.src}">
<include name="**/*.properties" />
</fileset>
<fileset dir="${project.config}">
<include name="*.properties" />
<include name="*.xml" />
</fileset>
</copy>
<javac encoding="iso-8859-1" destdir="${project.build}" classpathref="compile.classpath" includes="**/*.java" debug="true">
<src path="${project.src}" />
</javac>
</target>
<target name="jar" depends="build" description="Build a distribution jar file">
<delete dir="${project.build.dist}" />
<mkdir dir="${project.build.dist}" />
<copy todir="${project.build.dist}/lib">
<fileset dir="lib" includes="*.jar" />
<fileset refid="mvn.classpath" />
</copy>
<copy todir="${project.build.dist}/config">
<fileset dir="${project.config}" includes="*" />
</copy>
<copy todir="${project.build.dist}/resources">
<fileset dir="${project.resources}" includes="**/*" />
</copy>
<copy todir="${project.build.dist}/database">
<fileset dir="${basedir}/database" includes="*.db" />
</copy>
<path id="jar.lib.classpath">
<fileset dir="${project.build.dist}/lib">
<include name="**/*.jar" />
</fileset>
<pathelement location="${project.build.dist}/config" />
<pathelement location="${project.build.dist}/resources" />
</path>
<manifestclasspath property="jar.classpath" jarfile="${project.build.dist}/${dist.jar.name}">
<classpath refid="jar.lib.classpath" />
</manifestclasspath>
<jar destfile="${project.build.dist}/${dist.jar.name}" basedir="${project.build.dist}"
excludes="**">
<manifest>
<attribute name="Built-By" value="${application.author}" />
<section name="common">
<attribute name="Specification-Title" value="${application.name}" />
<attribute name="Specification-Version" value="${application.release}" />
<attribute name="Specification-Vendor" value="${application.author}" />
<attribute name="Implementation-Title" value="${application.name}" />
<attribute name="Implementation-Version" value="${application.release} ${TODAY}" />
</section>
<attribute name="Main-Class" value="${main.class}" />
<attribute name="Class-Path" value="${jar.classpath}" />
</manifest>
<fileset dir="${project.build}">
<include name="**" />
<exclude name="**/*Test.class" />
<exclude name="*.*" />
<exclude name="*.db" />
<exclude name="dist/" />
<exclude name="reports/" />
</fileset>
</jar>
</target>
<!-- currently not used -->
<target name="dist" depends="build,jar">
<property name="base.name" value="${ant.project.name}" />
<delete dir="release" />
<delete dir="dist" />
<mkdir dir="dist" />
<mkdir dir="release" />
<copy todir="release/config">
<fileset dir="config" includes="**" />
</copy>
<copy todir="release/templates">
<fileset dir="templates" includes="**" />
</copy>
<copy todir="release/help">
<fileset dir="help" includes="**" />
</copy>
<copy todir="release/lib">
<fileset dir="lib" includes="**/*.jar" />
</copy>
<copy todir="release/common_libs">
<fileset dir="common_libs" includes="**/*" />
</copy>
<copy todir="release" file="${project.build.dist}/${dist.jar.name}" />
<zip destfile="dist/${release.name}">
<zipfileset dir="release/" includes="**/*.*" />
</zip>
<delete dir="release" />
</target>
<target name="run" description="Run the app" depends="build">
<java classname="${main.class}" fork="true" classpathref="run.classpath" >
<jvmarg value="-Dcurrent.env=${current.env}"/>
</java>
</target>
<target name="copy-libs" description="Copy repo libs to lib folder">
<copy todir="lib">
<path refid="compile.classpath" />
</copy>
</target>
<!-- Tests - - >
<target name="test" depends="compile-test">
<property name="junit.dest" value="${project.build.report}/junit" />
<mkdir dir="${junit.dest}" />
<junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="yes">
<jvmarg value="-Dcurrent.env=test"/>
<classpath>
<path refid="test.classpath" />
</classpath>
<formatter type="plain" usefile="false" />
<formatter type="xml" />
<batchtest todir="${junit.dest}">
<fileset dir="${project.test}">
<include name="**/*Test.java" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${junit.dest}">
<fileset dir="${junit.dest}" includes="TEST-*.xml" />
<report format="frames" todir="${junit.dest}" />
</junitreport>
</target>
-->
<!-- QA - - >
<target name="qa" depends="cpd,findbugs,pmd" />
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="findbugs.classpath" />
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.classpath" />
<taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask" classpathref="pmd.classpath" />
<target name="findbugs" depends="build">
<property name="findbugs.dest" value="${project.build.report}/findbugs" />
<mkdir dir="${findbugs.dest}" />
<findbugs home="${findbugs.home}" output="xml:withMessages" outputFile="${findbugs.dest}/${ant.project.name}-fb.xml">
<auxClasspath refid="compile.classpath" />
<sourcePath path="${project.src}" />
<class location="${project.build}" />
</findbugs>
</target>
<target name="fb-gui" depends="findbugs">
<java jar="${findbugs.home}/lib/findbugs.jar" fork="true">
<jvmarg value="-Xmx256M" />
<arg value="-project" />
<arg value="${findbugs.dest}/${ant.project.name}-fb.xml" />
<sysproperty key="findbugs.home" value="${findbugs.home}" />
</java>
</target>
<target name="pmd" depends="build">
<property name="pmd.dest" value="${project.build.report}/pmd" />
<mkdir dir="${pmd.dest}" />
<pmd shortFilenames="true">
<ruleset>rulesets/favorites.xml</ruleset>
<ruleset>basic</ruleset>
<formatter type="xml" toFile="${pmd.dest}/${ant.project.name}-pmd.xml" linkPrefix="http://pmd.sourceforge.net/xref/" />
<fileset dir="${project.src}">
<include name="**/*.java" />
</fileset>
</pmd>
</target>
<target name="cpd" depends="build">
<property name="cpd.dest" value="${project.build.report}/cpd" />
<mkdir dir="${cpd.dest}" />
<cpd minimumTokenCount="70" format="xml" outputFile="${cpd.dest}/cpd.xml">
<fileset dir="${project.src}">
<include name="**/*.java" />
</fileset>
</cpd>
</target>
-->
</project>