-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.xml
104 lines (95 loc) · 4.11 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
<?xml version="1.0" encoding="UTF-8"?>
<project default="all" name="exist-sparql">
<property file="local.build.properties"/>
<property file="build.properties"/>
<condition property="git.commit" value="${git.commit}" else="">
<isset property="git.commit"/>
</condition>
<property name="project.version" value="0.1"/>
<property name="project.app" value="sparql"/>
<property name="project.app.jar" value="${project.app}-${project.version}${git.commit}.jar"/>
<property name="project.lib.version" value="0.1-SNAPSHOT"/>
<property name="project.lib.jar" value="${project.app}-${project.version}-jar-with-dependencies.jar"/>
<property name="build" value="./target"/>
<property name="build.compiler" value="extJavac"/>
<property name="java.src" value="src/main/java"/>
<property name="java.classes" value="${build}/classes"/>
<property name="java.libs" value="lib"/>
<property name="java.libs.tmp" value="lib-tmp"/>
<property name="xar.resources" value="src/main/xar-resources"/>
<property name="server.url" value="http://demo.exist-db.org/exist/apps/public-repo/public/"/>
<target name="resolve" xmlns:ivy="antlib:org.apache.ivy.ant">
<mkdir dir="${java.libs.tmp}"/>
<get src="https://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.4.0/ivy-2.4.0.jar" dest="${java.libs.tmp}/ivy-2.4.0.jar" skipexisting="true"/>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="${java.libs.tmp}/ivy-2.4.0.jar"/>
<ivy:retrieve/>
<ivy:cachepath pathid="dependencies.classpath"/>
</target>
<target name="all" depends="xar"/>
<target name="rebuild" depends="clean,all"/>
<target name="clean">
<delete dir="${build}"/>
<delete file="expath-pkg.xml"/>
<delete file="exist.xml"/>
</target>
<target name="prepare">
<mkdir dir="${build}"/>
<mkdir dir="${java.classes}"/>
</target>
<target name="compile" depends="prepare, resolve">
<javac srcdir="${java.src}" destdir="${java.classes}" optimize="true" debug="true" target="1.8" source="1.8" includeantruntime="false">
<classpath>
<path refid="dependencies.classpath"/>
</classpath>
</javac>
</target>
<target name="jar" depends="compile">
<jar basedir="${java.classes}" jarfile="${build}/${project.app.jar}">
<manifest>
<attribute name="Project-Name" value="${project.app}"/>
<attribute name="Project-Version" value="${project.version}"/>
<attribute name="Project-Build" value="${git.commit}"/>
</manifest>
</jar>
</target>
<target name="xar" depends="jar">
<copy file="expath-pkg.xml.tmpl" tofile="expath-pkg.xml" filtering="true" overwrite="true">
<filterset>
<filter token="project.version" value="${project.version}"/>
</filterset>
</copy>
<copy file="exist.xml.tmpl" tofile="exist.xml" filtering="true" overwrite="true">
<filterset>
<filter token="project.version" value="${project.version}"/>
<filter token="project.app.jar" value="${project.app.jar}"/>
<filter token="project.lib.jar" value="${project.lib.jar}"/>
</filterset>
</copy>
<zip destfile="${build}/${project.app}-${project.version}${git.commit}.xar">
<fileset dir=".">
<include name="README.md"/>
<include name="LICENSE"/>
<include name="expath-pkg.xml"/>
<include name="exist.xml"/>
<include name="${xar.resources}/**"/>
</fileset>
<zipfileset dir="${build}" includes="${java.libs}/${project.app.jar}" prefix="content"/>
<zipfileset dir="${java.libs}" includes="*.jar" prefix="content"/>
</zip>
<delete dir="${build}/classes"/>
<delete>
<fileset dir="${build}">
<include name="*.jar"/>
</fileset>
</delete>
</target>
<target name="upload">
<input message="Enter password:" addproperty="server.pass" defaultvalue="">
<handler type="secure"/>
</input>
<property name="xar" value="${project.app}-${project.version}${git.commit}.xar"/>
<exec executable="curl">
<arg line="-T ${build}/${xar} -u admin:${server.pass} ${server.url}/${xar}"/>
</exec>
</target>
</project>