-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.xml
262 lines (241 loc) · 10.8 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
<?xml version="1.0" encoding="UTF-8"?>
<project default="xar" name="WeGA-WebApp" basedir="." xmlns:unless="ant:unless">
<dirname property="WeGA-WebApp.basedir" file="${ant.file.WeGA-WebApp}"/>
<!-- import default properties from file -->
<property file="${WeGA-WebApp.basedir}/local.build.properties"/>
<property file="${WeGA-WebApp.basedir}/build.properties"/>
<!-- import ANT file for tests -->
<import file="testing/ant-testing.xml"/>
<target name="all" depends="xar"/>
<target name="rebuild" depends="clean,all"/>
<target name="clean">
<delete dir="${tmp.dir}"/>
<delete dir="${dist.dir}"/>
<delete file="expath-pkg.xml"/>
</target>
<target name="clean-all" depends="clean">
<delete dir="${frontend_libs.dir}"/>
<delete dir="${build.dir}"/>
</target>
<target name="init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${tmp.dir}"/>
<mkdir dir="${dist.dir}"/>
</target>
<target name="test">
<description>Run the regression test, i.e. diffing HTML pages against expected results</description>
<parallel threadCount="5" failonany="yes">
<regressiontest doctype="addenda"/>
<regressiontest doctype="news"/>
<regressiontest doctype="works"/>
<regressiontest doctype="letters"/>
<regressiontest doctype="persons"/>
<regressiontest doctype="orgs"/>
<regressiontest doctype="diaries"/>
<regressiontest doctype="documents"/>
<regressiontest doctype="thematicCommentaries"/>
<regressiontest doctype="var"/>
<regressiontest doctype="writings"/>
<regressiontest doctype="places"/>
</parallel>
</target>
<target name="yarn" depends="init">
<description>Update javascript libraries via yarn</description>
<exec executable="${yarn.cmd}" failonerror="yes">
<arg value="install"/>
</exec>
</target>
<target name="wega-mirador" depends="init">
<description>Update javascript libraries via yarn</description>
<get src="https://github.com/Edirom/WeGA-WebApp-Mirador/releases/download/v0.2.0/WeGA-WebApp-Mirador.zip" dest="${tmp.dir}" skipexisting="yes"/>
<mkdir dir="${dist.dir}/resources/lib/wega-mirador"/>
<unzip src="${tmp.dir}/WeGA-WebApp-Mirador.zip" dest="${dist.dir}/resources/lib/wega-mirador"/>
</target>
<target name="sass" depends="init">
<description>Create CSS files via sass</description>
<exec executable="${sass.cmd}">
<arg line="resources/sass/main.scss ${dist.dir}/resources/css/styles.css"/>
</exec>
<!-- <exec executable="${sass.cmd}">
<arg line="resources/sass/swagger.scss ${dist.dir}/resources/css/swagger.css"/>
</exec> -->
</target>
<target name="swagger-cli" depends="init">
<description>Bundle openapi.json file from YAML definitions</description>
<exec executable="${swagger-cli.cmd}">
<arg line="bundle api/v1/openapi.yaml --output ${dist.dir}/api/v1/openapi.json --dereferenced"/>
</exec>
</target>
<target name="dist" depends="init, yarn, wega-mirador, sass, swagger-cli">
<copy file="expath-pkg.xml.tmpl" tofile="${dist.dir}/expath-pkg.xml" filtering="true" overwrite="true">
<filterset>
<filter token="project.version" value="${project.version}"/>
<filter token="project.name" value="${project.name}"/>
<filter token="project.app" value="${project.app}"/>
</filterset>
</copy>
<!-- Copy everything from base.dir -->
<copy todir="${dist.dir}">
<fileset dir=".">
<include name="*.*"/>
<include name="api/**"/>
<include name="modules/**"/>
<include name="resources/**"/>
<include name="catalogues/**"/>
<include name="indices/**"/>
<include name="templates/**"/>
<include name="xsl/**"/>
<exclude name="build.xml"/>
<exclude name="*build.properties"/>
<exclude name=".git*"/>
<exclude name="*.tmpl"/>
<exclude name="*.txt"/>
<exclude name="*.xpr"/>
<exclude name="package.json"/>
<exclude name="yarn.lock"/>
<exclude name=".dockerignore"/>
<exclude name=".travis.yml"/>
<exclude name="**/less/**"/>
<exclude name="**/sass/**"/>
</fileset>
</copy>
<!-- Copy additional fonts -->
<copy todir="${dist.dir}/resources/fonts" failonerror="false">
<fileset dir="${frontend_libs.dir}/bravura/redist/woff/">
<include name="Bravura.*"/>
</fileset>
<fileset dir="${frontend_libs.dir}/bravura/redist/otf/">
<include name="Bravura.*"/>
</fileset>
<fileset dir="${frontend_libs.dir}/bravura/redist/svg/">
<include name="Bravura.*"/>
</fileset>
<fileset dir="${wega.fonts.dir}">
<include name="2B*.*"/>
</fileset>
<fileset dir="${frontend_libs.dir}/@fortawesome/fontawesome-free/webfonts/">
<include name="*"/>
</fileset>
<fileset dir="${frontend_libs.dir}/Junicode-New/webfiles/">
<include name="*.woff2"/>
</fileset>
</copy>
<!-- Copy additional images -->
<copy todir="${dist.dir}/resources/img" failonerror="false">
<fileset dir="${wega.img.dir}">
<include name="*.*"/>
</fileset>
</copy>
<!-- Copy libs from ${frontend_libs.dir} -->
<copy todir="${dist.dir}/resources/lib">
<fileset dir="${frontend_libs.dir}">
<include name="**/*.js"/>
<include name="**/*.css"/>
<include name="**/*.gif"/>
<include name="**/*.png"/>
<include name="**/*.jpg"/>
<include name="**/*.xsl"/>
<include name="**/*.xml"/>
<!-- exclude unnecessary directories -->
<exclude name="bootstrap-vue/"/>
<exclude name="bravura/"/>
<exclude name="core-js/"/>
<exclude name="@fortawesome/"/>
<exclude name="prettydiff/"/>
<exclude name="less/"/>
<exclude name="sass/"/>
<exclude name="lodash/"/>
<exclude name="minify/"/>
<exclude name="rx/"/>
<exclude name="vnu/"/>
<exclude name="vnu-jar/"/>
<exclude name="vue/"/>
<exclude name="yuicompressor/"/>
<!-- exclude html files. non-well-formed html makes eXist choke -->
<exclude name="**/*.html"/>
<!-- exclude tests to reduce file size -->
<exclude name="**/test/**"/>
<exclude name="**/tests.js"/>
<exclude name="**/docs/**"/>
<exclude name="json-*/**"/>
</fileset>
</copy>
<!-- Copy compiled TEI Guidelines from ${frontend_libs.dir} -->
<!-- TODO: include p5subset.xml as a reference -->
<copy todir="${dist.dir}/guidelines">
<fileset dir="${frontend_libs.dir}/WeGA-ODD/compiled-ODD">
<include name="*.xml"/>
</fileset>
</copy>
</target>
<target name="minify" depends="dist">
<echo>Run minify on CSS files</echo>
<apply executable="${dev_libs.dir}/minify/bin/minify.js" parallel="false">
<fileset dir="${dist.dir}/resources/css" includes="*.css" excludes="*min.css"/>
<redirector>
<outputmapper type="glob" from="*.css" to="${dist.dir}/resources/css/*-min.css"/>
</redirector>
</apply>
<echo>Run minify on JS files</echo>
<apply executable="${dev_libs.dir}/minify/bin/minify.js" parallel="false">
<fileset dir="${dist.dir}/resources/js" includes="*.js" excludes="*min.js"/>
<redirector>
<outputmapper type="glob" from="*.js" to="${dist.dir}/resources/js/*-min.js"/>
</redirector>
</apply>
<echo>Run minify on datepicker.js</echo>
<apply executable="${dev_libs.dir}/minify/bin/minify.js" parallel="false">
<fileset dir="${dist.dir}/resources/lib/jquery-ui/ui/widgets" includes="datepicker.js" excludes="*min.js"/>
<redirector>
<outputmapper type="glob" from="*.js" to="${dist.dir}/resources/lib/jquery-ui/ui/widgets/*-min.js"/>
</redirector>
</apply>
</target>
<target name="xar" depends="init, dist, minify">
<zip destfile="${build.dir}/${project.app}-${project.version}.xar">
<fileset dir="${dist.dir}"/>
</zip>
</target>
<target name="deploy" depends="clean, xar">
<path id="classpath.core">
<fileset dir="${exist.home}/lib/core" erroronmissingdir="no">
<include name="*.jar"/>
</fileset>
<pathelement path="${exist.home}/exist.jar"/>
<pathelement path="${exist.home}/exist-optional.jar"/>
</path>
<path id="classpath.eXist5">
<fileset dir="${exist5.libs}" erroronmissingdir="no">
<include name="*.jar"/>
</fileset>
</path>
<typedef resource="org/exist/ant/antlib.xml" uri="http://exist-db.org/ant">
<classpath refid="classpath.core"/>
<classpath refid="classpath.eXist5"/>
</typedef>
<!-- 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>