-
Notifications
You must be signed in to change notification settings - Fork 58
/
build.xml
280 lines (259 loc) · 11 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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<?xml version="1.0"?>
<project name="OpenID4Java Library" default="jar" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<property environment="env"/>
<property file="local.properties"/>
<property file="project.properties"/>
<target name="dist_type">
<condition property="dist.type" value="">
<not><isset property="dist.type"/></not>
</condition>
<condition property="include.xri">
<or>
<equals arg1="-xri" arg2="${dist.type}"/>
<equals arg1="-full" arg2="${dist.type}"/>
</or>
</condition>
<!--
<condition property="include.infocard">
<or>
<equals arg1="-infocard" arg2="${dist.type}"/>
<equals arg1="-full" arg2="${dist.type}"/>
</or>
</condition>
-->
</target>
<target name="set_full_dist">
<property name="dist.type" value="-full"/>
</target>
<target name="create_paths" depends="dist_type">
<path id="classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
<exclude name="lib/xri/**" unless="include.xri"/>
<exclude name="lib/infocard/**"/>
</fileset>
</path>
</target>
<target name="prepare" depends="create_paths">
<mkdir dir="${build}"/>
</target>
<target name="clean" depends="prepare"
description="Removes all build artifacts">
<delete dir="${build}" />
<delete dir="${apidoc}"/>
<delete dir="target" />
<delete file="${component.name}-${version}.tar.gz"/>
</target>
<target name="echoproperties" depends="create_paths"
description="Displays properties; useful for debugging">
<echoproperties/>
</target>
<target name="launch_browser" if="browser.cmd">
<fail unless=".html.file.to.browse"/>
<exec command="${browser.cmd} ${.html.file.to.browse}" spawn="yes"/>
</target>
<target name="compile" depends="prepare" description="Compiles main code">
<mkdir dir="${classes}"/>
<javac destdir="${classes}" source="${jvm.ver}" target="${jvm.ver}"
includeAntRuntime="no" debug="${debug}" deprecation="yes">
<src path="${src}"/>
<classpath refid="classpath"/>
<exclude name="**/LocalXriResolver.java" unless="include.xri"/>
<exclude name="**/infocard/**"/>
</javac>
<copy todir="${classes}">
<fileset dir="${src}" includes="**/*.properties"/>
<fileset dir="${src}" includes="**/*.xsd"/>
</copy>
</target>
<target name="get-version">
<taskdef resource="svntask.properties" classpathref="classpath"/>
<svn>
<status path="." lastchangedrevisionproperty="svn.rev"/>
</svn>
<property file="VERSION"/>
<condition value="${Version}" else="${component.ver}.${svn.rev}"
property="version">
<equals arg1="" arg2="${svn.rev}"/>
</condition>
<echo>Version: ${version}</echo>
</target>
<target name="jar" depends="compile, get-version"
description="Packages compiled class files into a jar archive">
<jar jarfile="${build}/${component.name}${dist.type}.jar">
<fileset dir="${classes}"/>
<manifest>
<section name="openid4java">
<attribute name="Specification-Title" value="OpenID Authentication"/>
<attribute name="Specification-Version" value="2.0,1.1"/>
<attribute name="Specification-Vendor" value="openid.net"/>
<attribute name="Implementation-Title" value="openid4java"/>
<attribute name="Implementation-Version" value="${version}"/>
</section>
</manifest>
</jar>
</target>
<target name="dist" depends="clean, jar, apidoc"
description="Packages official distributable archive">
<propertyfile file="VERSION">
<entry key="Version" value="${version}"/>
</propertyfile>
<move file="${build}/${component.name}${dist.type}.jar"
tofile="${basedir}/${component.name}${dist.type}-${component.ver}.jar"/>
<delete dir="${build}"/>
<delete file="${component.name}${dist.type}-${version}.tar.gz"/>
<tar destfile="${component.name}${dist.type}-${version}.tar.gz" compression="gzip">
<tarfileset dir="${basedir}" prefix="${component.name}${dist.type}-${version}">
<exclude name="lib/xri/**" unless="include.xri"/>
<exclude name="lib/infocard/**"/>
<exclude name="*ipr"/>
<exclude name="*iml"/>
<exclude name="*iws"/>
<exclude name="libsrc/**"/>
<exclude name="lib/ignored/**"/>
<exclude name="lib/test"/>
<exclude name="target"/>
<exclude name="testLog.txt"/>
<exclude name=".classpath"/>
<exclude name=".project"/>
<exclude name=".settings"/>
<exclude name="*tar.gz"/>
</tarfileset>
</tar>
<delete file="${component.name}${dist.type}-${component.ver}.jar"/>
<delete dir="${apidoc}"/>
<delete file="VERSION"/>
</target>
<target name="dist-xri"
description="Packages distributable archive with local XRI resolver support">
<property name="dist.type" value="-xri"/>
<antcall target="dist"/>
</target>
<target name="dist-full"
description="Packages full distributable archive (local XRI resolver and OpenID-Infocard support)">
<property name="dist.type" value="-full"/>
<antcall target="dist"/>
</target>
<target name="release"
description="Packages all distributable archives">
<antcall target="dist"/>
<antcall target="clean"/>
<antcall target="dist-xri"/>
<antcall target="clean"/>
<!--
<antcall target="dist-infocard"/>
<antcall target="clean"/>
-->
<antcall target="dist-full"/>
<antcall target="clean"/>
</target>
<target name="apidoc" depends="prepare"
description="Builds Javadoc documentation">
<mkdir dir="${apidoc}"/>
<javadoc
failonerror="yes"
sourcepath="${src}"
overview="${src}/overview.html"
packagenames="*"
destdir="${apidoc}"
classpathref="classpath"
access="private"
use="yes"
version="yes"
author="yes"
windowtitle="OpenID4Java Library" >
<doctitle>OpenID4Java Library</doctitle>
<bottom>
<![CDATA[<i>Copyright 2006-2008 Sxip Identity Corporation</i>]]>
</bottom>
</javadoc>
<antcall target="launch_browser">
<param name=".html.file.to.browse" value="${apidoc}/index.html"/>
</antcall>
</target>
<target name="maven-antlib" description="retreive dependencies with maven">
<path id="maven.lib.path">
<fileset dir="${basedir}/lib/extra/" includes="maven-ant-tasks*.jar" />
</path>
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="antlib:org.apache.maven.artifact.ant"
classpathref="maven.lib.path"
/>
<artifact:pom id="project" file="pom.xml" />
<artifact:dependencies verbose="true" pathId="classpath.test" pomRefId="project" useScope="test"/>
</target>
<target name="compile_test" depends="compile, maven-antlib"
description="Compiles test classes">
<mkdir dir="${classes.test}"/>
<javac srcdir="${test.src}"
excludes="org/openid4java/infocard/**"
destdir="${classes.test}"
source="${jvm.ver}"
target="${jvm.ver}"
debug="true"
deprecation="true"
fork="true"
includeAntRuntime="false">
<classpath>
<pathelement location="${classes}"/>
<path refid="classpath.test"/>
</classpath>
</javac>
<copy todir="${classes.test}">
<fileset dir="${test.src}" includes="**/*.properties"/>
<fileset dir="${test.src}" includes="**/*.html"/>
</copy>
</target>
<target name="test" depends="set_full_dist, compile_test"
description="Runs tests">
<delete dir="${build}/test/data"/>
<copy todir="${build}/test/data">
<fileset dir="${test.data}" />
</copy>
<replace token="SERVLET_PORT" value="${test.servlet.port}"
dir="${build}/test/data" />
<delete dir="${build}/test/junit/xml"/>
<mkdir dir="${build}/test/junit/xml"/>
<junit printsummary="yes" fork="no" failureproperty="test.failed">
<sysproperty key="YADIS_TEST_DATA" value="${build}/test/data"/>
<sysproperty key="SERVLET_PORT" value="${test.servlet.port}"/>
<sysproperty key="TEST_DATA" value="${test.src}/org/openid4java/"/>
<classpath>
<pathelement location="${classes.test}"/>
<pathelement location="${classes}"/>
<path refid="classpath.test"/>
</classpath>
<!--<formatter type="xml"/>-->
<formatter type="plain"/>
<batchtest fork="true" todir="${build}/test/junit/xml">
<formatter type="xml"/>
<fileset dir="${test.src}">
<include name="**/*Test.java"/>
<exclude name="**/Abstract*.java"/>
<exclude name="**/OpenIDTokenTest.java"/>
</fileset>
</batchtest>
</junit>
<delete dir="${build}/test/junit/html"/>
<mkdir dir="${build}/test/junit/html"/>
<junitreport todir="${build}/test/junit/html">
<fileset dir="${build}/test/junit/xml">
<include name="*.xml"/>
</fileset>
<report todir="${build}/test/junit/html"/>
</junitreport>
<antcall target="launch_browser">
<param name=".html.file.to.browse"
value="build/test/junit/html/index.html"/>
</antcall>
<fail if="test.failed" message="Unit Tests Failed"/>
</target>
<target name="sync-pom-version" description="set the version in pom.xml to properties version">
<echo>set version to ${component.ver}</echo>
<replaceregexp byline="false">
<regexp pattern="<artifactId>openid4java-parent</artifactId>(\s*)<version>([^<]*)</version>"/>
<substitution expression="<artifactId>openid4java-parent</artifactId>\1<version>${component.ver}</version>"/>
<fileset dir="." includes="**/pom.xml"/>
</replaceregexp>
</target>
</project>