-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathbuild.xml
318 lines (265 loc) · 13.4 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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
<?xml version="1.0" encoding="UTF-8"?>
<!--
Universal Password Manager
Copyright (C) 2005-2011 Adrian Smith
This file is part of Universal Password Manager.
Universal Password Manager is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Universal Password Manager is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Universal Password Manager; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-->
<project name="Universal Password Manager" default="package-jar" basedir=".">
<property file="build.properties"/>
<!-- Set all the project properties -->
<property name="src" value="src"/>
<property name="test.src" value="test"/>
<property name="build" value="build"/>
<property name="build.instrumented" value="build.instrumented"/>
<property name="test.build" value="testbuild"/>
<property name="dist" value="dist"/>
<property name="short.name" value="upm"/>
<property name="full.name" value="UPM"/>
<property name="lib" value="lib"/>
<property name="coveragereport.dir" value="coveragereport.dir"/>
<property name="version" value="1.15.2" />
<!-- Define a classpath for use later on -->
<path id="project.class.path">
<pathelement path="${build}"/>
<pathelement path="${test.build}"/>
<fileset dir="${lib}">
<include name="*.jar"/>
</fileset>
</path>
<!-- The clean target cleans the environment -->
<target name="clean">
<delete dir="${build}"/>
<delete dir="${test.build}"/>
<delete dir="${dist}"/>
<delete dir="${build.instrumented}"/>
<delete dir="${coveragereport.dir}"/>
<delete>
<fileset dir="${basedir}" includes="TEST-*"/>
</delete>
<delete file="cobertura.ser"/>
</target>
<!-- The compile target compiles the source -->
<target name="compile">
<mkdir dir="${build}"/>
<javac srcdir="${src}" destdir="${build}" debug="on" failonerror="true" source="8" target="8" includeAntRuntime="no">
<classpath refid="project.class.path"/>
<compilerarg value="-Xbootclasspath/p:${toString:project.class.path}"/>
</javac>
<mkdir dir="${test.build}"/>
<javac srcdir="${test.src}" destdir="${test.build}" debug="on" failonerror="true" source="8" target="8" includeAntRuntime="no">
<classpath refid="project.class.path"/>
<compilerarg value="-Xbootclasspath/p:${toString:project.class.path}"/>
</javac>
<copy todir="${build}">
<fileset dir="${src}">
<exclude name="**\*.java"/>
</fileset>
</copy>
</target>
<target name="checkversion">
<fail unless="version" message="Need to pass the parameter 'version' to this target"/>
</target>
<target name="package-jar" depends="checkversion, clean, compile">
<delete dir="${dist}"/>
<mkdir dir="${dist}\build"/>
<jar destfile="${dist}\build\${short.name}.jar" basedir="${build}" includes="**\*.class **\*.gif **\*.png **\*.properties">
<manifest>
<attribute name="Implementation-Title" value="${short.name}"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Class-Path" value="commons-codec-1.3.jar commons-httpclient-3.0.jar commons-logging-1.1.jar bcprov-jdk14-145.jar javacsv.jar commons-validator-1.4.0.jar"/>
<attribute name="Main-Class" value="com._17od.upm.gui.MainWindow"/>
</manifest>
</jar>
</target>
<!-- Package the basic JAR distribution -->
<target name="package-tgz" depends="package-jar">
<copy file="${basedir}\server\http\upload.php" todir="${dist}\build\server\http"/>
<copy file="${basedir}\server\http\deletefile.php" todir="${dist}\build\server\http"/>
<copy file="${basedir}\lib\commons-codec-1.3.jar" todir="${dist}\build"/>
<copy file="${basedir}\lib\commons-httpclient-3.0.jar" todir="${dist}\build"/>
<copy file="${basedir}\lib\commons-logging-1.1.jar" todir="${dist}\build"/>
<copy file="${basedir}\lib\bcprov-jdk14-145.jar" todir="${dist}\build"/>
<copy file="${basedir}\lib\javacsv.jar" todir="${dist}\build"/>
<copy file="${basedir}\lib\commons-validator-1.4.0.jar" todir="${dist}\build"/>
<copy file="${basedir}\images\128x128\upm.png" tofile="${dist}\build\upm.png"/>
<copy file="${basedir}\COPYING.txt" todir="${dist}\build"/>
<copy file="${basedir}\README.txt" todir="${dist}\build"/>
<tar destfile="${dist}\${short.name}-${version}.tar">
<tarfileset file="${basedir}\bin\upm.sh" prefix="${short.name}-${version}" filemode="755"/>
<tarfileset dir="${dist}\build" prefix="${short.name}-${version}"/>
</tar>
<gzip src="${dist}\${short.name}-${version}.tar" destfile="${dist}\${short.name}-${version}.tar.gz"/>
<delete file="${dist}\${short.name}-${version}.tar"/>
</target>
<!-- Package the source distribution -->
<target name="package-src" depends="checkversion">
<tar destfile="${dist}\${short.name}-src-${version}.tar">
<tarfileset dir="${basedir}" prefix="${short.name}-src-${version}">
<include name="Authors"/>
<include name="bin\**"/>
<include name="build.properties.tmpl"/>
<include name="build.xml"/>
<include name="contrib\**"/>
<include name="COPYING.txt"/>
<include name="debian\**"/>
<include name="images\**"/>
<include name="lib\**"/>
<include name="nsis\upm.nsi"/>
<include name="README_DEV.txt"/>
<include name="README.txt"/>
<include name="server\**"/>
<include name="src\**"/>
<include name="test\**"/>
<include name="upm.properties.tmpl"/>
</tarfileset>
</tar>
<gzip src="${dist}\${short.name}-src-${version}.tar" destfile="${dist}\${short.name}-src-${version}.tar.gz"/>
<delete file="${dist}\${short.name}-src-${version}.tar"/>
</target>
<!-- Package Mac OS X distribution -->
<target name="package-osx" depends="package-jar">
<property name="dist-mac-dir" value="${basedir}/${dist}/${short.name}-mac-${version}"/>
<mkdir dir="${dist-mac-dir}"/>
<copy file="${basedir}\server\http\upload.php" todir="${dist-mac-dir}\server\http"/>
<copy file="${basedir}\server\http\deletefile.php" todir="${dist-mac-dir}\server\http"/>
<copy file="${basedir}\COPYING.txt" todir="${dist-mac-dir}"/>
<copy file="${basedir}\README.txt" todir="${dist-mac-dir}"/>
<!--
Plugin Home: https://github.com/TheInfiniteKind/appbundler
JDKs on OS X are installed to /Library/Java/JavaVirtualMachines/
To list the installed versions run "/usr/libexec/java_home -V"
JREs on OX X are installed to /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/
Apps created with the appbundler plugin don't work with JDK 12. They do work with a JRE (tested with 1.8.0_211).
-->
<taskdef name="bundleapp"
classpath="${lib}/appbundler-1.0ea.jar"
classname="com.oracle.appbundler.AppBundlerTask"/>
<bundleapp
outputdirectory="${dist-mac-dir}"
name="${full.name}"
displayname="${full.name}"
executableName="UPM"
identifier="com._17od.upm.gui.MainWindow"
shortversion="${version}"
version="${version}"
icon="${basedir}\images\upm.icns"
mainclassname="com._17od.upm.gui.MainWindow"
copyright="2019 Adrian Smith"
applicationCategory="public.app-category.utilities">
<arch name="x86_64"/>
<arch name="i386"/>
<option value="-Xdock:name=${full.name}"/>
<option value="-Dapple.laf.useScreenMenuBar=true"/>
<option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
<option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
<option value="-Dcom.apple.mrj.application.apple.menu.about.name=${app.name}"/>
<option value="-Dcom.apple.smallTabs=true"/>
<option value="-Dfile.encoding=UTF-8"/>
<classpath dir="${basedir}\lib" includes="commons-codec-1.3.jar, commons-httpclient-3.0.jar, commons-logging-1.1.jar bcprov-jdk14-145.jar javacsv.jar commons-validator-1.4.0.jar"/>
<classpath dir="${dist}\build" includes="${short.name}.jar"/>
</bundleapp>
<exec executable="tar" dir="${basedir}">
<arg line="-czvf dist/${short.name}-mac-${version}.tar.gz -C dist/ ${short.name}-mac-${version}"/>
</exec>
</target>
<!-- Package Windows installer -->
<target name="package-windows" depends="package-jar">
<exec executable="makensis" dir="${basedir}">
<arg line="-DUPM_VERSION=${version} ${basedir}/nsis/upm.nsi"/>
</exec>
<move file="${basedir}/nsis/upm-${version}.exe" todir="${dist}"/>
</target>
<target name="package-all" depends="package-tgz, package-src, package-osx, package-windows"/>
<target name="instrument-classes" depends="compile">
<path id="cobertura.classpath">
<fileset dir="${cobertura.dir}">
<include name="cobertura.jar" />
<include name="lib\**\*.jar" />
</fileset>
</path>
<taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
<!-- Compile the Cobertura instrumented classes -->
<delete file="cobertura.ser"/>
<cobertura-instrument todir="${build.instrumented}">
<fileset dir="${build}"/>
</cobertura-instrument>
</target>
<target name="test" depends="compile">
<!-- I had to put the junit.jar file into my ANT_HOME\lib in order for
the junit task to work -->
<junit haltonerror="on" haltonfailure="on" printsummary="on" showoutput="on" fork="yes">
<classpath location="${build}"/>
<classpath refid="project.class.path"/>
<jvmarg value="-Djunit.properties=${basedir}/build.properties"/>
<jvmarg value="-Dupm.properties=${basedir}/upm.properties"/>
<formatter type="plain"/>
<batchtest if="test">
<fileset dir="${test.build}">
<include name="**\${test}.class"/>
</fileset>
</batchtest>
<batchtest unless="test">
<fileset dir="${test.build}">
<include name="**\*.class"/>
<exclude name="**\TestHTTPTransport.class"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="int-test" depends="compile" description="Run integration tests">
<junit haltonerror="on" haltonfailure="on" printsummary="on" showoutput="on" fork="yes">
<classpath location="${build}"/>
<classpath refid="project.class.path"/>
<jvmarg value="-Djunit.properties=${basedir}/build.properties"/>
<jvmarg value="-Dupm.properties=${basedir}/upm.properties"/>
<formatter type="plain"/>
<batchtest>
<fileset dir="${test.build}">
<include name="**\TestHTTPTransport.class"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="coverage" depends="instrument-classes">
<junit haltonerror="on" haltonfailure="on" printsummary="on" showoutput="on" fork="yes">
<sysproperty key="net.sourceforge.cobertura.datafile" file="${basedir}/cobertura.ser"/>
<classpath location="${build.instrumented}"/>
<classpath refid="project.class.path"/>
<classpath refid="cobertura.classpath"/>
<jvmarg value="-Djunit.properties=${basedir}/build.properties"/>
<jvmarg value="-Dupm.properties=${basedir}/upm.properties"/>
<formatter type="plain"/>
<batchtest if="test">
<fileset dir="${test.build}">
<include name="**\${test}.class"/>
</fileset>
</batchtest>
<batchtest unless="test">
<fileset dir="${test.build}">
<include name="**\*.class"/>
</fileset>
</batchtest>
</junit>
<cobertura-report format="html" destdir="${coveragereport.dir}" srcdir="${src}"/>
</target>
<target name="localise">
<native2ascii encoding="UTF-16BE" src="${src}" dest="${src}" includes="**/*.unicode" ext=".properties"/>
</target>
<target name="run" depends="compile">
<java classname="com._17od.upm.gui.MainWindow"
classpathref="project.class.path"
fork="true"
spawn="true"/>
</target>
</project>