forked from opensiddur/opensiddur
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
289 lines (272 loc) · 9.89 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
<project name="opensiddur" default="dist" basedir=".">
<description>
Build file for opensiddur
</description>
<property name="lib.dir" location="lib"/>
<property name="installer" location="${lib.dir}/exist/installer/eXist-db-setup-2.1-rev.jar"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<property file="local.build.properties"/>
<property file="build.properties"/>
<!--
<path id="classpath.core">
<fileset dir="${lib.dir}/exist/lib/core">
<include name="*.jar"/>
</fileset>
<pathelement path="${lib.dir}/exist/exist.jar"/>
<pathelement path="${lib.dir}/exist/exist-optional.jar"/>
</path>
<typedef resource="org/exist/ant/antlib.xml" uri="http://exist-db.org/ant">
<classpath refid="classpath.core"/>
</typedef>
-->
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- do git submodule init, update -->
<exec executable="git">
<arg value="submodule"/>
<arg value="init"/>
</exec>
<exec executable="git">
<arg value="submodule"/>
<arg value="update"/>
</exec>
<uptodate property="exist.uptodate" targetfile="${installer}">
<srcfiles dir="${lib.dir}/exist">
<include name="**/*.java"/>
<include name="**/*.xml"/>
<include name="**/*.tmpl"/>
<exclude name="${installer}"/>
</srcfiles>
</uptodate>
<!-- make build dirs -->
<mkdir dir="${build}"/>
<mkdir dir="${dist}"/>
</target>
<target name="exist" depends="build-exist,autodeploy">
</target>
<target name="build-exist" depends="init" unless="exist.uptodate">
<!-- ./build.sh installer -Dizpack.dir=$(IZPACK) -Dinclude.module.scheduler=true -Dinclude.feature.security.oauth=true -Dinclude.feature.security.openid=true -->
<exec
executable="./build.sh"
dir="${lib.dir}/exist">
<arg value="installer"/>
<arg value="-Dizpack.dir=${lib.dir}/IzPack"/>
<arg value="-Dinclude.module.scheduler=true"/>
<!-- not using these yet -->
<arg value="-Dinclude.feature.security.oauth=false"/>
<arg value="-Dinclude.feature.security.openid=false"/>
</exec>
</target>
<target name="install-exist" depends="init,build-exist"
xmlns:xdb="http://exist-db.org/ant">
<echo file="${build}/install-options.xml" append="false">
INSTALL_PATH=${installdir}
dataDir=webapp/WEB-INF/data
divider=
space=
MAX_MEMORY=${max.memory}
cacheSize=${cache.size}
</echo>
<exec
executable="java"
dir=".">
<arg value="-jar"/>
<arg value="${installer}"/>
<arg value="-console"/>
<arg value="-options"/>
<arg file="${build}/install-options.xml"/>
</exec>
<delete file="${build}/install-options.xml"/>
<!-- default password has been changed to 'password' -->
<exec
executable="${installdir}/bin/client.sh"
dir="${installdir}"
inputstring="sm:passwd('admin','${adminpassword}')"
>
<arg value="-qls"/>
<arg value="-u"/>
<arg value="admin"/>
<arg value="-P"/>
<arg value="password"/>
<arg value="-x"/>
</exec>
<!-- copy the icu4j library from lib -->
<copy todir="${installdir}/lib/user">
<fileset dir="${lib.dir}">
<include name="icu4j-*"/>
</fileset>
</copy>
</target>
<target name="exist-clean">
<exec
executable="./build.sh"
dir="${lib.dir}/exist">
<arg value="clean"/>
</exec>
</target>
<target name="fix-restxq">
<!-- BUG workaround: copy the restxq registry -->
<copy todir="${installdir}/webapp/WEB-INF/data" overwrite="true">
<fileset dir="${lib.dir}">
<include name="restxq.registry"/>
</fileset>
</copy>
</target>
<target name="install-hebmorph"
depends="dist"
description="install the hebmorph files into eXist">
<copy todir="${installdir}/extensions/indexes/lucene/lib" flatten="true">
<fileset dir="${lib.dir}/hebmorph-exist/build">
<include name="**/*.jar"/>
</fileset>
</copy>
<copy todir="${installdir}/extensions/indexes/lucene/lib">
<fileset dir="${lib.dir}/hebmorph-exist/src/hebmorph-exist">
<include name="hspell-data-files/*"/>
</fileset>
</copy>
</target>
<target name="autoupgrade"
depends="dist,install-hebmorph"
description="install or upgrade Open Siddur packages without touching eXist">
<copy todir="${installdir}/autodeploy">
<fileset dir="${dist}">
<include name="*.xar"/>
<!-- hebmorph is being installed directly, not as a xar -->
<exclude name="hebmorph-exist.xar"/>
</fileset>
</copy>
</target>
<target name="autodeploy"
depends="install-exist,autoupgrade"
description="set up eXist and built xars for autodeployment">
</target>
<target name="dist" depends="init"
description="build everything">
<subant target="dist" inheritAll="false">
<fileset dir=".">
<include name="*/build.xml"/>
<include name="lib/hebmorph-exist/build.xml"/>
<exclude name="build.xml"/>
</fileset>
</subant>
<copy todir="${dist}" flatten="true">
<fileset dir=".">
<include name="lib/*/dist/*.xar"/>
<include name="*/dist/*.xar"/>
</fileset>
</copy>
</target>
<target name="clean"
description="clean up Open Siddur code"
>
<subant target="clean" inheritAll="false">
<fileset dir=".">
<include name="*/build.xml"/>
<include name="lib/hebmorph-exist/build.xml"/>
<exclude name="build.xml"/>
</fileset>
</subant>
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
<target name="lib-clean"
depends="clean,exist-clean"
description="clean open siddur code and library code">
</target>
<target name="uninstall">
<echo level="warning">Warning: About to delete everything in ${installdir}. If this not what you want to do, press ^C now! You have 5 seconds...</echo>
<sleep seconds="5"/>
<delete dir="${installdir}"/>
</target>
<target name="backup"
description="back up an existing database into $backup.directory">
<property environment="env"/>
<exec
executable="${installdir}/bin/backup.sh">
<arg value="-u"/>
<arg value="admin"/>
<arg value="-p"/>
<arg value="${adminpassword}"/>
<arg value="-b"/>
<arg value="/db"/>
<arg value="-d"/>
<arg value="${backup.directory}"/>
<arg value="-ouri=xmldb:exist://"/>
<!-- DEBUG_OPTS seems to be the only way to force options after java.endorsed.dirs -->
<env key="DEBUG_OPTS" value="-Djava.endorsed.dirs=${installdir}/lib/optional:${installdir}/lib/endorsed"/>
</exec>
</target>
<target name="backup-for-upgrade"
depends="backup"
description="edit the backup in $backup.directory, removing things that we do not want restored">
<tempfile property="exist.backup.remove.file" destDir="${java.io.tmpdir}" deleteonexit="true"/>
<echo file="${exist.backup.remove.file}">
^/db/apps
^/db/cache
^/db/refindex
^/db/system/config
^/db/system/security/exist/(accounts|groups)/removed
^/db/system/security/exist/accounts/(admin|guest|testuser|testuser2)\.xml$
^/db/system/security/exist/groups/(testuser|testuser2|everyone)\.xml$
^/db/data/tests
</echo>
<exec input="${exist.backup.remove.file}"
executable="python">
<arg value="opensiddur-server/setup/removeFromBackup.py"/>
<arg value="${backup.directory}/db"/>
</exec>
</target>
<target name="restore"
description="restore the database from (modified) backup, rerun refindex update">
<property environment="env"/>
<exec
executable="${installdir}/bin/backup.sh">
<arg value="-u"/>
<arg value="admin"/>
<arg value="-p"/>
<arg value="${adminpassword}"/>
<arg value="-r"/>
<arg value="${backup.directory}"/>
<arg value="-ouri=xmldb:exist://"/>
<!-- DEBUG_OPTS seems to be the only way to force options after java.endorsed.dirs -->
<env key="DEBUG_OPTS" value="-Djava.endorsed.dirs=${installdir}/lib/optional:${installdir}/lib/endorsed"/>
</exec>
<!-- schema update -->
<exec
executable="${installdir}/bin/client.sh"
dir="${installdir}"
inputstring="xquery version '3.0';
declare namespace tei='http://www.tei-c.org/ns/1.0';
update delete collection('/db/data')//tei:availability/@status
">
<arg value="-qls"/>
<arg value="-u"/>
<arg value="admin"/>
<arg value="-P"/>
<arg value="${adminpassword}"/>
<arg value="-x"/>
<env key="DEBUG_OPTS" value="-Djava.endorsed.dirs=${installdir}/lib/optional:${installdir}/lib/endorsed:${installdir}/lib/user"/>
</exec>
<!-- reindex -->
<exec
executable="${installdir}/bin/client.sh"
dir="${installdir}"
inputstring="xquery version '3.0';
import module namespace ridx='http://jewishliturgy.org/modules/refindex'
at 'xmldb:exist:///db/apps/opensiddur-server/modules/refindex.xqm';
ridx:reindex(collection('/db/data'))"
>
<arg value="-qls"/>
<arg value="-u"/>
<arg value="admin"/>
<arg value="-P"/>
<arg value="${adminpassword}"/>
<arg value="-x"/>
<env key="DEBUG_OPTS" value="-Djava.endorsed.dirs=${installdir}/lib/optional:${installdir}/lib/endorsed:${installdir}/lib/user"/>
</exec>
</target>
</project>