-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
379 lines (335 loc) · 17.2 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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: build.xml 7851 2008-12-03 09:58:16Z gertsp $ -->
<project name="FedoraGenericSearch" default="binrelease" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<description>Fedora Generic Search Service</description>
<property name="escidoc.version" value="-trunk"/>
<property environment="env"/>
<property name="web.xml.file" value="web-withoutAuthN.xml"/> <!-- or web-withAuthN.xml -->
<property name="javac.debug" value="on"/>
<property name="javac.deprecation" value="on"/>
<property name="javac.maxwarns" value="100"/>
<property name="javac.source" value="1.5"/>
<property name="javac.target" value="1.5"/>
<loadproperties srcFile="lib/lib.properties" />
<property name="genericsearch.version" value="2.2"/>
<property name="build.basedir" location="../FgsBuild"/>
<property name="project.lucene.dir" location="../fgs-lucene-2.2${escidoc.version}"/>
<property name="project.solr.dir" location="../fgs-solr-22.2${escidoc.version}"/>
<property name="project.zebra.dir" location="../fgs-zebra-2.2${escidoc.version}"/>
<property name="compile.dir" location="bin"/>
<property name="build.dir" location="${build.basedir}/webapp" />
<property name="plugin.dir" location="${build.dir}/WEB-INF/classes" />
<property name="eclipseprojects.dir" location="${build.basedir}/eclipseprojects" />
<property name="project.dir" location="${eclipseprojects.dir}/FedoraGenericSearch${genericsearch.version}" />
<property name="tomcat.basename" value="tomcat" />
<property name="dist.dir" location="dist" />
<property name="lib.dir" location="lib"/>
<property name="app.name" value="fedoragsearch" />
<property name="war.name" value="${app.name}.war" />
<property name="junit.build.dir" location="${build.basedir}/junit"/>
<property name="junit.src.dir" location="src/test/junit"/>
<!-- properties for deployment to Artifactory -->
<property name="artifactory.url" value="https://www.escidoc.org/artifactory/libs-releases-local" />
<!-- build version, user name and password must be given from the command line via -Dbuild.version=... -Dusername=... -Dpassword=... -->
<property name="artifactory.user" value="${username}" />
<property name="artifactory.password" value="${password}" />
<!--
<path id="compile.classpath">
<pathelement path="${lib.axis}"/>
<pathelement path="${lib.commons-httpclient}"/>
<pathelement path="${lib.commons-logging}"/>
<pathelement path="${lib.fedora-client}"/>
<pathelement path="${lib.fedora-messaging-client}"/>
<pathelement path="${lib.jaxrpc}"/>
<pathelement path="${lib.junit}"/>
<pathelement path="${lib.lucene}"/>
<pathelement path="${lib.lucene-demos}"/>
<pathelement path="${lib.pdfbox}"/>
<pathelement path="${lib.servlet-api}"/>
<pathelement path="${lib.activemq-all}"/>
</path>
-->
<path id="compile.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="junit.classpath">
<path refid="compile.classpath"/>
<pathelement path="${junit.build.dir}"/>
<pathelement path="${compile.dir}"/>
<pathelement path="${build.basedir}/classes"/>
</path>
<!-- MacroDefs -->
<macrodef name="md-compile">
<attribute name="classpathref" default="compile.classpath"/>
<attribute name="destdir"/>
<attribute name="excludes" default=""/>
<attribute name="fork" default="no"/>
<attribute name="includes" default=""/>
<attribute name="srcdir"/>
<attribute name="compilerargs" default=""/>
<!-- default="-Xlint -Xlint:-path -Xmaxwarns ${javac.maxwarns}" -->
<sequential>
<mkdir dir="@{destdir}"/>
<javac classpathref="@{classpathref}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
destdir="@{destdir}"
excludes="@{excludes}"
fork="@{fork}"
includes="@{includes}"
source="${javac.source}"
srcdir="@{srcdir}"
target="${javac.target}"
encoding="UTF-8">
<compilerarg line="@{compilerargs}"/>
</javac>
</sequential>
</macrodef>
<target name="clean"
description="removes build-generated artifacts">
<delete dir="../${project.lucene.dir}/bin"/>
<delete dir="../${project.solr.dir}/bin"/>
<delete dir="${compile.dir}"/>
<delete dir="${build.basedir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="compile">
<mkdir dir="${compile.dir}"/>
<javac classpathref="compile.classpath"
debug="true"
destdir="${compile.dir}"
srcdir="src/java"
optimize="off"/>
</target>
<target name="prep"
depends="compile"
description="prepare">
<delete dir="${dist.dir}" />
<delete dir="${build.dir}" />
<delete dir="${project.dir}" />
<delete dir="${eclipseprojects.dir}" />
<mkdir dir="${eclipseprojects.dir}" />
<mkdir dir="${dist.dir}" />
<copy file="src/html/search-service.html" tofile="${build.dir}/index.html" />
<!--copy file="../FgsConfig/configvalues.xml" todir="${build.dir}" /-->
<copy todir="${build.dir}/css">
<fileset dir="src/css"/>
</copy>
<copy todir="${build.dir}/images">
<fileset dir="src/images">
<include name="*.png"/>
<include name="*.gif"/>
<include name="*.jpg"/>
</fileset>
</copy>
<copy todir="${build.dir}">
<fileset dir="src/sh"/>
</copy>
<copy file="src/WEB-INF/${web.xml.file}" tofile="${build.dir}/WEB-INF/web.xml" />
<copy file="src/WEB-INF/web-withoutAuthN.xml" todir="${build.dir}/WEB-INF" />
<copy file="src/WEB-INF/web-withAuthN.xml" todir="${build.dir}/WEB-INF" />
<copy file="src/WEB-INF/server-config.wsdd" todir="${build.dir}/WEB-INF" />
<copy file="src/WEB-INF/log4j.xml" todir="${build.dir}/WEB-INF/classes" />
<copy todir="${plugin.dir}">
<fileset dir="bin"/>
</copy>
<delete dir="${project.dir}" />
<mkdir dir="${project.dir}" />
<copy todir="${project.dir}">
<fileset dir="."/>
</copy>
</target>
<target name="binrelease" depends="builddownload">
<copy todir="${build.basedir}/release/genericsearch-${genericsearch.version}"
file="${dist.dir}/${war.name}"/>
<copy todir="${build.basedir}/release/genericsearch-${genericsearch.version}/doc">
<fileset dir="${build.dir}">
<include name="index.html"/>
<include name="css/**"/>
<include name="images/**"/>
</fileset>
</copy>
<!--zip zipfile="${dist.dir}/fedoragsearch-${genericsearch.version}.zip"
basedir="${build.basedir}/release" includes="genericsearch-${genericsearch.version}/**"/ -->
<delete dir="${build.basedir}/release/genericsearch-${genericsearch.version}"/>
<zip zipfile="${dist.dir}/${app.name}-${genericsearch.version}-sources.zip"
basedir="${build.basedir}/eclipseprojects">
<include name="**"/>
<exclude name="**/.classpath"/>
<exclude name="**/.project"/>
<exclude name="**/.settings/**"/>
</zip>
</target>
<target name="srcrelease" depends="clean">
<copy todir="${build.basedir}/release/genericsearch-${genericsearch.version}-src">
<fileset dir="..">
<exclude name="${build.basedir}/**"/>
</fileset>
</copy>
<zip zipfile="${build.basedir}/release/genericsearch-${genericsearch.version}-src.zip"
basedir="${build.basedir}/release" includes="genericsearch-${genericsearch.version}-src/**"/>
<delete dir="${build.basedir}/release/genericsearch-${genericsearch.version}-src"/>
</target>
<target name="release" depends="srcrelease,binrelease" description="Build the source and binary distributions">
<checksum fileext=".md5">
<fileset dir="${build.basedir}/release">
<include name="*.zip"/>
</fileset>
</checksum>
</target>
<target name="builddownload"
depends="prep, includeengines"
description="build the download">
<!--ant dir="../FgsConfig" target="prep" inheritAll="false"/-->
<delete file="${build.dir}/WEB-INF/web.xml" />
<copy file="src/WEB-INF/web-withoutAuthN.xml" tofile="${build.dir}/WEB-INF/web.xml" />
<copy file="lib/axis-1.4.jar" tofile="${build.dir}/WEB-INF/lib/axis-1.4.jar" />
<copy file="lib/fedora-client-3.2.1.jar" tofile="${build.dir}/WEB-INF/lib/fedora-client-3.2.1.jar" />
<copy file="lib/fedora-messaging-client-3.1.jar" tofile="${build.dir}/WEB-INF/lib/fedora-messaging-client-3.1.jar" />
<copy file="lib/fedora-server-3.2.1.jar" tofile="${build.dir}/WEB-INF/lib/fedora-server-3.2.1.jar" />
<copy file="lib/escidoc/common.jar" tofile="${build.dir}/WEB-INF/lib/common.jar" />
<copy file="lib/fedora-rest-client/fedora-client-0.1.3.jar" tofile="${build.dir}/WEB-INF/lib/fedora-client-0.1.3.jar" />
<copy file="lib/fedora-rest-client/iri-0.8.jar" tofile="${build.dir}/WEB-INF/lib/iri-0.8.jar" />
<copy file="lib/fedora-rest-client/jackson-core-lgpl-1.5.6.jar" tofile="${build.dir}/WEB-INF/lib/jackson-core-lgpl-1.5.6.jar" />
<copy file="lib/fedora-rest-client/jackson-mapper-lgpl-1.5.6.jar" tofile="${build.dir}/WEB-INF/lib/jackson-mapper-lgpl-1.5.6.jar" />
<copy file="lib/fedora-rest-client/jena-2.6.3.jar" tofile="${build.dir}/WEB-INF/lib/jena-2.6.3.jar" />
<copy file="lib/fedora-rest-client/jersey-client-1.3.jar" tofile="${build.dir}/WEB-INF/lib/jersey-client-1.3.jar" />
<copy file="lib/fedora-rest-client/jersey-core-1.3.jar" tofile="${build.dir}/WEB-INF/lib/jersey-core-1.3.jar" />
<copy file="lib/fedora-rest-client/jersey-multipart-1.3.jar" tofile="${build.dir}/WEB-INF/lib/jersey-multipart-1.3.jar" />
<copy file="lib/fedora-rest-client/mime-util-2.1.3.jar" tofile="${build.dir}/WEB-INF/lib/mime-util-2.1.3.jar" />
<copy file="lib/fedora-rest-client/mimepull-1.4.jar" tofile="${build.dir}/WEB-INF/lib/mimepull-1.4.jar" />
<copy todir="${build.dir}/WEB-INF/lib" flatten="true">
<fileset dir="lib" excludes="servlet-api.jar"/>
</copy>
<copy todir="${build.dir}/WEB-INF">
<fileset dir="src/WEB-INF">
<include name="jboss*"/>
</fileset>
</copy>
<jar jarfile="${dist.dir}/${war.name}" basedir="${build.dir}"/>
</target>
<target name="buildlocal"
depends="prep, includeengines"
description="build local">
<ant dir="../FgsConfig" target="config" inheritAll="false"/>
<delete file="${build.dir}/WEB-INF/web.xml" />
<copy file="src/WEB-INF/web-withAuthN.xml" tofile="${build.dir}/WEB-INF/web.xml" />
<jar jarfile="${dist.dir}/${war.name}" basedir="${build.dir}"/>
<copy file="${dist.dir}/${war.name}" todir="${env.FEDORA_HOME}/${tomcat.basename}/webapps"/>
<delete dir="${env.FEDORA_HOME}/data/fedora-xacml-policies/repository-policies/fgs-policies" />
<mkdir dir="${env.FEDORA_HOME}/data/fedora-xacml-policies/repository-policies/fgs-policies" />
<copy todir="${env.FEDORA_HOME}/data/fedora-xacml-policies/repository-policies/fgs-policies">
<fileset dir="${build.dir}/WEB-INF/classes/configDemoSearchResultFiltering/fgs-policies"/>
</copy>
<exec executable="sh" dir="${env.FEDORA_HOME}/server/bin/">
<arg line=" fedora-reload-policies.sh http fedoraAdmin fedoraAdmin"/>
</exec>
</target>
<target name="builddemo"
depends="builddownload"
description="build public">
<ant dir="../FgsConfig" target="configdemo" inheritAll="false"/>
<mkdir dir="${dist.dir}" />
<zip zipfile="${build.dir}/eclipseprojects.zip" basedir="${build.basedir}/eclipseprojects"/>
<jar jarfile="${dist.dir}/${war.name}" basedir="${build.dir}"/>
<exec executable="scp">
<arg line=" -p ${dist.dir}/${war.name} fedora2@defxws2006.cvt.dk:/home/fedora2/fedora-2.1/server/${tomcat.basename}/webapps"/>
</exec>
</target>
<target name="includeengines" depends="">
<ant dir="${project.lucene.dir}" inheritAll="false"/>
<ant dir="${project.solr.dir}" inheritAll="false"/>
<!--ant dir="../FgsZebra" inheritAll="false"/-->
</target>
<target name="compile-junit" depends="compile">
<md-compile srcdir="${junit.src.dir}"
destdir="${junit.build.dir}"
classpathref="junit.classpath"/>
<copy todir="${junit.build.dir}" file="${junit.src.dir}/log4j.xml"/>
</target>
<target name="junit-all" depends="junit-set-all, junit">
</target>
<target name="junit-set-all">
<property name="test" value="gsearch.test.AllTests"/>
</target>
<target name="junit-lucene" depends="junit-set-lucene, junit">
</target>
<target name="junit-set-lucene">
<property name="test" value="gsearch.test.lucene.AllTests"/>
</target>
<target name="junit-solr" depends="junit-set-solr, junit">
</target>
<target name="junit-set-solr">
<property name="test" value="gsearch.test.solr.AllTests"/>
</target>
<target name="junit-zebra" depends="junit-set-zebra, junit">
</target>
<target name="junit-set-zebra">
<property name="test" value="gsearch.test.zebra.AllTests"/>
</target>
<target name="junit-testsonlucene" depends="junit-set-testsonlucene, junit">
</target>
<target name="junit-set-testsonlucene">
<property name="test" value="gsearch.test.testsonlucene.AllTests"/>
</target>
<target name="junit-searchresultfiltering" depends="junit-set-searchresultfiltering, junit">
</target>
<target name="junit-set-searchresultfiltering">
<property name="test" value="gsearch.test.searchresultfiltering.AllTests"/>
</target>
<target name="junit" depends="compile-junit">
<property name="fedoragsearch.protocol" value="http"/>
<property name="fedoragsearch.hostport" value="localhost:8080"/>
<property name="fedoragsearch.path" value="fedoragsearch/rest"/>
<property name="fedoragsearch.user" value="fedoraAdmin"/>
<property name="fedoragsearch.pass" value="fedoraAdmin"/>
<copy todir="${junit.build.dir}" includeEmptyDirs="false">
<fileset dir="${junit.src.dir}">
<exclude name="**/*.java"/>
</fileset>
</copy>
<junit printsummary="yes" fork="yes" haltonfailure="no" showoutput="yes">
<syspropertyset id="junit.sysproperties">
<propertyref name="fedoragsearch.protocol"/>
<propertyref name="fedoragsearch.hostport"/>
<propertyref name="fedoragsearch.path"/>
<propertyref name="fedoragsearch.user"/>
<propertyref name="fedoragsearch.pass"/>
</syspropertyset>
<classpath refid="junit.classpath"/>
<formatter type="plain" usefile="false"/>
<test name="${test}"/>
</junit>
</target>
<!-- example usage: ant -Dbuild.version=1.4.6 -Dusername=hans -Dpassword=wurst deploy -->
<target name="deploy" depends="binrelease" description="Deploy war file to local repository and Artifactory">
<!-- deploy war -->
<artifact:pom id="memorypom" groupId="org.escidoc" artifactId="fedoragsearch_full" version="${build.version}" name="Fedora GSearch for eSciDoc" packaging="war" />
<artifact:writepom pomRefId="memorypom" file="${dist.dir}/fedoragsearch_full-${build.version}.pom" />
<artifact:pom id="filepom" file="${dist.dir}/fedoragsearch_full-${build.version}.pom" />
<artifact:install file="${dist.dir}/${war.name}">
<pom refid="filepom" />
</artifact:install>
<artifact:deploy file="${dist.dir}/${war.name}">
<remoteRepository url="${artifactory.url}">
<authentication username="${artifactory.user}" password="${artifactory.password}" />
</remoteRepository>
<pom refid="filepom" />
</artifact:deploy>
<!-- deploy sources -->
<artifact:pom id="memorypom" groupId="org.escidoc" artifactId="fedoragsearch_src" version="${build.version}" name="Fedora GSearch for eSciDoc (sources)" packaging="zip" />
<artifact:writepom pomRefId="memorypom" file="${dist.dir}/fedoragsearch_src-${build.version}.pom" />
<artifact:pom id="filepom" file="${dist.dir}/fedoragsearch_src-${build.version}.pom" />
<artifact:install file="${dist.dir}/${app.name}-${genericsearch.version}-sources.zip">
<pom refid="filepom" />
</artifact:install>
<artifact:deploy file="${dist.dir}/${app.name}-${genericsearch.version}-sources.zip">
<remoteRepository url="${artifactory.url}">
<authentication username="${artifactory.user}" password="${artifactory.password}" />
</remoteRepository>
<pom refid="filepom" />
</artifact:deploy>
</target>
</project>