/
build.xml
181 lines (155 loc) · 6.98 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<?xml version="1.0"?>
<project name="sitemesh" default="dist">
<property file="build.properties"/>
<!-- Classpath -->
<path id="cp">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="compile">
<mkdir dir="${build.dir}/classes"/>
<javac destdir="${build.dir}/classes"
classpathref="cp"
optimize="${compile.optimize}"
debug="${compile.debug}"
nowarn="${compile.nowarn}"
deprecation="${compile.deprecation}"
>
<src path="${java.dir}"/>
</javac>
</target>
<target name="test" depends="compile" description="Run all unit tests">
<mkdir dir="${build.dir}/test-classes"/>
<javac srcdir="${test.dir}" destdir="${build.dir}/classes" classpathref="cp" classpath="${build.dir}/classes"/>
<taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" classpathref="cp"/>
<echo message="Running unit tests..."/>
<junit printsummary="no" haltonfailure="yes" fork="no">
<classpath refid="cp"/>
<classpath>
<pathelement location="${build.dir}/classes"/>
<pathelement location="${build.dir}/test-classes"/>
</classpath>
<formatter type="brief" usefile="no"/>
<batchtest>
<fileset dir="${test.dir}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="javadocs" description="Generates JavaDoc">
<mkdir dir="${dist.dir}/docs/api"/>
<javadoc sourcepath="${java.dir}"
destdir="${dist.dir}/docs/api"
stylesheetfile="${docs.dir}/api.css"
packagenames="com.opensymphony.*"
classpathref="cp"
author="true"
version="true"
private="true"
use="true"
windowTitle="${Name} ${version} API"
doctitle="${Name} ${version} API"
footer="<a href="http://www.opensymphony.com/sitemesh/">www.opensymphony.com/sitemesh/</a>">
<link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
<link href="http://java.sun.com/products/servlet/2.3/javadoc/"/>
<link href="http://jakarta.apache.org/velocity/api/"/>
<link href="http://jakarta.apache.org/velocity/tools/javadoc/"/>
<link href="http://freemarker.sourceforge.net/docs/api/"/>
</javadoc>
</target>
<target name="docs" depends="javadocs">
<copy todir="${dist.dir}/docs">
<fileset dir="${docs.dir}" excludes="*.css"/>
</copy>
<mkdir dir="${dist.dir}/docs/dtd"/>
<copy todir="${dist.dir}/docs" file="README.txt"/>
<copy todir="${dist.dir}/docs" file="CHANGES.txt"/>
<copy todir="${dist.dir}/docs/dtd">
<fileset dir="${etc.dir}/dtd"/>
</copy>
<replace dir="${dist.dir}/docs" token="@VERSION@" value="${version}"/>
</target>
<target name="jar" depends="compile">
<mkdir dir="${dist.dir}"/>
<copy todir="${build.dir}/classes/com/opensymphony/module/sitemesh/factory" file="${java.dir}/com/opensymphony/module/sitemesh/factory/sitemesh-default.xml"/>
<jar jarfile="${dist.dir}/${name}-${version}.jar" basedir="${build.dir}/classes"
excludes="**/servlets/**"
>
<metainf dir="${tld.dir}/jsp1.2" includes="*.tld"/>
</jar>
</target>
<target name="blank" depends="jar" description="Builds simple web-app to get started with SiteMesh">
<mkdir dir="${dist.dir}"/>
<war warfile="${dist.dir}/${name}-blank.war" webxml="${blank.dir}/WEB-INF/web.xml">
<fileset dir="${blank.dir}">
<exclude name="WEB-INF/web.xml"/>
</fileset>
<lib dir="${dist.dir}">
<include name="${name}-${version}.jar"/>
</lib>
</war>
</target>
<target name="example" depends="jar" description="Builds sample web-app">
<!-- Temporary work-around for the Tomcat bug. Changes all html files to jsp. -->
<mkdir dir="${build.dir}/example-temp"/>
<copy todir="${build.dir}/example-temp">
<fileset dir="${example.dir}"/>
</copy>
<move todir="${build.dir}/example-temp">
<fileset dir="${build.dir}/example-temp"/>
</move>
<mkdir dir="${dist.dir}"/>
<war warfile="${dist.dir}/${name}-example.war" webxml="${example.dir}/WEB-INF/web.xml">
<fileset dir="${build.dir}/example-temp">
<exclude name="WEB-INF/web.xml"/>
</fileset>
<lib dir="${dist.dir}">
<include name="${name}-${version}.jar"/>
</lib>
<lib dir="${lib.dir}">
<include name="commons-*.jar"/>
<include name="velocity-*.jar"/>
<include name="freemarker.jar"/>
</lib>
<lib dir="${tld.dir}">
<include name="sitemesh*.tld" />
</lib>
<classes dir="${build.dir}/classes">
<include name="**/PathologicalServlet.class"/>
</classes>
<lib dir="${tld.dir}">
<include name="sitemesh*.tld" />
</lib>
</war>
</target>
<target name="changelog" description="Generates a changelog for the last 80 days">
<mkdir dir="${build.dir}"/>
<cvschangelog dir="." destfile="${build.dir}/changelog.xml" daysinpast="80">
<user displayname="Hani Suleiman" userid="hani"/>
<user displayname="Mathias Bogaert" userid="mbogaert"/>
<user displayname="Scott Farquhar" userid="farkas"/>
<user displayname="Mike Cannon-Brookes" userid="rebelutionary"/>
<user displayname="Richard Hallier" userid="rhallier"/>
<user displayname="Chris Miller" userid="chris_miller"/>
<user displayname="Joe Walnes" userid="jwalnes1"/>
</cvschangelog>
<mkdir dir="${dist.dir}/docs"/>
<style in="${build.dir}/changelog.xml" out="${dist.dir}/docs/changelog.html" style="${ant.home}/etc/changelog.xsl">
<param name="title" expression="SiteMesh changelog for the last 80 days"/>
<param name="module" expression="sitemesh"/>
<param name="cvsweb" expression="https://sitemesh.dev.java.net/source/browse/"/>
</style>
</target>
<target name="dist" depends="clean, docs, test, jar, blank, example" description="Builds distribution archives">
<zip zipfile="${dist.dir}/${name}-${version}-sources.zip"
basedir="${basedir}"
excludes="${dist.dir}/**, ${build.dir}/**, **/*.log"
/>
</target>
<target name="clean" description="Removes all build artifacts">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
</project>