-
Notifications
You must be signed in to change notification settings - Fork 83
/
build.xml
233 lines (204 loc) · 9.65 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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<project xmlns:resolver="antlib:org.apache.maven.resolver.ant" name="sitemesh" default="jar">
<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml"
classpath="lib/maven-resolver-ant-tasks-1.4.0-uber.jar" />
<property name="build.compiler" value="modern" />
<property file="build.properties"/>
<!-- Classpath -->
<path id="cp">
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</path>
<resolver:resolve>
<dependencies>
<dependency groupId="jakarta.servlet" artifactId="jakarta.servlet-api" version="4.0.1" type="jar" scope="compile" />
<dependency groupId="jakarta.servlet.jsp" artifactId="jakarta.servlet.jsp-api" version="2.3.3" type="jar" scope="compile" />
<dependency groupId="org.freemarker" artifactId="freemarker" version="2.3.32" type="jar" scope="compile" />
<dependency groupId="velocity" artifactId="velocity-dep" version="1.4" type="jar" scope="compile" />
<dependency groupId="velocity-tools" artifactId="velocity-tools" version="1.4" type="jar" scope="compile" />
<dependency groupId="tapestry" artifactId="tapestry" version="3.0.3" type="jar" scope="compile" />
<dependency groupId="junit" artifactId="junit" version="4.5" type="jar" scope="compile" />
<dependency groupId="org.mockito" artifactId="mockito-all" version="1.9.5" type="jar" scope="compile" />
</dependencies>
<path refid="cp" classpath="compile"/>
</resolver:resolve>
<resolver:resolve>
<dependencies>
<dependency groupId="de.jflex" artifactId="jflex" version="1.3.5" type="jar" scope="compile" />
</dependencies>
<path refid="jflexcp" classpath="compile"/>
</resolver:resolve>
<target name="jflex" unless="lexer.uptodate" description="Generate Lexer class">
<echo message="Generating HTML lexer using JFlex"/>
<mkdir dir="build/java"/>
<java classpathref="jflexcp" classname="JFlex.Main" fork="yes">
<arg value="-d"/>
<arg value="build/java/com/opensymphony/module/sitemesh/html/tokenizer"/>
<arg value="src/main/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/main/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.8"
target="1.8"
>
<src path="src/main/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/java" 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/java">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="javadocs" description="Generates JavaDoc">
<mkdir dir="docs/api"/>
<!-- stylesheetfile="src/docs/api.css" -->
<javadoc sourcepath="src/main/java"
destdir="docs/api"
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="docs">
<fileset dir="src/docs" excludes="*.css"/>
</copy>
<mkdir dir="docs/dtd"/>
<copy todir="docs" file="README.txt"/>
<copy todir="docs" file="CHANGES.txt"/>
<copy todir="docs/dtd">
<fileset dir="src/etc/dtd"/>
</copy>
<replace dir="docs" token="@VERSION@" value="${version}"/>
</target>
<target name="jar" depends="compile,sources">
<mkdir dir="dist"/>
<copy todir="build/classes">
<fileset dir="src/main/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>
<echo>
To deploy to maven :
mvn deploy:deploy-file -Dfile=./dist/${name}-${version}.jar -DpomFile=./pom.xml -Durl=https://maven.atlassian.com/public -DrepositoryId=atlassian-public
mvn deploy:deploy-file -Dfile=./dist/${name}-${version}-sources.jar -DpomFile=./pom.xml -Dclassifier=sources -Durl=https://maven.atlassian.com/public -DrepositoryId=atlassian-public
To install locally :
mvn install:install-file -Dfile=./dist/${name}-${version}.jar -DpomFile=./pom.xml
</echo>
</target>
<target name="sources" depends="compile">
<mkdir dir="dist"/>
<jar jarfile="dist/${name}-${version}-sources.jar">
<fileset dir="src/main/java"/>
<fileset dir="build/java"/>
</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="docs" prefix="docs"/>
</zip>
</target>
<target name="clean" description="Removes all build artifacts">
<delete dir="build"/>
<delete dir="dist"/>
</target>
</project>