forked from Edirom/WeGA-WebApp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
241 lines (220 loc) · 9.37 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
<?xml version="1.0" encoding="UTF-8"?>
<project default="xar" name="WeGA-WebApp" xmlns:unless="ant:unless">
<!-- import default properties from file -->
<property file="local.build.properties"/>
<property file="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="${bower_components.dir}"/>
<delete dir="guidelines"/>
</target>
<target name="init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${tmp.dir}"/>
<mkdir dir="${dist.dir}"/>
<condition property="update.bower">
<not>
<available file="${bower_components.dir}" type="dir"/>
</not>
</condition>
<condition property="update.smufl-font">
<not>
<available file="${bower_components.dir}/bravura.zip"/>
</not>
</condition>
</target>
<target name="test">
<description>Run the regression test, i.e. diffing HTML pages against expected results</description>
<regressiontest doctype="letters"/>
<regressiontest doctype="persons"/>
<regressiontest doctype="orgs"/>
<regressiontest doctype="diaries"/>
<regressiontest doctype="documents"/>
<regressiontest doctype="news"/>
<regressiontest doctype="thematicCommentaries"/>
<regressiontest doctype="var"/>
<regressiontest doctype="writings"/>
</target>
<target name="download-smufl-font" depends="bower" if="${update.smufl-font}">
<description>Download Bravura font from the official website</description>
<get src="${smufl.font}" dest="${bower_components.dir}/bravura.zip" skipexisting="no"/>
</target>
<target name="bower" depends="init" if="${update.bower}">
<description>Update javascript libraries via bower</description>
<exec executable="${bower.cmd}" failonerror="yes">
<arg value="update"/>
</exec>
</target>
<target name="less" depends="init">
<description>Create CSS files via less</description>
<exec executable="${lessc.cmd}">
<arg line="resources/less/styles.less ${dist.dir}/resources/css/styles.css"/>
</exec>
<exec executable="${lessc.cmd}">
<arg line="resources/less/swagger.less ${dist.dir}/resources/css/swagger.css"/>
</exec>
</target>
<target name="dist" depends="init, download-smufl-font, bower, less">
<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="guidelines/**"/>
<include name="xsl/**"/>
<exclude name="build.xml"/>
<exclude name="*build.properties"/>
<exclude name=".git*"/>
<exclude name="*.tmpl"/>
<exclude name="*.txt"/>
<exclude name="bower.json"/>
<exclude name="**/less/**"/>
</fileset>
</copy>
<!-- extract smufl fonts -->
<unzip src="${bower_components.dir}/bravura.zip" dest="${tmp.dir}"/>
<!-- Copy additional fonts -->
<copy todir="${dist.dir}/resources/fonts">
<fileset dir="${tmp.dir}/eot/">
<include name="Bravura.*"/>
<!--<include name="BravuraText.eot"/>-->
<!--<include name="BravuraText.woff"/>-->
<!--<include name="BravuraText.otf"/>-->
<!--<include name="BravuraText.svg"/>-->
</fileset>
<fileset dir="${tmp.dir}/woff/">
<include name="Bravura.*"/>
</fileset>
<fileset dir="${tmp.dir}/otf/">
<include name="Bravura.*"/>
</fileset>
<fileset dir="${tmp.dir}/svg/">
<include name="Bravura.*"/>
</fileset>
<fileset dir="${wega.fonts.dir}">
<include name="2B*.*"/>
</fileset>
<fileset dir="${bower_components.dir}/bootstrap/dist/fonts/">
<include name="*.*"/>
</fileset>
<fileset dir="${bower_components.dir}/fontawesome/fonts/">
<include name="fontawesome-webfont.*"/>
</fileset>
</copy>
<!-- Copy additional images -->
<copy todir="${dist.dir}/resources/img">
<fileset dir="${wega.img.dir}">
<include name="*.*"/>
</fileset>
</copy>
<!-- Copy libs from bower components -->
<copy todir="${dist.dir}/resources/lib">
<fileset dir="${bower_components.dir}">
<include name="**/*.js"/>
<include name="**/*.css"/>
<include name="**/*.gif"/>
<include name="**/*.png"/>
<include name="**/*.jpg"/>
<!-- 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"/>
</fileset>
</copy>
<!-- Copy compiled TEI Guidelines from bower components -->
<!-- TODO: include p5subset.xml as a reference -->
<copy todir="${dist.dir}/guidelines">
<fileset dir="${bower_components.dir}/WeGA-ODD/compiled-ODD">
<include name="*.xml"/>
</fileset>
</copy>
</target>
<target name="yuicompress" depends="dist">
<apply executable="java" parallel="false" dest="${dist.dir}/resources/css">
<fileset dir="${dist.dir}/resources/css" includes="*.css" excludes="*min.css"/>
<arg line="-jar ${yuicompress.jar} -v"/>
<srcfile/>
<arg line="-o"/>
<mapper type="glob" from="*.css" to="*-min.css"/>
<targetfile/>
</apply>
<apply executable="java" parallel="false" dest="${dist.dir}/resources/js">
<fileset dir="${dist.dir}/resources/js" includes="*.js" excludes="*min.js"/>
<arg line="-jar ${yuicompress.jar} -v"/>
<srcfile/>
<arg line="-o"/>
<mapper type="glob" from="*.js" to="*-min.js"/>
<targetfile/>
</apply>
<apply executable="java" parallel="false" dest="${dist.dir}/resources/lib/datepicker-fr/ui/widgets">
<fileset dir="${dist.dir}/resources/lib/datepicker-fr/ui/widgets" includes="datepicker.js" excludes="*min.js"/>
<arg line="-jar ${yuicompress.jar} -v"/>
<srcfile/>
<arg line="-o"/>
<mapper type="glob" from="*.js" to="*-min.js"/>
<targetfile/>
</apply>
</target>
<target name="xar" depends="init, dist, yuicompress">
<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">
<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>
<!-- 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>