-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.xml
executable file
·72 lines (64 loc) · 3.75 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
<?xml version="1.0" encoding="UTF-8"?>
<project default="xar" name="xqjson" xmlns:xdb="http://exist-db.org/ant">
<property name="project.name" value="xqjson"/>
<property name="project.version" value="0.2.1"/>
<property name="package.name" value="http://xqilla.sourceforge.net/pkg/xqjson"/>
<property name="build.dir" value="build"/>
<property name="test.dir" value="test"/>
<property name="exist.dir" value="../exist"/>
<property name="server.xmlrpc.uri" value="xmldb:exist://localhost:8080/exist/xmlrpc/db/apps/"/>
<property name="server.http.uri" value="http://localhost:8080/exist/apps/"/>
<property name="dba.username" value="admin"/>
<property name="dba.password" value=""/>
<property name="test.collection" value="xqjson-test"/>
<property name="test.collection.path" value="/db/apps/${test.collection}"/>
<!-- =================================================================== -->
<!-- Include eXist-db's ant libraries and ant-contrib library -->
<!-- =================================================================== -->
<typedef resource="org/exist/ant/antlib.xml" uri="http://exist-db.org/ant">
<classpath>
<fileset dir="${exist.dir}/lib/core">
<include name="*.jar"/>
</fileset>
<pathelement location="${exist.dir}/exist.jar"/>
<pathelement location="${exist.dir}/exist-optional.jar"/>
</classpath>
</typedef>
<typedef resource="net/sf/antcontrib/antlib.xml" classpath="${exist.dir}/tools/ant/lib/ant-contrib-1.0b3.jar"/>
<!-- =================================================================== -->
<!-- Main targets -->
<!-- =================================================================== -->
<target name="xar">
<mkdir dir="${build.dir}"/>
<zip basedir="src" destfile="${build.dir}/${project.name}-${project.version}.xar"/>
</target>
<target name="clean">
<delete failonerror="false" dir="${build.dir}"/>
</target>
<target name="test" depends="clean,xar,install,run-test-suite,teardown"/>
<target name="install" depends="clean,xar">
<property name="xar">${project.name}-${project.version}.xar</property>
<xdb:store user="${dba.username}" password="${dba.password}" uri="${server.xmlrpc.uri}${test.collection}"
createcollection="true" createsubcollections="true">
<fileset dir="${build.dir}"/>
</xdb:store>
<xdb:xquery user="${dba.username}" password="${dba.password}" uri="${server.xmlrpc.uri}"
outputproperty="deploy-result">repo:install-and-deploy-from-db('${test.collection.path}/${xar}')</xdb:xquery>
<echo message="${deploy-result}"/>
</target>
<target name="run-test-suite">
<xdb:store user="${dba.username}" password="${dba.password}" uri="${server.xmlrpc.uri}${test.collection}"
createcollection="true" createsubcollections="true">
<fileset dir="${test.dir}"/>
</xdb:store>
<exec executable="curl">
<arg line='-H "Accept: application/xml" -H "Content-Type: application/xml" -X GET -u ${dba.username}:${dba.password} ${server.http.uri}${test.collection}/suite.xql'/>
</exec>
</target>
<target name="teardown" depends="clean">
<xdb:xquery user="${dba.username}" password="${dba.password}" uri="${server.xmlrpc.uri}"
outputproperty="remove-result">repo:undeploy('${package.name}'), repo:remove('${package.name}')</xdb:xquery>
<echo message="${remove-result}"/>
<xdb:remove user="${dba.username}" password="${dba.password}" uri="${server.xmlrpc.uri}" collection="${test.collection}"/>
</target>
</project>