-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
321 lines (268 loc) · 12.3 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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
<?xml version="1.0"?>
<project name="security" default="compile-test" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<import file="dependencies.xml"/>
<target name="usage" description="How to see all the targets">
<echo>USAGE: ant -projecthelp</echo>
<echo>NOTE: Read the README.txt</echo>
</target>
<target name="init" description="Init all parameters and other settings" depends="dependencies">
<property file="local.build.properties"/>
<property file="build.properties"/>
<property name="source.home" value="${basedir}"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<path id="classpath.core">
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${maven2.cp}"/>
</path>
<path id="classpath.util">
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${maven2.cp}"/>
<pathelement path="${classes.dir}"/>
</path>
<path id="classpath.impl">
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${maven2.cp}"/>
<pathelement path="${classes.dir}"/>
</path>
<path id="classpath.examples">
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${classes.dir}"/>
</path>
<path id="classpath.run">
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${classes.dir}"/>
<pathelement path="lib"/> <!-- log4j.properties -->
<pathelement path="build/repository"/> <!-- repository configs -->
<pathelement path="${maven2.cp}"/>
</path>
</target>
<target name="eclipse:classpath" description="Update Eclipse's .classpath file" depends="init">
<ant dir="${source.home}/tools/eclipse.settings" target="update-classpath"
inheritAll="false" inheritRefs="false">
<reference torefid="classpath.ref" refid="classpath.core"/>
<property name="classpath.dir" value="${source.home}"/>
<property name="classes.dir" value=""/>
<property name="source.dirs" value="src/core/java:src/impl/java:src/test/java:src/util/java"/>
</ant>
</target>
<target name="eclipse" description="Generate all files needed to use the project under Eclipse (WARNING: .project file will be overwritten!)" depends="eclipse:classpath">
<copy file="${source.home}/tools/eclipse.settings/Eclipse-3.template.project" tofile="${source.home}/.project">
<filterset>
<filter token="PROJECT_NAME" value="Wyona Security"/>
<filter token="PROJECT_VERSION" value="${security.version}-r${subversion.revision}"/>
<filter token="GENERATION_COMMAND" value="build eclipse"/>
</filterset>
</copy>
<echo>Eclipse project created: in Eclipse you can now import (as an existing project into your workspace) this project with root directory set to ${source.home} and build it there!</echo>
</target>
<target name="compile-core" description="Compile Java classes of core/API" depends="init">
<echo>${classes.dir}</echo>
<mkdir dir="${classes.dir}"/>
<javac srcdir="src/core/java" destdir="${classes.dir}"
classpathref="classpath.core"
debug="true"
source="${source.java.version}"
target="${target.java.version}"
/>
</target>
<target name="compile-util" description="Compile utility Java classes" depends="init, compile-core">
<echo>${classes.dir}</echo>
<mkdir dir="${classes.dir}"/>
<javac srcdir="src/util/java" destdir="${classes.dir}"
classpathref="classpath.util"
debug="true"
source="${source.java.version}"
target="${target.java.version}"
/>
</target>
<target name="compile-impl" description="Compile Java classes of Implementation" depends="init, compile-core">
<echo>${classes.dir}</echo>
<mkdir dir="${classes.dir}"/>
<javac srcdir="src/impl/java" destdir="${classes.dir}"
classpathref="classpath.impl"
debug="true"
source="${source.java.version}"
target="${target.java.version}"
/>
</target>
<target name="compile-test" description="Compile Java classes of Tests" depends="init, compile-util, compile-impl">
<echo>${classes.dir}</echo>
<mkdir dir="${classes.dir}"/>
<javac srcdir="src/test/java" destdir="${classes.dir}"
classpathref="classpath.impl"
debug="true"
source="${source.java.version}"
target="${target.java.version}"
/>
</target>
<target name="build-test" description="Build Tests" depends="init, compile-test">
<copy todir="${build.dir}/repository">
<fileset dir="src/test/repository"/>
</copy>
</target>
<target name="jar-core" description="Create a jar file" depends="init,compile-core">
<mkdir dir="build/lib"/>
<jar
destfile="build/lib/wyona-org-security-core-${security.version}-r${subversion.revision}.jar"
basedir="build/classes"
includes="org/wyona/security/core/**"
>
</jar>
</target>
<target name="jar-util" description="Create a jar file of util classes" depends="init, compile-util">
<mkdir dir="build/lib"/>
<jar
destfile="build/lib/wyona-org-security-util-${security.version}-r${subversion.revision}.jar"
basedir="build/classes"
includes="org/wyona/security/util/**"
>
</jar>
</target>
<target name="jar-impl" description="Create a jar file of implementation" depends="init,compile-impl">
<mkdir dir="build/lib"/>
<jar
destfile="build/lib/wyona-org-security-impl-${security.version}-r${subversion.revision}.jar"
basedir="build/classes"
includes="org/wyona/security/impl/**"
>
</jar>
</target>
<target name="clean" description="Clean Build" depends="init">
<delete dir="${build.dir}"/>
</target>
<target name="run-tests" description="Run Tests" depends="init, compile-test">
<java classname="org.wyona.security.test.HelloWorld">
<classpath refid="classpath.run"/>
</java>
</target>
<target name="install-jars" description="Place core and impl jars into local maven repository" depends="clean">
<antcall target="install-jar-core"/>
<antcall target="install-jar-util"/>
<antcall target="install-jar-impl"/>
</target>
<target name="install-jar-core" description="Place core jar into local maven repository" depends="init,jar-core,patch-pom-core">
<artifact:pom id="maven.project.core" file="build/lib/pom-core.xml"/>
<artifact:install file="build/lib/wyona-org-security-core-${security.version}-r${subversion.revision}.jar">
<pom refid="maven.project.core"/>
</artifact:install>
</target>
<target name="install-jar-util" description="Place util jar into local maven repository" depends="init,jar-util,patch-pom-util">
<artifact:pom id="maven.project.util" file="build/lib/pom-util.xml"/>
<artifact:install file="build/lib/wyona-org-security-util-${security.version}-r${subversion.revision}.jar">
<pom refid="maven.project.util"/>
</artifact:install>
</target>
<target name="install-jar-impl" description="Place impl jar into local maven repository" depends="init,jar-impl,patch-pom-impl">
<artifact:pom id="maven.project.impl" file="build/lib/pom-impl.xml"/>
<artifact:install file="build/lib/wyona-org-security-impl-${security.version}-r${subversion.revision}.jar">
<pom refid="maven.project.impl"/>
</artifact:install>
</target>
<target name="deploy-jars" description="Upload jar files for core and impl into remote maven repository" depends="clean">
<antcall target="deploy-jar-core"/>
<antcall target="deploy-jar-util"/>
<antcall target="deploy-jar-impl"/>
</target>
<target name="install-ssh-provider">
<!-- <artifact:install-provider artifactId="wagon-ssh" version="1.0-beta-2"/> -->
<artifact:install-provider artifactId="wagon-ssh" version="1.0-alpha-7"/>
</target>
<target name="deploy-jar-core" description="Upload core jar file into remote maven repository" depends="init,jar-core,install-ssh-provider,patch-pom-core">
<artifact:pom id="maven.project.core" file="build/lib/pom-core.xml"/>
<echo>deploying to ${repository.url}</echo>
<artifact:deploy file="build/lib/wyona-org-security-core-${security.version}-r${subversion.revision}.jar">
<remoteRepository url="${repository.url}">
<authentication username="${repository.username}" password="${repository.password}"/>
<!--
<authentication username="${repository.username}" privateKey="${user.home}/.ssh/id_dsa"/>
-->
</remoteRepository>
<pom refid="maven.project.core"/>
</artifact:deploy>
</target>
<target name="deploy-jar-util" description="Upload util jar file into remote maven repository" depends="init,jar-util,install-ssh-provider,patch-pom-util">
<artifact:pom id="maven.project.util" file="build/lib/pom-util.xml"/>
<echo>deploying to ${repository.url}</echo>
<artifact:deploy file="build/lib/wyona-org-security-util-${security.version}-r${subversion.revision}.jar">
<remoteRepository url="${repository.url}">
<authentication username="${repository.username}" password="${repository.password}"/>
<!--
<authentication username="${repository.username}" privateKey="${user.home}/.ssh/id_dsa"/>
-->
</remoteRepository>
<pom refid="maven.project.util"/>
</artifact:deploy>
</target>
<target name="deploy-jar-impl" description="Upload impl jar file into remote maven repository" depends="init,jar-impl,install-ssh-provider,patch-pom-impl">
<artifact:pom id="maven.project.impl" file="build/lib/pom-impl.xml"/>
<echo>deploying to ${repository.url}</echo>
<artifact:deploy file="build/lib/wyona-org-security-impl-${security.version}-r${subversion.revision}.jar">
<remoteRepository url="${repository.url}">
<authentication username="${repository.username}" password="${repository.password}"/>
<!--
<authentication username="${repository.username}" privateKey="${user.home}/.ssh/id_dsa"/>
-->
</remoteRepository>
<pom refid="maven.project.impl"/>
</artifact:deploy>
</target>
<target name="patch-pom-core" depends="init">
<copy file="pom-core.xml" todir="build/lib"/>
<replace file="build/lib/pom-core.xml" value="${security.version}-r${subversion.revision}">
<replacetoken>@VERSION@</replacetoken>
</replace>
</target>
<target name="patch-pom-impl" depends="init">
<copy file="pom-impl.xml" todir="build/lib"/>
<replace file="build/lib/pom-impl.xml" value="${security.version}-r${subversion.revision}">
<replacetoken>@VERSION@</replacetoken>
</replace>
</target>
<target name="patch-pom-util" depends="init">
<copy file="pom-util.xml" todir="build/lib"/>
<replace file="build/lib/pom-util.xml" value="${security.version}-r${subversion.revision}">
<replacetoken>@VERSION@</replacetoken>
</replace>
</target>
<!-- the test target executes all tests in the test directory, or alternatively it executes a single test which is specified by the test.class.name property (see README.txt) -->
<target name="test" description="Run JUnit Tests" depends="init, clean, build-test">
<mkdir dir="build/log"/>
<junit fork="yes" printsummary="yes" haltonfailure="no" showoutput="yes" failureproperty="tests.failed">
<formatter type="plain" usefile="false" />
<formatter type="xml"/>
<classpath refid="classpath.run" />
<batchtest todir="build/log" unless="test.class.name">
<fileset dir="${classes.dir}" includes="**/*Test.class" excludes="**/Abstract*.class"/>
</batchtest>
<test todir="build/log" name="${test.class.name}" if="test.class.name"/>
</junit>
<fail if="tests.failed" message="One or more junit tests failed. Please check the log (build/log)."/>
</target>
<target name="javadoc" description="Generate Javadoc" depends="init">
<javadoc
packagenames="org.*"
sourcepath="src/core/java"
destdir="build/javadoc"
classpathref="classpath.core"
>
</javadoc>
</target>
<target name="git-clone" description="Git clone master branch" depends="init">
<echo>Start cloning source from Git, revision: ${subversion.revision}</echo>
<exec executable="git">
<arg value="clone"/>
<arg value="https://github.com/wyona/security.git"/>
<arg value="${build.dir}/git-clone-master-r${subversion.revision}"/>
</exec>
</target>
</project>