-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
195 lines (173 loc) · 7.48 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<?xml version="1.0"?>
<project name="sitemesh" default="jar">
<property name="build.compiler" value="modern" />
<property file="build.properties"/>
<!-- Classpath -->
<path id="cp">
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="jflex" unless="lexer.uptodate" description="Generate Lexer class">
<echo message="Generating HTML lexer using JFlex"/>
<mkdir dir="build/java"/>
<java classpath="lib/jflex.jar" classname="JFlex.Main" fork="yes">
<arg value="-d"/>
<arg value="build/java/com/opensymphony/module/sitemesh/html/tokenizer"/>
<arg value="src/java/com/opensymphony/module/sitemesh/html/tokenizer/lexer.flex"/>
</java>
<delete file="build/java/com/opensymphony/module/sitemesh/html/tokenizer/Lexer.java~"/>
</target>
<target name="hostedqa" depends="example">
<taskdef resource="hostedqatasks" classpathref="cp"/>
<upload file="dist/${name}-example.war" account="sitemesh" email="${hostedqa.email}" password="${hostedqa.password}" resourceId="18"/>
<playsuite suiteId="16" clientConfigs="17" appConfigs="12" account="sitemesh" email="${hostedqa.email}" password="${hostedqa.password}"/>
</target>
<target name="compile" description="Compile Java">
<!-- Determine if lexer needs regenerating -->
<uptodate
property="lexer.uptodate"
srcfile="src/java/com/opensymphony/module/sitemesh/html/tokenizer/lexer.flex"
targetfile="build/java/com/opensymphony/module/sitemesh/html/tokenizer/Lexer.java"/>
<antcall target="jflex"/>
<mkdir dir="build/classes"/>
<javac destdir="build/classes"
classpathref="cp"
optimize="${compile.optimize}"
debug="${compile.debug}"
nowarn="${compile.nowarn}"
deprecation="${compile.deprecation}"
source="1.6"
target="1.6"
>
<src path="src/java"/>
<src path="build/java"/>
</javac>
</target>
<target name="test" depends="compile" description="Run all unit tests">
<mkdir dir="build/test-classes"/>
<mkdir dir="build/test-results"/>
<javac srcdir="src/test" destdir="build/test-classes" classpathref="cp" classpath="build/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="yes" forkmode="once" dir=".">
<classpath refid="cp"/>
<classpath>
<pathelement location="build/classes"/>
<pathelement location="build/test-classes"/>
</classpath>
<formatter type="brief" usefile="no"/>
<formatter type="xml"/>
<batchtest todir="build/test-results">
<fileset dir="src/test">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="javadocs" description="Generates JavaDoc">
<mkdir dir="dist/docs/api"/>
<javadoc sourcepath="src/java"
destdir="dist/docs/api"
stylesheetfile="docs/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/docs">
<fileset dir="docs" excludes="*.css"/>
</copy>
<mkdir dir="dist/docs/dtd"/>
<copy todir="dist/docs" file="README.txt"/>
<copy todir="dist/docs" file="CHANGES.txt"/>
<copy todir="dist/docs/dtd">
<fileset dir="src/etc/dtd"/>
</copy>
<replace dir="dist/docs" token="@VERSION@" value="${version}"/>
</target>
<target name="jar" depends="compile">
<mkdir dir="dist"/>
<copy todir="build/classes">
<fileset dir="src/java" excludes="**/*.java,**/*.flex"/>
</copy>
<jar jarfile="dist/${name}-${version}.jar" basedir="build/classes" excludes="**/servlets/**">
<metainf dir="src/etc/tld/jsp1.2" includes="*.tld"/>
</jar>
</target>
<target name="blank" depends="jar" description="Builds simple web-app to get started with SiteMesh">
<mkdir dir="dist"/>
<war warfile="dist/${name}-blank.war" webxml="src/etc/blank/WEB-INF/web.xml">
<fileset dir="src/etc/blank">
<exclude name="WEB-INF/web.xml"/>
</fileset>
<lib dir="dist">
<include name="${name}-${version}.jar"/>
</lib>
<lib dir="src/etc/tld">
<include name="sitemesh*.tld" />
</lib>
</war>
</target>
<target name="example" depends="jar" description="Builds sample web-app">
<mkdir dir="build/example-temp"/>
<copy todir="build/example-temp">
<fileset dir="src/example-webapp"/>
</copy>
<mkdir dir="dist"/>
<war warfile="dist/${name}-example.war" webxml="src/example-webapp/WEB-INF/web.xml">
<fileset dir="build/example-temp">
<exclude name="WEB-INF/web.xml"/>
</fileset>
<lib dir="dist">
<include name="${name}-${version}.jar"/>
</lib>
<lib dir="lib">
<include name="commons-*.jar"/>
<include name="velocity-*.jar"/>
<include name="freemarker.jar"/>
</lib>
<lib dir="src/etc/tld">
<include name="sitemesh*.tld" />
</lib>
</war>
</target>
<target name="dist" depends="clean, test, jar, docs, blank, example" description="Builds distribution archives">
<zip zipfile="dist/${name}-${version}.zip">
<zipfileset dir=".">
<include name="build.xml"/>
<include name="build.properties"/>
<include name="LICENSE.txt"/>
<include name="CHANGES.txt"/>
<include name="README.txt"/>
<include name="src/**"/>
<include name="lib/**"/>
</zipfileset>
<zipfileset dir="build">
<include name="${name}-${version}.jar"/>
<include name="${name}-example.war"/>
<include name="${name}-blank.war"/>
</zipfileset>
<zipfileset dir="dist/docs" prefix="docs"/>
</zip>
</target>
<target name="clean" description="Removes all build artifacts">
<delete dir="build/example-temp"/>
<delete dir="build/test-classes"/>
<delete dir="build/test-results"/>
<delete dir="build/classes"/>
<delete dir="dist"/>
</target>
</project>