-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.xml
161 lines (125 loc) · 6.17 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="Alkacon Diff" default="jar" basedir=".">
<property name="version.number" value="0.9.2" />
<property name="java.target.version" value="1.5" />
<property name="app.name" value="opencms" />
<property name="alkacon.input" location="${basedir}" />
<property name="alkacon.output" location="${basedir}/../BuildAlkacon" />
<property name="alkacon.output.classes" location="${alkacon.output}/diff-classes" />
<property name="alkacon.output.tests" location="${alkacon.output}/diff-test" />
<property name="alkacon.output.jars" location="${alkacon.output}/diff-jars" />
<property name="alkacon.output.src" location="${alkacon.output}/diff-src" />
<property name="excludes" value="**/CVS/*,**/.nbattrs,**/.project,**/.classpath" />
<property environment="env" />
<!--
- Checks if all required libraries are available
-->
<target name="init" >
<echo message="Building Alkacon Diff Library ${version.number}" />
<echo message=" " />
<echo message="Input directory is: ${alkacon.input}" />
<echo message="Output directory is: ${alkacon.output}/diff-*" />
<echo message="Java version detected: ${ant.java.version}"/>
<echo message="Java target version: ${java.target.version}"/>
<echo message="Java home is: ${env.JAVA_HOME}"/>
</target>
<target name="clean" description="Delete existing output directories">
<delete dir="${alkacon.output.classes}" />
<delete dir="${alkacon.output.tests}" />
<delete dir="${alkacon.output.jars}" />
<delete dir="${alkacon.output.src}" />
</target>
<target name="compile" depends="init" description="Compile the classes">
<mkdir dir="${alkacon.output.classes}" />
<uptodate property="classesUpToDate" targetfile="${alkacon.output.jars}/alkacon-diff-${version.number}.jar">
<srcfiles dir= "${alkacon.input}/src" includes="**/*.java" excludes="${build.excludes},${excludes}"/>
<srcfiles dir= "${alkacon.input}/src" includes="**/*.properties,**/*.txt,**/*.xml,**/*.xsd,**/*.dtd,**/*.sql" excludes="${excludes}" />
</uptodate>
<javac
srcdir="${alkacon.input}/src"
destdir="${alkacon.output.classes}"
debug="on"
optimize="on"
deprecation="on"
source="1.4"
target="${java.target.version}">
<!-- compilerarg value="-Xlint:unchecked"/ -->
</javac>
<copy todir="${alkacon.output.classes}">
<fileset dir="${alkacon.input}/src" includes="**/*.properties,**/*.txt,**/*.xml,**/*.xsd,**/*.dtd,**/*.sql" excludes="${excludes}"/>
</copy>
</target>
<target name="jar"
depends="compile" description="Generate the .jar files">
<mkdir dir="${alkacon.output.jars}" />
<jar
jarfile="${alkacon.output.jars}/alkacon-diff-${version.number}.jar"
basedir="${alkacon.output.classes}"
includes="com/alkacon/**"
manifest="${basedir}/manifest.txt" />
</target>
<target name="srcdist"
description="Creates a source distribution ZIP">
<echo message="Building source distribution " />
<echo message=" " />
<echo message="Input directory is: ${alkacon.input}" />
<echo message="Output directory is: ${alkacon.output.src}" />
<mkdir dir="${alkacon.output.src}" />
<delete file="${alkacon.output.src}/alkacon-diff-${version.number}_src.zip" failonerror="no"/>
<zip destfile="${alkacon.output.src}/alkacon-diff-${version.number}_src.zip">
<zipfileset dir="${alkacon.input}/src" excludes="${excludes}" prefix="src" />
<zipfileset dir="${alkacon.input}/test" excludes="${excludes}" prefix="test" />
<zipfileset dir="${alkacon.input}" includes="build.xml,manifest.txt"/>
</zip>
</target>
<target name="compile-tests" depends="jar" description="Compile the test classes">
<mkdir dir="${alkacon.output.tests}" />
<javac
srcdir="${alkacon.input}/test"
destdir="${alkacon.output.tests}"
excludes="**/data/**"
debug="on"
optimize="on"
deprecation="on"
source="1.4"
target="${java.target.version}">
<classpath>
<fileset dir="${alkacon.output}">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>
<copy todir="${alkacon.output.tests}">
<fileset dir="${alkacon.input}/test" includes="**/*.properties,**/*.txt,**/*.xml,**/*.xsd,**/*.dtd,**/*.html" excludes="${excludes},**/data/**"/>
</copy>
</target>
<target name="unittests" depends="compile-tests"
description="Runs the Junit test cases">
<junit showoutput="yes" printsummary="yes" fork="yes" haltonfailure="no" haltonerror="no">
<classpath>
<pathelement path="${alkacon.output.tests}"/>
<fileset dir="${alkacon.output}">
<include name="**/*.jar"/>
</fileset>
</classpath>
<formatter type="plain" />
<test name="com.alkacon.diff.TestDiff" />
</junit>
</target>
<target name="tomcat.update" depends="jar"
description="Copy updated files to Tomcat directory">
<condition property="tomcat.home" value="${env.TOMCAT_HOME}">
<available file="${env.TOMCAT_HOME}" type="dir"/>
</condition>
<condition property="tomcat.home" value="${env.CATALINA_HOME}">
<available file="${env.CATALINA_HOME}" type="dir"/>
</condition>
<echo message="Tomcat home is: ${tomcat.home}" />
<echo message="Application name is: ${app.name}" />
<copy todir="${tomcat.home}/webapps/${app.name}/WEB-INF/lib">
<fileset dir="${alkacon.output.jars}">
<include name="*.jar"/>
</fileset>
</copy>
</target>
</project>