-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.xml
230 lines (194 loc) · 8.47 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
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<project name="java-installer" default="spk" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:groovy="antlib:org.codehaus.groovy" xmlns:syno="antlib:net.filebot.ant.spk">
<property file="package.properties" />
<property file="profile.properties" />
<property file="build-jdk.properties" />
<property name="dir.source" location="${basedir}/src" />
<property name="dir.bin" location="${basedir}/bin" />
<property name="dir.lib" location="${basedir}/lib" />
<property name="dir.gpg" location="${basedir}/gpg" />
<property name="dir.cache" location="${basedir}/cache" />
<property name="dir.build" location="${basedir}/build" />
<property name="dir.dist" location="${basedir}/dist" />
<property name="dir.package" location="${basedir}/package" />
<property name="dir.release" location="${basedir}/release" />
<target name="spk-dsm6" description="Build Synology Package (DSM 6.2.4)" depends="branch">
<copy-replace todir="${dir.build}/spk">
<fileset dir="${dir.package}/synology" />
</copy-replace>
<syno:spk destdir="${dir.build}" name="${package}" version="${version}" arch="noarch" compression="xz">
<info name="displayname" value="${title}" />
<info name="description" value="${description}" />
<info name="maintainer" value="rednoah" />
<info name="maintainer_url" value="https://github.com/rednoah/java-installer" />
<info name="distributor" value="rednoah" />
<info name="distributor_url" value="https://github.com/rednoah/java-installer" />
<info name="support_url" value="https://github.com/rednoah/java-installer/issues" />
<info name="ctl_stop" value="no" />
<info name="silent_install" value="no" />
<info name="silent_upgrade" value="yes" />
<info name="silent_uninstall" value="yes" />
<info name="thirdparty" value="yes" />
<info name="os_min_ver" value="6.2.4" />
<icon file="${dir.package}/synology/images/java_64.png" />
<icon size="256" file="${dir.package}/synology/images/java_256.png" />
<conf dir="${dir.build}/spk/conf" />
<scripts dir="${dir.build}/spk/scripts" filemode="755" />
<package dir="${dir.build}/spk/target" filemode="755" />
<package file="${dir.package}/gpg/maintainer.gpg" />
</syno:spk>
<copy file="${dir.build}/${package}-${version}-noarch.spk" tofile="${dir.dist}/${package}_${version}-dsm6.spk" />
</target>
<target name="syno-repo-dsm6" description="Update Synology Package Source (DSM 6.2.4)" depends="stats">
<syno:package-source file="${basedir}/syno-dsm6.json">
<spk file="${dir.dist}/${package}_${version}-dsm6.spk">
<info name="link" value="https://github.com/rednoah/java-installer/releases/download/${version}/${package}_${version}-dsm6.spk" />
<info name="download_count" value="${download_count}" />
<thumbnail url="https://www.filebot.net/syno/java-installer-thumbnail.png" />
</spk>
</syno:package-source>
</target>
<target name="spk" description="Build Synology Package" depends="branch">
<copy-replace todir="${dir.build}/spk-dsm7">
<fileset dir="${dir.package}/synology" />
</copy-replace>
<syno:spk destdir="${dir.build}" name="${package}" version="${version}" arch="noarch" compression="xz">
<info name="displayname" value="${title}" />
<info name="description" value="${description}" />
<info name="maintainer" value="rednoah" />
<info name="maintainer_url" value="https://github.com/rednoah/java-installer" />
<info name="distributor" value="rednoah" />
<info name="distributor_url" value="https://github.com/rednoah/java-installer" />
<info name="support_url" value="https://github.com/rednoah/java-installer/issues" />
<info name="ctl_stop" value="no" />
<info name="silent_install" value="no" />
<info name="silent_upgrade" value="yes" />
<info name="silent_uninstall" value="yes" />
<info name="thirdparty" value="yes" />
<info name="os_min_ver" value="7.0-41890" />
<icon file="${dir.package}/synology/images/java_64.png" />
<icon size="256" file="${dir.package}/synology/images/java_256.png" />
<conf dir="${dir.build}/spk-dsm7/conf" />
<scripts dir="${dir.build}/spk-dsm7/scripts" filemode="755" />
<package dir="${dir.build}/spk-dsm7/target" filemode="755" />
<package file="${dir.package}/gpg/maintainer.gpg" />
</syno:spk>
<copy file="${dir.build}/${package}-${version}-noarch.spk" tofile="${dir.dist}/${package}_${version}.spk" />
</target>
<target name="syno-repo" description="Update Synology Package Source" depends="stats">
<syno:package-source file="${basedir}/syno.json">
<spk file="${dir.dist}/${package}_${version}.spk">
<info name="link" value="https://github.com/rednoah/java-installer/releases/download/${version}/${package}_${version}.spk" />
<info name="download_count" value="${download_count}" />
<thumbnail url="https://www.filebot.net/syno/java-installer-thumbnail.png" />
</spk>
</syno:package-source>
</target>
<target name="qpkg" description="Build QNAP Package" depends="branch">
<copy-replace todir="${dir.build}/qnap">
<fileset dir="${dir.package}/qnap">
<include name="**/*_routines" />
<include name="**/*.sh" />
<include name="**/*.cfg" />
<include name="**/*.png" />
<include name="**/private_key" />
<include name="**/certificate" />
</fileset>
</copy-replace>
<copy file="${dir.package}/gpg/maintainer.gpg" todir="${dir.build}/qnap/shared" />
<exec executable="docker" failonerror="yes">
<arg line="run --rm -v ${dir.build}/qnap:/src rednoah/qpkg-build" />
</exec>
<copy file="${dir.build}/qnap/build/${package}_${version}.qpkg" tofile="${dir.dist}/${package}_${version}.qpkg" />
</target>
<target name="build">
<delete dir="${dir.bin}" />
<copy-replace todir="${dir.bin}">
<fileset dir="${dir.source}" />
</copy-replace>
<chmod perm=" x" type="file">
<fileset dir="${dir.bin}" includes="*.sh, *.ps1" />
</chmod>
<delete dir="${dir.release}" />
<copy-replace todir="${dir.release}">
<fileset dir="${dir.source}" />
</copy-replace>
<release-sign dir="${dir.release}" />
</target>
<target name="clean">
<delete dir="${dir.build}" />
<delete dir="${dir.dist}" />
</target>
<target name="resolve" description="Retrieve dependencies with Apache Ivy">
<delete dir="${dir.lib}" />
<ivy:retrieve pattern="${dir.lib}/[artifact]-[type].[ext]" />
</target>
<target name="update-jdk" description="Update JDK build properties">
<mkdir dir="${dir.cache}" />
<delete file="build-jdk.properties" />
<groovy:groovy src="build-jdk.groovy" />
</target>
<target name="stats">
<groovy:groovy src="build-jdk-stats.groovy" />
</target>
<target name="branch">
<exec executable="git" outputproperty="branch" failonerror="true">
<arg line="rev-parse --abbrev-ref HEAD" />
</exec>
<echo>Branch: ${branch}</echo>
</target>
<macrodef name="copy-replace" description="Copy text files and replace ant variables">
<attribute name="todir" />
<element name="filesets" implicit="yes" />
<sequential>
<!-- copy plain text files -->
<copy todir="@{todir}" overwrite="yes" verbose="yes" encoding="utf-8">
<restrict>
<filesets />
<!-- exclude binary files so they don't get mangled (see https://ant.apache.org/manual/Tasks/copy.html#encoding) -->
<not>
<or>
<name name="**/*.png" />
<name name="**/*.gif" />
</or>
</not>
</restrict>
<filterset begintoken="@{" endtoken="}">
<propertyset>
<propertyref builtin="all" />
</propertyset>
</filterset>
<filtermapper>
<replacetokens begintoken="@{" endtoken="}" propertiesResource="package.properties" />
</filtermapper>
</copy>
<!-- copy binary files -->
<copy todir="@{todir}" overwrite="yes" verbose="yes">
<restrict>
<filesets />
<or>
<name name="**/*.png" />
<name name="**/*.gif" />
</or>
</restrict>
<filtermapper>
<replacetokens begintoken="@{" endtoken="}" propertiesResource="package.properties" />
</filtermapper>
</copy>
</sequential>
</macrodef>
<macrodef name="release-sign" description="Sign files with GnuPG">
<attribute name="dir" />
<element name="includes" implicit="yes" optional="yes" />
<sequential>
<apply executable="docker" verbose="yes" failonerror="yes">
<arg line="run --rm -v @{dir}:@{dir} -v ${dir.gpg}:/root/.gnupg fedora:36" />
<arg line="gpg --armor --detach-sign --verbose --batch --yes --local-user ${maintainer}" />
<srcfile />
<fileset dir="@{dir}">
<includes />
</fileset>
</apply>
</sequential>
</macrodef>
</project>