-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
executable file
·271 lines (258 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
270
271
<?xml version="1.0" encoding="UTF-8"?>
<project name="memoranda" default="package" basedir="." xmlns:jacoco="antlib:org.jacoco.ant" xmlns:cs="antlib:com.puppycrawl.tools.checkstyle.ant">
<!-- Build.xml file initially created by Kenneth J. Pouncey -->
<!-- on 5 september 2003. -->
<!-- Kenneth is the project-leader of the tn5250j-project on SourceForge -->
<!-- Thank you dude for your contribution to our project ! -->
<!-- You can reach him through email : kjpou@pt.lu -->
<!--=====================================================================-->
<!--$Id: build.xml,v 1.18 2007/04/06 21:12:24 alexeya Exp $-->
<!-- set global properties for this build -->
<property name="name" value="memoranda"/>
<property name="version" value="1.0-rc3.1"/>
<property name="source.dir" value="${basedir}/src"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="build.classes.dir" value="${build.dir}"/>
<property name="main.class" value="net.sf.memoranda.Start"/>
<property name="tests.dir" value="${build.dir}/tests"/>
<property name="tests.junit.dir" value="${tests.dir}/junit"/>
<property name="tests.jacoco.dir" value="${tests.dir}/jacoco"/>
<property name="tests.findbugs.dir" value="${tests.dir}/findbugs"/>
<property name="tests.checkstyle.dir" value="${tests.dir}/checkstyle"/>
<property name="jarname" value="${name}.jar"/>
<property name="dist.dir" value="${basedir}/dist"/>
<!-- compile options -->
<property name="debug" value="off"/>
<property name="debuglevel" value="lines,vars,source"/>
<property name="optimize" value="off"/>
<property name="deprecation" value="off"/>
<taskdef resource="org/jacoco/ant/antlib.xml"
uri="antlib:org.jacoco.ant"
classpath="${lib.dir}/jacocoant.jar"/>
<taskdef name="findbugs"
classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
classpath="${lib.dir}/findbugs-ant.jar"/>
<taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
classpath="lib/checkstyle-6.15-all.jar"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build.dir}"/>
</target>
<!-- classpath -->
<path id="classpath">
<pathelement path="${build.classes.dir}"/>
<fileset dir="lib">
<include name="*.jar"/>
<include name="*.zip"/>
</fileset>
</path>
<!-- =================================================================== -->
<!-- Creates the Jar -->
<!-- =================================================================== -->
<target name="package" depends="clean,compile" description="Create a Jar-File of your compiled classes">
<tstamp>
<format property="ts" pattern="MM/dd/yyyy HH:mm:ss z"/>
</tstamp>
<jar jarfile="${build.dir}/${jarname}">
<fileset dir="${build.classes.dir}" includes="*net/**"/>
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
<!--<attribute name="Class-Path" value="${runtime.classpath}"/>-->
<attribute name="Implementation-Title" value="${name}"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="http://memoranda.sf.net"/>
<attribute name="Build-Id" value="${DSTAMP}.${build.number} (${ts} ${user.name} [${os.name} ${os.version} ${os.arch}])"/>
</manifest>
</jar>
</target>
<target name="compile" depends="init">
<!-- Compile the java code from ${src} into ${build} -->
<buildnumber/>
<move file="${source.dir}/net/sf/memoranda/ui/App.java" tofile="${source.dir}/net/sf/memoranda/ui/~~App.java"/>
<copy file="${source.dir}/net/sf/memoranda/ui/~~App.java" tofile="${source.dir}/net/sf/memoranda/ui/App.java"/>
<replace file="${source.dir}/net/sf/memoranda/ui/App.java" token="@VERSION@" value="${version}"/>
<replace file="${source.dir}/net/sf/memoranda/ui/App.java" token="@BUILD@" value="${DSTAMP}.${build.number}"/>
<javac srcdir="${source.dir}" destdir="${build.classes.dir}" excludes="**/Cvs/**,**/*.ini,**/~*" debug="${debug}" debuglevel="${debuglevel}" optimize="${optimize}" deprecation="${deprecation}" failonerror="false" source="1.8" target="1.8" encoding = "utf-8" includeantruntime = "false">
<!-- <compilerarg value="-Xlint:unchecked"/> -->
<classpath>
<path refid="classpath"/>
</classpath>
</javac>
<move file="${source.dir}/net/sf/memoranda/ui/~~App.java" tofile="${source.dir}/net/sf/memoranda/ui/App.java"/>
<delete file="${source.dir}/net/sf/memoranda/ui/~~App.java"/>
<copy todir="${build.classes.dir}/net/sf/memoranda/ui/resources">
<fileset dir="${source.dir}/net/sf/memoranda/ui/resources"/>
</copy>
<copy todir="${build.classes.dir}/net/sf/memoranda/ui/htmleditor/resources">
<fileset dir="${source.dir}/net/sf/memoranda/ui/htmleditor/resources"/>
</copy>
<copy todir="${build.classes.dir}/net/sf/memoranda/util/resources">
<fileset dir="${source.dir}/net/sf/memoranda/util/resources"/>
</copy>
<copy todir="${build.classes.dir}/net/sf/memoranda/util/localmessages">
<fileset dir="${source.dir}/net/sf/memoranda/util/localmessages"/>
</copy>
<copy todir="${basedir}/build">
<fileset dir="." includes="tasklist.dtd"/>
</copy>
</target>
<target name="checkbuild">
<available file="${build.dir}/${jarname}" property="build.present"/>
</target>
<target name="build-if-needed" depends="checkbuild" unless="build.present">
<antcall target="package"/>
</target>
<target name="dist-full" depends="init, build-if-needed">
<!-- Create the full distribution includes:
build (build\)
sources (src\)
dependencies (\lib)
-->
<property name="dist.content.dir" value="${dist.dir}/${name}${version}-${DSTAMP}"/>
<mkdir dir="${dist.content.dir}"/>
<copy todir="${dist.content.dir}/src">
<fileset dir="${source.dir}"/>
</copy>
<copy todir="${dist.content.dir}/build">
<fileset dir="${build.dir}" includes="*.jar"/>
</copy>
<copy todir="${dist.content.dir}/lib">
<fileset dir="${lib.dir}"/>
</copy>
<copy todir="${dist.content.dir}">
<fileset dir="." includes="build.xml"/>
</copy>
<copy todir="${dist.content.dir}">
<fileset dir="." includes="LICENSE"/>
</copy>
<copy todir="${dist.content.dir}">
<fileset dir="." includes="memoranda.bat"/>
</copy>
<copy todir="${dist.content.dir}">
<fileset dir="." includes="memoranda.sh"/>
</copy>
<copy todir="${dist.content.dir}">
<fileset dir="." includes="README.txt"/>
</copy>
<copy todir="${dist.content.dir}">
<fileset dir="." includes="FAQ.txt"/>
</copy>
<copy todir="${dist.content.dir}">
<fileset dir="." includes="CHANGES.txt"/>
</copy>
<copy todir="${dist.content.dir}">
<fileset dir="." includes="BUILD.txt"/>
</copy>
<copy todir="${dist.content.dir}">
<fileset dir="." includes="tasklist.dtd"/>
</copy>
<zip zipfile="${dist.dir}/${name}${version}-${DSTAMP}.zip">
<fileset dir="${dist.dir}" includes="${name}${version}-${DSTAMP}/**"/>
</zip>
</target>
<target name="dist" depends="init, clean-dist">
<antcall target="dist-full"/>
</target>
<target name="clean">
<!-- Delete the ${build} directory tree -->
<delete dir="${build.dir}"/>
<!--<delete dir="${dist.dir}"/>-->
</target>
<target name="clean-dist">
<delete dir="${dist.dir}"/>
</target>
<!-- =================================================================== -->
<!-- Runs the compiled program -->
<!-- =================================================================== -->
<target name="run" depends="compile" description="Run the program">
<!--<copy todir="${build}">
<fileset dir="${lib.dir}" >
<include name="*.jar" />
<include name="*.zip" />
</fileset>
</copy>-->
<java classname="${main.class}" fork="true">
<classpath refid="classpath"/>
</java>
<!--
<java jar="${build.dir}/${jarname}" fork="yes">
<classpath refid="classpath"/>
</java> -->
</target>
<!-- =================================================================== -->
<!-- Runs the JUnit Test -->
<!-- =================================================================== -->
<target name="junit" depends="compile" description="Runs the JUnit tests">
<delete dir="${test.junit.dir}"/>
<delete dir="${test.jacoco.dir}"/>
<mkdir dir="${tests.junit.dir}"/>
<mkdir dir="${tests.jacoco.dir}"/>
<jacoco:coverage destfile="lib/jacoco.exec">
<junit printsummary="withOutAndErr" haltonfailure="yes" fork="on">
<classpath>
<path refid="classpath" />
</classpath>
<formatter type="xml"/>
<batchtest todir="${tests.junit.dir}">
<fileset dir="${source.dir}">
<include name="**/*Test*.java"/>
</fileset>
</batchtest>
</junit>
</jacoco:coverage>
<junitreport todir="${tests.junit.dir}">
<fileset dir="${tests.junit.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" styledir="${lib.dir}" todir="${tests.junit.dir}" />
</junitreport>
<jacoco:report>
<executiondata>
<file file="lib/jacoco.exec"/>
</executiondata>
<structure name="Memoranda">
<classfiles>
<fileset dir="${build.classes.dir}"/>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="src"/>
</sourcefiles>
</structure>
<html destdir="${tests.jacoco.dir}"/>
<xml destfile="${tests.jacoco.dir}/jacoco.xml"/>
<csv destfile="${tests.jacoco.dir}/jacoco.csv"/>
</jacoco:report>
</target>
<!-- =================================================================== -->
<!-- Runs findbugs -->
<!-- =================================================================== -->
<target name="findbugs" depends="compile" description="Runs findbugs">
<mkdir dir="${tests.findbugs.dir}"/>
<findbugs home="${lib.dir}"
reportLevel="high"
output="html"
outputFile="${tests.findbugs.dir}/findbugs.html" >
<auxClasspath refid="classpath"/>
<sourcePath path="${source.dir}" />
<class location="${build.classes.dir}" />
</findbugs>
</target>
<!-- =================================================================== -->
<!-- Runs checkstyle -->
<!-- =================================================================== -->
<target name="checkstyle" depends="compile" description="Runs checkstyle">
<mkdir dir="${tests.checkstyle.dir}"/>
<checkstyle config="${lib.dir}/CST316CheckstyleConfig.xml"
failureProperty="checkstyle.failure"
failOnViolation="false">
<classpath>
<path refid = "classpath"/>
</classpath>
<formatter type="xml" tofile="${tests.checkstyle.dir}/checkstyle_report.xml"/>
<fileset dir="${source.dir}" includes="**/*.java"/>
</checkstyle>
</target>
</project>