-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
266 lines (235 loc) · 10.7 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="panFMP" default="dist" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:fa="antlib:de.thetaphi.forbiddenapis">
<fail message="Minimum supported ANT version is 1.8.0. Yours: ${ant.version}">
<condition>
<not><antversion atleast="1.8.0" /></not>
</condition>
</fail>
<!-- workaround for https://issues.apache.org/bugzilla/show_bug.cgi?id=53347 -->
<condition property="build.compiler" value="javac1.7">
<or>
<antversion exactly="1.8.3" />
<antversion exactly="1.8.4" />
</or>
</condition>
<!-- PROPERTIES -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<property name="plugins" location="plugins"/>
<property name="docs" location="apidocs"/>
<property name="plib" location="patched-lib"/>
<property name="debug" value="on"/>
<property name="ivy.logging" value="download-only"/>
<property name="version" value="2.2-dev"/>
<property name="versionsuffix" value="-${version}"/>
<property name="pkgname" value="${ant.project.name}${versionsuffix}"/>
<property name="year" value="2007-2013"/>
<property name="javadoc.projectWebSite" value="https://www.panFMP.org/" />
<property name="javadoc.link.oracle" value="https://docs.oracle.com/en/java/javase/11/docs/api/" />
<property name="jdk.version" value="11"/>
<!-- IVY -->
<property name="ivy.install.version" value="2.4.0" />
<property name="ivy.jar.dir" location=".ivy" />
<property name="ivy.jar.file" location="${ivy.jar.dir}/ivy-${ivy.install.version}.jar" />
<makeurl property="log4j-conf" file="scripts/console.log.properties"/>
<property name="harvester" value="all"/>
<property name="index" value="all"/>
<!-- GPG settings -->
<property name="gpg.exe" value="gpg" />
<property name="gpg.key" value="E1EE085F" />
<condition property="ivy.available">
<typefound uri="antlib:org.apache.ivy.ant" name="configure" />
</condition>
<target name="-install.ivy" unless="ivy.available">
<mkdir dir="${ivy.jar.dir}"/>
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" skipexisting="true"/>
<taskdef uri="antlib:org.apache.ivy.ant" classpath="${ivy.jar.file}"/>
</target>
<target name="-init" depends="-install.ivy">
<ivy:resolve log="${ivy.logging}"/>
<condition property="ivy.version-message"
value="The correct Apache Ivy version ${ivy.version} is installed."
else="You have installed a different Apache Ivy version (${ivy.version}) in your ANT classpath than the expected one (${ivy.install.version}). The build may fail!"
>
<equals arg1="${ivy.version}" arg2="${ivy.install.version}"/>
</condition>
<echo taskname="check-ivy" message="${ivy.version-message}"/>
<ivy:cachepath pathid="path.build" conf="build" log="${ivy.logging}"/>
<ivy:cachepath pathid="path.bundle" conf="bundle" log="${ivy.logging}"/>
<ivy:cachepath pathid="path.addons" conf="addons" log="${ivy.logging}"/>
<!--<ivy:cachepath pathid="path.test" conf="test" log="${ivy.logging}"/>-->
<path id="path.run">
<path refid="path.bundle"/>
<pathelement path="build"/>
<fileset dir="${plib}" includes="*.jar"/>
</path>
<path id="path.push-server.run">
<path refid="path.bundle"/>
<path refid="path.addons"/>
<pathelement path="build"/>
<fileset dir="${plib}" includes="*.jar"/>
</path>
<path id="path.tools-run">
<path refid="path.build"/>
<pathelement path="build"/>
<fileset dir="${plugins}" includes="*.jar"/>
</path>
<ivy:cachepath pathid="path.buildtools" conf="buildtools" log="${ivy.logging}"/>
<taskdef uri="antlib:de.thetaphi.forbiddenapis" classpathref="path.buildtools"/>
</target>
<!-- BUILD TARGETS -->
<target name="compile" depends="-init">
<mkdir dir="${build}"/>
<javac srcdir="${src}" destdir="${build}" classpathref="path.build"
deprecation="on" debug="${debug}" encoding="UTF-8" includeantruntime="false">
<compilerarg line="-Xlint:unchecked --release ${jdk.version}"/>
</javac>
<fa:forbiddenapis classpathref="path.build" dir="${build}" targetVersion="${jdk.version}">
<bundledsignatures name="jdk-unsafe"/>
<bundledsignatures name="jdk-deprecated"/>
<bundledsignatures name="jdk-non-portable"/>
<signaturesfile file="./devtools/forbidden-signatures.txt"/>
</fa:forbiddenapis>
</target>
<target name="dist" depends="compile">
<mkdir dir="${dist}"/>
<jar destfile="${dist}/${ant.project.name}${versionsuffix}.jar" basedir="${build}">
<manifest>
<attribute name="Package" value="de.pangaea.metadataportal"/>
<attribute name="Implementation-Title" value="${ant.project.name}"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="${ant.project.name} Developers c/o Uwe Schindler"/>
</manifest>
<metainf dir="${basedir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</metainf>
</jar>
</target>
<!-- EXECUTE SCRIPTS WITH CLASSPATH target -->
<target name="run-harvester" depends="compile">
<java fork="true" dir="." classname="de.pangaea.metadataportal.harvester.Harvester" classpathref="path.run">
<sysproperty key="log4j.configurationFile" value="${log4j-conf}"/>
<arg file="conf/config.xml"/>
<arg value="${harvester}"/>
</java>
</target>
<target name="run-rebuilder" depends="compile">
<java fork="true" dir="." classname="de.pangaea.metadataportal.harvester.Rebuilder" classpathref="path.run">
<sysproperty key="log4j.configurationFile" value="${log4j-conf}"/>
<arg file="conf/config.xml"/>
<arg value="${index}"/>
</java>
</target>
<target name="run-update-aliases" depends="compile">
<java fork="true" dir="." classname="de.pangaea.metadataportal.harvester.UpdateAliases" classpathref="path.run">
<sysproperty key="log4j.configurationFile" value="${log4j-conf}"/>
<arg file="conf/config.xml"/>
<arg value="${index}"/>
</java>
</target>
<target name="run-push-server" depends="compile">
<java fork="true" dir="." classname="de.pangaea.metadataportal.push.PushServer" classpathref="path.push-server.run">
<sysproperty key="log4j.configurationFile" value="${log4j-conf}"/>
<arg file="conf/config.xml"/>
</java>
</target>
<!-- JAVADOCS TARGET -->
<target name="javadocs" depends="-init">
<delete dir="${docs}"/>
<mkdir dir="${docs}"/>
<javadoc sourcepath="${src}" destdir="${docs}" packagenames="*" classpathref="path.build" windowtitle="${ant.project.name} ${version} Documentation" overview="${src}/overview.html" charset="UTF-8" docencoding="UTF-8">
<link href="${javadoc.link.oracle}"/>
<doctitle><![CDATA[<H1>${ant.project.name} ${version}</H1>]]></doctitle>
<bottom><![CDATA[<ADDRESS>Copyright ©${year} <A HREF='${javadoc.projectWebSite}' TARGET='_blank'>${ant.project.name}</A> Developers c/o Uwe Schindler</ADDRESS>]]></bottom>
<arg line="-Xdoclint:none --release ${jdk.version}"/>
</javadoc>
</target>
<!-- PACKAGING -->
<target name="binpackage" depends="dist,javadocs">
<ivy:cachefileset setid="fileset.bundle" conf="bundle" log="${ivy.logging}"/>
<ivy:cachefileset setid="fileset.addons" conf="addons" log="${ivy.logging}"/>
<zip destfile="${basedir}/${pkgname}-bin.zip">
<mappedresources>
<fileset refid="fileset.bundle"/>
<chainedmapper>
<flattenmapper/>
<globmapper from="*" to="${pkgname}/lib/core/*"/>
</chainedmapper>
</mappedresources>
<mappedresources>
<fileset refid="fileset.addons"/>
<chainedmapper>
<flattenmapper/>
<globmapper from="*" to="${pkgname}/lib/addons/*"/>
</chainedmapper>
</mappedresources>
<zipfileset dir="${dist}" prefix="${pkgname}/lib/core"/>
<zipfileset dir="${plib}" prefix="${pkgname}/lib/core"/>
<zipfileset dir="${plugins}" prefix="${pkgname}/plugins"/>
<zipfileset dir="${basedir}/conf" prefix="${pkgname}/conf"/>
<zipfileset dir="${basedir}/scripts" prefix="${pkgname}/scripts"/>
<zipfileset dir="${docs}" prefix="${pkgname}/javadocs"/>
<zipfileset dir="${basedir}" prefix="${pkgname}">
<include name="*.txt"/>
</zipfileset>
</zip>
<panfmp-checksum file="${basedir}/${pkgname}-bin.zip"/>
</target>
<target name="srcpackage" depends="clean">
<zip destfile="${basedir}/${pkgname}-src.zip">
<zipfileset dir="${basedir}" prefix="${pkgname}" excludes=".*/**"/>
</zip>
<panfmp-checksum file="${basedir}/${pkgname}-src.zip"/>
</target>
<target name="package">
<!-- this target was created as a target without dependencies and uses subcalls
to do it as two really separate targets in the right order -->
<antcall target="srcpackage"/>
<antcall target="binpackage"/>
</target>
<!-- CLEANUP TARGET -->
<target name="clean">
<delete dir="${build}"/>
<delete dir="${dist}"/>
<delete dir="${docs}"/>
<delete>
<fileset dir="${basedir}" includes="*.zip"/>
<fileset dir="${basedir}" includes="*.asc"/>
<fileset dir="${basedir}" includes="*.md5"/>
<fileset dir="${basedir}" includes="*.sha1"/>
<fileset dir="${basedir}" includes="*.asc"/>
<fileset dir="${basedir}/conf" includes="**/*.log"/>
</delete>
</target>
<!-- Macro for building checksum files: MD5 and SHA1 -->
<macrodef name="panfmp-checksum">
<attribute name="file"/>
<sequential>
<checksum file="@{file}" algorithm="md5" format="MD5SUM" forceoverwrite="yes" readbuffersize="65536"/>
<checksum file="@{file}" algorithm="sha1" format="MD5SUM" forceoverwrite="yes" readbuffersize="65536"/>
</sequential>
</macrodef>
<target name="sign-artifacts" depends="package">
<delete failonerror="false" dir="${basedir}" includes="*.asc"/>
<input message="Enter GPG keystore password: >" addproperty="gpg.passphrase">
<handler classname="org.apache.tools.ant.input.SecureInputHandler" />
</input>
<apply executable="${gpg.exe}" inputstring="${gpg.passphrase}"
dest="${basedir}" type="file" maxparallel="1" verbose="yes">
<arg value="--passphrase-fd"/>
<arg value="0"/>
<arg value="--batch"/>
<arg value="--armor"/>
<arg value="--default-key"/>
<arg value="${gpg.key}"/>
<arg value="--output"/>
<targetfile/>
<arg value="--detach-sig"/>
<srcfile/>
<fileset dir="${basedir}" includes="*.zip"/>
<globmapper from="*" to="*.asc"/>
</apply>
</target>
</project>