-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.xml
97 lines (87 loc) · 3.44 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
<?xml version="1.0" encoding="UTF-8"?>
<project default="xar" name="WeGA-WebApp-lib">
<!-- import default properties from file -->
<property file="local.build.properties"/>
<property file="build.properties"/>
<target name="all" depends="xar"/>
<target name="rebuild" depends="clean,all"/>
<target name="clean">
<delete dir="${dist.dir}"/>
<delete file="expath-pkg.xml"/>
</target>
<target name="init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${dist.dir}"/>
</target>
<target name="dist" depends="init">
<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 todir="${dist.dir}">
<fileset dir=".">
<!-- Copy everything from base.dir -->
<include name="**"/>
<!-- with some exceptions … -->
<exclude name="build.xml"/>
<exclude name=".travis.yml"/>
<exclude name="build/**"/>
<exclude name="dist/**"/>
<exclude name="*build.properties"/>
<exclude name=".git*"/>
<exclude name="*.tmpl"/>
<exclude name="*.txt"/>
</fileset>
</copy>
</target>
<target name="xar" depends="dist">
<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>