-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbuild.xml
366 lines (310 loc) · 16.2 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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2015 Archie L. Cobbs
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
-->
<!--
Option targets (execute these before the action targets (like 'repo' or 'resolve') to turn on or off build behaviors):
get-xalan: resolve and download xalan, and use the artifacts generated for the xslt operations. Slow but guarantees
xalan availability. If not specified the build will assume the xalan jars already on ant classpath.
-->
<project name="ivyroundup" default="all" xmlns:ivy="urn:org.apache.ivy.ant">
<!-- Examine environment variables for various defaults -->
<property environment="env"/>
<!--
Set this property to change where the meta-repo is generated. Must use absolute paths.
Convert to Unix format if necessary for greater portability
-->
<pathconvert targetos="unix" property="target.repo">
<path location="${basedir}/repo"/>
</pathconvert>
<!--
Set this property to change which ivy is used. It must be a version of
ivy containing the package resolver.
If not explicitly set, the value of the IVY_JAR environment variable
will be used. If no such environment variable exists,
/usr/share/java/ivy.jar will be used.
Avoid use of "else" attribute which ant 1.6.2 does not support.
-->
<condition property="ivy.jar" value="${env.IVY_JAR}">
<isset property="env.IVY_JAR"/>
</condition>
<condition property="ivy.jar" value="/usr/share/java/ivy.jar">
<not>
<isset property="env.IVY_JAR"/>
</not>
</condition>
<!--
Define Ivy ant tasks.
-->
<taskdef uri="urn:org.apache.ivy.ant"
resource="org/apache/ivy/ant/antlib.xml"
classpath="${ivy.jar}"/>
<!--
Configure ivy.
-->
<ivy:settings id="ivy-settings" file="src/ivy/build-settings.xml"/>
<!-- Default target: build the repo and run all checks -->
<target name="all" depends="clean, repo, resolve" description="Complete build and validity checking"/>
<!-- Regenerate list all module revisions in XML manifest (repo/modules.xml) -->
<target name="modules" description="Regenerate repo/modules.xml">
<mkdir dir="${target.repo}"/>
<!-- Generate list of modules -->
<exec executable="bash" logError="true" failonerror="true">
<arg value="-c"/>
<arg value="
set -e -o pipefail;
TIMESTAMP=`date -u +'%Y-%m-%d %H:%M:%S %Z'`;
export LC_ALL=C;
find src/modules -name ivy.xml -print
| sort -t / -k3,3 -k4,4 -k5,5V
| awk -F/ -v TIMESTAMP="$TIMESTAMP" -f src/awk/xmlify.awk
> ${target.repo}/modules.xml"/>
</exec>
</target>
<!-- Remove modules defined in ignore list -->
<target name="modules-ignore" depends="modules, _init-xalan" if="ignore.list"
description="Remove ignored modules from repo/modules.xml, use -Dignore.list=<module_list.xml>">
<property name="ignore.list.full" location="${ignore.list}"/>
<xslt classpathref="xalan.classpath" style="src/xsl/ignore-modules.xsl" in="${target.repo}/modules.xml" out="${target.repo}/modules-tmp.xml">
<param name="ignore.list" expression="${ignore.list.full}"/>
</xslt>
<move file="${target.repo}/modules-tmp.xml" tofile="${target.repo}/modules.xml"/>
</target>
<!-- Build the Ivy RoundUp packager repository (no artifacts) -->
<target name="repo" depends="gen-repo" description="Regenerate the repository." />
<target name="repo-for-module" depends="gen-repo-for-module" description="Regenerate the repository for single module and revision." />
<!--<target name="repo-for-module" depends="gen-repo-for-module, graph-single" description="Regenerate the repository." />-->
<target name="gen-repo" depends="_init-xalan, modules, modules-ignore" description="Regenerate the repository">
<!-- Wipe repository clean -->
<delete>
<fileset dir="${target.repo}">
<include name="modules/**/ivy.xml"/>
<include name="modules/**/packager.xml"/>
<include name="images/**/*"/>
<include name="xsl/**/*"/>
<include name="css/**/*"/>
<include name="xsd/**/*"/>
</fileset>
</delete>
<!-- Copy support files into repository -->
<copy todir="${target.repo}">
<fileset dir="src">
<include name="images/**/*"/>
<include name="xsl/ivy-doc.xsl"/>
<include name="xsl/modules.xsl"/>
<include name="css/ivy-style.css"/>
<include name="xsd/packager-1.0.xsd"/>
<include name="xsd/ivy.xsd"/>
<include name="xsd/ivyde.xsd"/>
</fileset>
</copy>
<!-- Copy directory structure -->
<copy todir="${target.repo}">
<fileset dir="src">
<include name="modules/**/*"/>
<exclude name="**/ivy.xml"/>
<exclude name="**/packager.xml"/>
</fileset>
</copy>
<!-- Stylesheet for ivy.xml -->
<mkdir dir="build/xsl"/>
<copy file="src/xsl/ivy-repo.xsl" todir="build/xsl" overwrite="true"/>
<!-- Generate ivy.xml files -->
<xslt classpathref="xalan.classpath" style="src/xsl/apply-xsl.xsl" in="${target.repo}/modules.xml" out="/dev/null" force="true">
<param name="filename" expression="ivy.xml"/>
<param name="stylesheet" expression="../../build/xsl/ivy-repo.xsl"/>
<param name="target.repo" expression="${target.repo}" />
<param name="source.base" expression="${basedir}/src" />
<factory name="org.apache.xalan.processor.TransformerFactoryImpl"/>
</xslt>
<!-- Generate packager.xml files -->
<xslt classpathref="xalan.classpath" style="src/xsl/apply-xsl.xsl" in="${target.repo}/modules.xml" out="/dev/null" force="true">
<param name="filename" expression="packager.xml"/>
<param name="stylesheet" expression="packager-repo.xsl"/>
<param name="target.repo" expression="${target.repo}" />
<param name="source.base" expression="${basedir}/src" />
<factory name="org.apache.xalan.processor.TransformerFactoryImpl"/>
</xslt>
<!-- Validate all generated XML files -->
<xmlvalidate failonerror="true" warn="yes" lenient="no">
<attribute name="http://xml.org/sax/features/namespaces" value="true"/>
<attribute name="http://apache.org/xml/features/validation/schema" value="true"/>
<attribute name="http://apache.org/xml/features/validation/schema-full-checking" value="true"/>
<fileset dir="${target.repo}/modules">
<include name="**/ivy.xml"/>
<include name="**/packager.xml"/>
</fileset>
</xmlvalidate>
</target>
<target name="gen-repo-for-module" depends="_init-xalan, modules, modules-ignore" description="Regenerate the repository">
<property name="repo.org" value=""/>
<property name="repo.mod" value=""/>
<property name="repo.rev" value=""/>
<!-- Wipe repository clean -->
<delete>
<fileset dir="${target.repo}">
<include name="modules/${repo.org}/${repo.mod}/${repo.rev}/ivy.xml"/>
<include name="modules/${repo.org}/${repo.mod}/${repo.rev}/packager.xml"/>
<include name="images/**/*"/>
<include name="xsl/**/*"/>
<include name="css/**/*"/>
<include name="xsd/**/*"/>
</fileset>
</delete>
<!-- Copy support files into repository -->
<copy todir="${target.repo}">
<fileset dir="src">
<include name="images/**/*"/>
<include name="xsl/ivy-doc.xsl"/>
<include name="xsl/modules.xsl"/>
<include name="css/ivy-style.css"/>
<include name="xsd/packager-1.0.xsd"/>
<include name="xsd/ivy.xsd"/>
<include name="xsd/ivyde.xsd"/>
</fileset>
</copy>
<!-- Create directory structure -->
<mkdir dir="${target.repo}/modules/${repo.org}/${repo.mod}/${repo.rev}"/>
<!-- Stylesheet for ivy.xml -->
<mkdir dir="build/xsl"/>
<copy file="src/xsl/ivy-repo.xsl" todir="build/xsl" overwrite="true"/>
<!-- Generate ivy.xml files -->
<xslt classpathref="xalan.classpath" style="build/xsl/ivy-repo.xsl" in="src/modules/${repo.org}/${repo.mod}/${repo.rev}/ivy.xml"
out="${target.repo}/modules/${repo.org}/${repo.mod}/${repo.rev}/ivy.xml" force="true">
<param name="organisation" expression="${repo.org}"/>
<param name="module" expression="${repo.mod}"/>
<param name="revision" expression="${repo.rev}"/>
<factory name="org.apache.xalan.processor.TransformerFactoryImpl"/>
</xslt>
<!-- Generate packager.xml files -->
<xslt classpathref="xalan.classpath" style="src/xsl/packager-repo.xsl" in="src/modules/${repo.org}/${repo.mod}/${repo.rev}/packager.xml"
out="${target.repo}/modules/${repo.org}/${repo.mod}/${repo.rev}/packager.xml" force="true">
<param name="organisation" expression="${repo.org}"/>
<param name="module" expression="${repo.mod}"/>
<param name="revision" expression="${repo.rev}"/>
<factory name="org.apache.xalan.processor.TransformerFactoryImpl"/>
</xslt>
<!-- Validate all generated XML files -->
<xmlvalidate failonerror="true" warn="yes" lenient="no">
<attribute name="http://xml.org/sax/features/namespaces" value="true"/>
<attribute name="http://apache.org/xml/features/validation/schema" value="true"/>
<attribute name="http://apache.org/xml/features/validation/schema-full-checking" value="true"/>
<fileset dir="${target.repo}/modules/${repo.org}/${repo.mod}/${repo.rev}">
<include name="**/ivy.xml"/>
<include name="**/packager.xml"/>
</fileset>
</xmlvalidate>
</target>
<target name="graph-single" depends="gen-repo-for-module" unless="skip-graph">
<!-- Create graphs of module dependencies -->
<mkdir dir="build/graph"/>
<xslt classpathref="xalan.classpath" style="src/xsl/modgraph.xsl" in="${target.repo}/modules.xml" out="build/graph/modules.dot">
<param name="node.shape" expression="ellipse"/>
<param name="graph.rankdir" expression="LR"/>
<param name="graph.size" expression="11,11"/>
</xslt>
<exec executable="/bin/bash" logError="false" failonerror="false">
<arg value="-c"/>
<arg value="circo -Tgif -o build/graph/modules.gif build/graph/modules.dot || true"/>
</exec>
<exec executable="/bin/bash" logError="false" failonerror="false">
<arg value="-c"/>
<arg value="circo -Tsvg -o build/graph/modules.svg build/graph/modules.dot || true"/>
</exec>
</target>
<target name="graph" depends="gen-repo" unless="skip-graph">
<!-- Create graphs of module dependencies -->
<mkdir dir="build/graph"/>
<xslt classpathref="xalan.classpath" style="src/xsl/modgraph.xsl" in="${target.repo}/modules.xml" out="build/graph/modules.dot">
<param name="node.shape" expression="ellipse"/>
<param name="graph.rankdir" expression="LR"/>
<param name="graph.size" expression="11,11"/>
</xslt>
<exec executable="/bin/bash" logError="false" failonerror="false">
<arg value="-c"/>
<arg value="circo -Tgif -o build/graph/modules.gif build/graph/modules.dot || true"/>
</exec>
<exec executable="/bin/bash" logError="false" failonerror="false">
<arg value="-c"/>
<arg value="circo -Tsvg -o build/graph/modules.svg build/graph/modules.dot || true"/>
</exec>
</target>
<!-- Clear the temporary cache -->
<target name="clear-cache" description="Clear the cache">
<delete dir="build/cache"/>
<mkdir dir="build/cache"/>
</target>
<!--
Resolve every artifact into the temporary cache and then
build a normal repository that includes artifacts.
You can restrict what gets resolved by defining one or more of:
${resolve.org} - Only resolve when organization matches
${resolve.mod} - Only resolve when module matches
${resolve.rev} - Only resolve when revision matches
-->
<target name="resolve" depends="_init-xalan" description="Resolve everything and build a normal repository">
<!-- Initialize resolve work area and repository we're going to build -->
<delete dir="build/resolve"/>
<delete dir="build/repo-with-artifacts"/>
<mkdir dir="build/resolve"/>
<mkdir dir="build/repo-with-artifacts"/>
<!-- Copy the packager repo -->
<copy todir="build/repo-with-artifacts">
<fileset dir="${target.repo}"/>
</copy>
<!-- Create an ant build that does the resolve and retrieve work -->
<property name="resolve.org" value=""/>
<property name="resolve.mod" value=""/>
<property name="resolve.rev" value=""/>
<xslt classpathref="xalan.classpath" style="src/xsl/resolve.xsl" in="${target.repo}/modules.xml" out="build/resolve/build.xml">
<param name="retrieve.pattern" expression="${basedir}/build/repo-with-artifacts/modules/[organisation]/[module]/[revision]/[type]s/[artifact]-[revision].[ext]"/>
<param name="resolve.org" expression="${resolve.org}"/>
<param name="resolve.mod" expression="${resolve.mod}"/>
<param name="resolve.rev" expression="${resolve.rev}"/>
</xslt>
<copy file="src/ivy/resolve-settings.xml" todir="build/resolve"/>
<!-- Run the build -->
<ant dir="build/resolve" inheritAll="false">
<property name="target.repo" value="${target.repo}"/>
</ant>
</target>
<!-- Clean out all generated files (not including the packager repository under repo/) -->
<target name="clean" description="Delete build files">
<delete dir="build"/>
</target>
<target name="get-xalan">
<property name="download-xalan" value="true" />
</target>
<target name="_init-xalan" depends="_download-xalan, _provided-xalan-classpath" />
<target name="_download-xalan" if="download-xalan">
<!-- Reset xalan files in case they got corrupted -->
<exec executable="git" searchpath="true" failonerror="true">
<arg value="checkout"/>
<arg value="HEAD"/>
<arg value="--"/>
<arg value="${target.repo}/modules/org.apache.xml/xalan-j"/>
<arg value="${target.repo}/modules/org.apache.xml/xml-commons-external"/>
<arg value="${target.repo}/modules/org.apache.xerces/xerces"/>
</exec>
<!-- Find xalan -->
<ivy:resolve revision="2.7.1" settingsRef="ivy-settings" type="jar"
organisation="org.apache.xml" module="xalan-j" inline="true" log="download-only"/>
<ivy:cachepath pathid="xalan.classpath" settingsRef="ivy-settings" type="jar"
organisation="org.apache.xml" module="xalan-j" inline="true" log="download-only"/>
</target>
<target name="_provided-xalan-classpath" unless="download-xalan">
<!-- placeholder declaration -->
<path id="xalan.classpath" path="" />
</target>
<!-- URL checker stuff -->
<import file="src/xml/build-urlcheck.xml"/>
</project>