forked from TimeSlotTracker/timeslottracker-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
240 lines (196 loc) · 9.5 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
Need ANT: 1.7+, Maven 3.x
-->
<project default="run" name="TimeSlotTracker" basedir=".">
<loadproperties srcfile="./build.properties"/>
<property environment="env"/>
<property name="user.homedir" value="${env.HOME}"/>
<property name="deploy" location="target"/>
<property name="deploy.deb" location="resources/installers/deb/debian/tmp"/>
<property name="target.core" location="modules/core/target"/>
<property name="target.full" location="modules/full/target"/>
<property name="jar.artifact" location="modules/core/target/tst.jar"/>
<property name="jar.artifact.full" location="modules/full/target/tst-full.jar"/>
<property name="extra_files" value="resources/extra_files"/>
<property name="release.docs" location="resources/for-release"/>
<property name="nsis" value="makensis"/>
<!-- release remote paths -->
<property name="scp.url.base"
value="${username},timeslottracker@frs.sourceforge.net:/home/frs/project/t/ti/timeslottracker"/>
<property name="scp.url.unstable" value="Snapshot"/>
<property name="scp.url.release" value="Releases"/>
<target name="init" description="Initialize common properties">
<!-- get mvn project version -->
<exec dir="." executable="mvn" outputproperty="release">
<arg line="-q -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:exec"/>
</exec>
<!-- evaluate scp url -->
<condition property="scp.url" value="${scp.url.base}/${scp.url.unstable}" else="${scp.url.base}/${scp.url.release}">
<contains string="${release}" substring="SNAPSHOT"/>
</condition>
<condition property="finalRelease">
<not>
<contains string="${project.version}" substring="SNAPSHOT" />
</not>
</condition>
<tstamp>
<format pattern="HH:mm:ss" property="timestamp.start"/>
</tstamp>
<echo message="Started at ${timestamp.start}, release version: ${release}"/>
<echo message="Scp url: ${scp.url}"/>
<property name="release.version" value="${ant.project.name}-${release}"/>
<property name="release.dir" location="${deploy}/release/${release.version}"/>
<property name="package.jar" value="${release.dir}/${release.version}.jar"/>
<property name="package.jar.full" value="${release.dir}/${release.version}-full.jar"/>
<property name="package.deb.file" value="timeslottracker_${release}_all.deb"/>
<property name="package.deb" value="${release.dir}/${package.deb.file}"/>
<property name="package.exe.file" value="${release.version}-setup.exe"/>
<property name="package.exe" value="${release.dir}/${release.version}-setup.exe"/>
<mkdir dir="backup"/>
<mkdir dir="${deploy}"/>
</target>
<!--
Useful tasks for TST running from source
-->
<target name="pack" depends="init" description="Make jar packages">
<exec dir="." executable="mvn">
<arg line="clean package"/>
</exec>
</target>
<target name="run" depends="pack" description="Run application">
<antcall target="backup-data"/>
<condition property="jvmArgs" value="-Xdock:name=TimeSlotTracker -Xmx256M" else="-Xmx256M">
<os family="mac"/>
</condition>
<java jar="${jar.artifact}" fork="true">
<sysproperty key="debug" value="yes"/>
<jvmarg value="${jvmArgs}"/>
</java>
</target>
<target name="run-full" depends="pack" description="Run application (full version)">
<antcall target="backup-data"/>
<condition property="jvmArgs" value="-Xdock:name=TimeSlotTracker -Xmx256M" else="-Xmx256M">
<os family="mac"/>
</condition>
<java jar="${jar.artifact.full}" fork="true">
<sysproperty key="debug" value="yes"/>
<jvmarg value="${jvmArgs}"/>
</java>
</target>
<target name="backup-data" description="Backup TST data">
<tstamp>
<format pattern="yyyy-MM-dd_HH-mm-ss" property="timestamp.backup"/>
</tstamp>
<copy file="${user.homedir}/timeslottracker.xml" tofile="backup/timeslottracker_${timestamp.backup}.xml"
failonerror="false"/>
</target>
<target name="clean" description="Clean build artifacts">
<delete dir="${target.core}"/>
<delete dir="${target.full}"/>
<delete dir="${deploy}"/>
<delete dir="${deploy.deb}"/>
</target>
<target name="rebuild" depends="clean, run" description="Rebuild and run"/>
<target name="javadoc" description="Create javadoc documentation">
<exec dir="." executable="mvn">
<arg line="javadoc:javadoc"/>
</exec>
</target>
<!--
Release tasks
-->
<target name="release-add-banner" depends="init" description="Add release banner to Changelog" if="finalRelease">
<concat destfile="./ChangeLog.tmp">
<header><![CDATA[${line.separator}============================== version ${release} ==============================${line.separator}${line.separator}]]></header>
<path path="./ChangeLog"/>
</concat>
<move file="./ChangeLog.tmp" tofile="./ChangeLog" overwrite="true"/>
<exec dir="." executable="git">
<arg value="add"/>
<arg value="ChangeLog"/>
</exec>
<exec dir="." executable="git">
<arg value="commit"/>
<arg value="-m [*] add version banner to ChangeLog"/>
</exec>
<exec dir="." executable="git">
<arg value="push"/>
</exec>
</target>
<target name="release-make" depends="clean, pack" description="Make release artefacts">
<echo message="Preparing release [${release.version}] for SourceForge"/>
<mkdir dir="${release.dir}"/>
<!-- sign jar -->
<fail unless="keystorepass">You must set keystore password</fail>
<fail unless="keypass">You must set private key password</fail>
<signjar destDir="${deploy}" alias="tst" keystore="${basedir}/tst-keys" storepass="${keystorepass}"
keypass="${keypass}" preservelastmodified="true">
<path>
<fileset dir="${deploy}" includes="**/*.jar"/>
</path>
</signjar>
<antcall target="deb"/>
<!--antcall target="exe" /-->
<filter token="version" value="${release}"/>
<copy todir="${release.dir}" filtering="true">
<fileset dir="${release.docs}"/>
</copy>
<!-- prepare jar archive -->
<copy tofile="${package.jar}">
<fileset file="${jar.artifact}"/>
</copy>
<copy tofile="${package.jar.full}">
<fileset file="${jar.artifact.full}"/>
</copy>
<copy todir="${release.dir}">
<fileset file="${deploy}/${package.deb.file}"/>
<!-- <fileset file="${deploy}/${package.exe.file}"/>-->
</copy>
<echo message=""/>
<echo message="Remember to upload files to SourceForge: "/>
<echo message=" server: frs.sourceforge.net (Web Upload, WebDAV, rsync over SSH, sftp)"/>
<echo message=" login: username"/>
<echo message=" password: password"/>
<echo message="remote dir: u/us/username/uploads"/>
<echo message=" mode: binary"/>
<echo message=" file1: ${package.jar}"/>
<echo message=" file2: ${package.deb}"/>
<!-- <echo message=" file3: ${package.exe}"/>-->
<echo message=""/>
<echo message="Also remember to create new group for this version: "/>
<echo message=" url: https://sourceforge.net/p/timeslottracker/bugs/milestones"/>
<echo message=""/>
<echo message="Also remember to update jnlp jar at frs.sourceforge.net"/>
<echo message=" cmd: sftp username,timeslottracker@frs.sourceforge.net/htdocs"/>
</target>
<target name="release-deploy" depends="init" description="Deploy release artefacts on Sourceforge">
<fail unless="username">You must set username</fail>
<fail unless="userpass">You must set userpass</fail>
<echo>Scp to ${scp.url}</echo>
<echo>File: ${package.jar}</echo>
<!-- <scp file="${package.jar}" todir="${scp.url}" password="${userpass}" trust="true"/>-->
<echo>File: ${package.jar.full}</echo>
<!-- <scp file="${package.jar.full}" todir="${scp.url}" password="${userpass}" trust="true"/>-->
<echo>File: ${package.deb}</echo>
<!-- <scp file="${package.deb}" todir="${scp.url}" password="${userpass}" trust="true"/>-->
<!--echo>File: ${package.exe}</echo>
<scp file="${package.exe}" todir="${scp.url}" password="${userpass}" trust="true" /-->
</target>
<target name="deb" description="Make debian package">
<exec executable="sh" dir="${basedir}/resources/installers/deb/">
<arg value="-c"/>
<arg value="./build.sh ${release}"/>
</exec>
</target>
<target name="exe" depends="init" description="Make exe package">
<exec executable="sh" dir="${basedir}/resources/installers/nsis/">
<arg value="-c"/>
<arg value="${nsis} -DPRODUCT_VERSION=${release} tst.nsi"/>
</exec>
<exec executable="sh" dir="${basedir}/resources/installers/nsis/">
<arg value="-c"/>
<arg value="${nsis} -DPRODUCT_VERSION=${release} setup.nsi"/>
</exec>
</target>
</project>