-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.xml
123 lines (111 loc) · 4.18 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
<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================
5/07/2014 10:30:48 PM
XProc-Z
An XML transforming web proxy, by Conal Tuohy
====================================================================== -->
<project name="XProc-Z" default="war">
<property file="ant/build.properties"/>
<description>XProc-Z is an XML processing web proxy.</description>
<path id="classpath">
<fileset dir="lib" includes="*.jar"/>
<fileset dir="build/lib" includes="*.jar"/>
</path>
<!-- this target is only run if the 'version' property is undefined -->
<target name="update-version-string" depends="-timestamp" unless="version">
<!-- get a new version string using git describe if possible -->
<echo message="Updating version string..."/>
<exec executable="git" outputproperty="url" failifexecutionfails="false">
<arg value="ls-remote"/>
<arg value="--get-url"/>
</exec>
<exec executable="git" outputproperty="version" failifexecutionfails="false">
<arg value="describe"/>
<arg value="--tags"/>
</exec>
<antcall target="-store-version-string"/>
<!-- ensure version is defined even if git was not available -->
<property file="build/webapp/WEB-INF/classes/xproc-z-build.properties"/>
</target>
<target name="-timestamp">
<tstamp>
<format property="timestamp" pattern="yyyy-MM-dd'T'HH:mm'Z'"/>
<format property="build.date" pattern="yyyy-MM-dd"/>
</tstamp>
</target>
<target name="-store-version-string" depends="-timestamp" if="version">
<!-- store the new version string in the correct property file -->
<echo message="version=${version}"/>
<propertyfile file="build/webapp/WEB-INF/classes/xproc-z-build.properties">
<entry key="version" value="${version}"/>
<entry key="url" value="${url}"/>
<entry key="timestamp" value="${timestamp}"/>
<entry key="build.date" value="${build.date}"/>
</propertyfile>
</target>
<target name="clean">
<echo>Cleaning the build and dist directories</echo>
<delete dir="build"/>
<delete dir="dist"/>
</target>
<target name="init">
<echo>Creating the required directories ...</echo>
<mkdir dir="dist"/>
<mkdir dir="build/webapp"/>
<mkdir dir="build/lib"/>
<mkdir dir="build/webapp/WEB-INF/classes"/>
<mkdir dir="build/webapp/WEB-INF/lib"/>
<echo>Installing XML Calabash libraries ...</echo>
<get src="https://github.com/ndw/xmlcalabash1/releases/download/1.4.1-100/xmlcalabash-1.4.1-100.zip" dest="build/calabash.zip" skipexisting="true"/>
<unzip src="build/calabash.zip" dest="build/lib">
<patternset>
<include name="**/*.jar"/>
<exclude name="**/javax.servlet-api-3.1.0.jar"/>
</patternset>
<mapper type="flatten"/>
</unzip>
<copy todir="build/lib">
<fileset dir="lib">
<include name="**/*.jar"/>
<exclude name="**/servlet-api.jar"/>
</fileset>
</copy>
</target>
<target name="compile" depends="init">
<echo>Compiling Java source files ...</echo>
<javac srcdir="src" destdir="build/webapp/WEB-INF/classes" includeAntRuntime="false" debug="true" debuglevel="lines,vars,source">
<classpath>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="build/lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>
</target>
<target name="copy" depends="compile, update-version-string">
<echo>Copying files ...</echo>
<copy todir="build/webapp/xproc">
<fileset dir="xproc"/>
</copy>
<copy todir="build/webapp/WEB-INF">
<fileset dir="etc"/>
</copy>
<copy todir="build/webapp/static">
<fileset dir="static"/>
</copy>
<copy todir="build/webapp/WEB-INF/lib">
<fileset dir="build/lib">
<include name="**/*.jar"/>
<exclude name="**/javax.servlet-api-3.1.0.jar"/>
</fileset>
</copy>
</target>
<target name="war" depends="copy">
<echo>Building the war file ...</echo>
<war destfile="dist/xproc-z.war" webxml="build/webapp/WEB-INF/web.xml">
<fileset dir="build/webapp"/>
</war>
</target>
</project>