-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.xml
165 lines (154 loc) · 6.16 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
<?xml version="1.0" encoding="UTF-8"?>
<project default="deploy" name="mishnah" xmlns:if="ant:if" xmlns:unless="ant:unless">
<property name="project.version" value="0.1"/>
<property name="project.app" value="mishnah"/>
<property name="project.name" value="digitalmishnah"/>
<property name="project.js" value="js"/>
<property name="build.dir" value="build"/>
<property name="dist.dir" value="dist"/>
<property file="local.build.properties"/>
<condition property="isWindows">
<os family="windows" />
</condition>
<property unless:set="isWindows" name="npm" value="npm"/>
<property if:set="isWindows" name="npm" value="npm.cmd"/>
<!-- Cleanup task -->
<target name="clean">
<delete dir="build"/>
<delete dir="dist"/>
<delete dir="${project.js}/mtjsviewer/dist"/>
<delete dir="${project.js}/mtjsviewer/node_modules"/>
</target>
<!-- Build Mishnah-Tosefta Viewer JavaScript App -->
<target name="mtjsviewer">
<!-- Run NPM -->
<!--<exec executable="${npm}" dir="${project.js}/mtjsviewer">
<arg value="install"/>
</exec>
<exec executable="${npm}" dir="${project.js}/mtjsviewer">
<arg value="run"/>
<arg value="build"/>
</exec> -->
<!-- Move dist files to resources -->
<!--<copy file="${project.js}/mtjsviewer/dist/mtjsviewer.js" todir="resources/js"/>-->
</target>
<target name="dist" depends="mtjsviewer">
<delete dir="dist"/>
<mkdir dir="${dist.dir}"/>
<copy todir="${dist.dir}">
<fileset dir=".">
<include name="*.*"/>
<include name="modules/**"/>
<include name="resources/**"/>
<include name="templates/**"/>
<include name="xsl/**"/>
<exclude name="xsl-external/**"/>
<exclude name="xq-external/**"/>
<exclude name="cocoon/**"/>
<exclude name="data/**"/>
<exclude name="build.xml"/>
<exclude name="*build.properties"/>
<exclude name=".git*"/>
<exclude name="*.tmpl"/>
<exclude name="*.txt"/>
<exclude name="*.MD"/>
<exclude name="**/*.bak"/>
<exclude name="**/*.xpr"/>
</fileset>
</copy>
</target>
<target name="xar" depends="dist">
<mkdir dir="${build.dir}"/>
<zip basedir="${dist.dir}" destfile="${build.dir}/${project.app}-${project.version}.xar"/>
</target>
<target name="data">
<!-- get mishnah data from GitHub repository and load to eXist-->
<get src="https://github.com/umd-mith/mishnah-data/archive/master.zip" dest="${build.dir}/mishnah-data.zip"/>
<unzip src="${build.dir}/mishnah-data.zip" dest="${build.dir}"/>
</target>
<target name="deploy" depends="xar, data">
<path id="classpath.core">
<fileset dir="${exist.home}/lib/core">
<!--<fileset dir="${exist.home}/lib">-->
<include name="*.jar"/>
</fileset>
<pathelement path="${exist.home}/exist.jar"/>
<pathelement path="${exist.home}/exist-optional.jar"/>
</path>
<typedef resource="org/exist/ant/antlib.xml" uri="http://exist-db.org/ant">
<classpath refid="classpath.core"/>
</typedef>
<condition property="exists">
<xdb:exist xmlns:xdb="http://exist-db.org/ant"
uri="${exist.db}/digitalmishnah-tei" />
</condition>
<input
if:set="exists"
message="
**********************************
Do you want to replace mishnah TEI data already in the DB (y/n)?
**********************************"
validargs="y,n"
addproperty="do.delete"/>
<condition if:set="exists" property="do.abort">
<equals arg1="n" arg2="${do.delete}"/>
</condition>
<xdb:remove
if:set="exists" unless:set="do.abort" xmlns:xdb="http://exist-db.org/ant"
uri="${exist.db}" collection="digitalmishnah-tei"
user="${exist.user}"
password="${exist.pass}"
failonerror="true"/>
<xdb:store unless:set="do.abort" xmlns:xdb="http://exist-db.org/ant"
uri="${exist.db}/digitalmishnah-tei/mishnah"
createcollection="true"
createsubcollections="true"
user="${exist.user}"
password="${exist.pass}"
failonerror="false">
<fileset dir="${build.dir}/mishnah-data-master/mishnah"/>
</xdb:store>
<xdb:store unless:set="do.abort" xmlns:xdb="http://exist-db.org/ant"
uri="${exist.db}/digitalmishnah-tei/standoff"
createcollection="true"
createsubcollections="true"
user="${exist.user}"
password="${exist.pass}"
failonerror="false">
<fileset dir="${build.dir}/mishnah-data-master/standoff"/>
</xdb:store>
<xdb:store unless:set="do.abort" xmlns:xdb="http://exist-db.org/ant"
uri="${exist.db}/digitalmishnah-tei/tosefta"
createcollection="true"
createsubcollections="true"
user="${exist.user}"
password="${exist.pass}"
failonerror="false">
<fileset dir="${build.dir}/mishnah-data-master/tosefta"/>
</xdb:store>
<!-- store xar-file in eXist-db -->
<xdb:store xmlns:xdb="http://exist-db.org/ant"
uri="${exist.db}/tmp"
createcollection="true"
createsubcollections="true"
user="${exist.user}"
password="${exist.pass}"
failonerror="true">
<fileset file="${build.dir}/${project.app}-${project.version}.xar"/>
</xdb:store>
<!-- Deploy the xar -->
<xdb:xquery xmlns:xdb="http://exist-db.org/ant"
uri="${exist.db}"
user="${exist.user}"
password="${exist.pass}">
(
if("${project.name}" = repo:list()) then (
repo:undeploy("${project.name}"),
repo:remove("${project.name}")
)
else (),
repo:install-and-deploy-from-db("/db/tmp/${project.app}-${project.version}.xar")
)
</xdb:xquery>
</target>
</project>