~ubuntu-branches/ubuntu/quantal/netbeans/quantal

« back to all changes in this revision

Viewing changes to j2ee/archiveproject/src/org/netbeans/modules/j2ee/archive/project/resources/build-impl-war.xsl

  • Committer: Bazaar Package Importer
  • Author(s): Marek Slama
  • Date: 2008-01-29 14:11:22 UTC
  • Revision ID: james.westby@ubuntu.com-20080129141122-fnzjbo11ntghxfu7
Tags: upstream-6.0.1
ImportĀ upstreamĀ versionĀ 6.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="UTF-8"?>
 
2
<!--
 
3
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 
4
 
 
5
Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
 
6
 
 
7
 
 
8
The contents of this file are subject to the terms of either the GNU
 
9
General Public License Version 2 only ("GPL") or the Common
 
10
Development and Distribution License("CDDL") (collectively, the
 
11
"License"). You may not use this file except in compliance with the
 
12
License. You can obtain a copy of the License at
 
13
http://www.netbeans.org/cddl-gplv2.html
 
14
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
 
15
specific language governing permissions and limitations under the
 
16
License.  When distributing the software, include this License Header
 
17
Notice in each file and include the License file at
 
18
nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
 
19
particular file as subject to the "Classpath" exception as provided
 
20
by Sun in the GPL Version 2 section of the License file that
 
21
accompanied this code. If applicable, add the following below the
 
22
License Header, with the fields enclosed by brackets [] replaced by
 
23
your own identifying information:
 
24
"Portions Copyrighted [year] [name of copyright owner]"
 
25
 
 
26
Contributor(s):
 
27
 
 
28
The Original Software is NetBeans. The Initial Developer of the Original
 
29
Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
 
30
Microsystems, Inc. All Rights Reserved.
 
31
 
 
32
If you wish your version of this file to be governed by only the CDDL
 
33
or only the GPL Version 2, indicate your decision by adding
 
34
"[Contributor] elects to include this software in this distribution
 
35
under the [CDDL or GPL Version 2] license." If you do not indicate a
 
36
single choice of license, a recipient has the option to distribute
 
37
your version of this file under either the CDDL, the GPL Version 2 or
 
38
to extend the choice of license to its licensees as provided above.
 
39
However, if you add GPL Version 2 code and therefore, elected the GPL
 
40
Version 2 license, then the option applies only if the new code is
 
41
made subject to such option by the copyright holder.
 
42
-->
 
43
 
 
44
<xsl:stylesheet version="1.0"
 
45
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 
46
                xmlns:p="http://www.netbeans.org/ns/project/1"
 
47
                xmlns:xalan="http://xml.apache.org/xslt"
 
48
                xmlns:archiveproject="http://www.netbeans.org/ns/archive-project/1"
 
49
                xmlns:projdeps="http://www.netbeans.org/ns/ant-project-references/1"
 
50
                exclude-result-prefixes="xalan p projdeps">
 
51
    <xsl:output method="xml" indent="yes" encoding="UTF-8" xalan:indent-amount="4"/>
 
52
    <xsl:template match="/">
 
53
 
 
54
        <xsl:comment><![CDATA[
 
55
*** GENERATED FROM project.xml - DO NOT EDIT  ***
 
56
***         EDIT ../build.xml INSTEAD         ***
 
57
 
 
58
For the purpose of easier reading the script
 
59
is divided into following sections:
 
60
  - initialization
 
61
  - compilation
 
62
  - dist
 
63
  - execution
 
64
  - debugging
 
65
  - javadoc
 
66
  - junit compilation
 
67
  - junit execution
 
68
  - junit debugging
 
69
  - cleanup
 
70
 
 
71
]]></xsl:comment>
 
72
 
 
73
        <xsl:variable name="name" select="/p:project/p:configuration/archiveproject:data/archiveproject:name"/>
 
74
        <!-- Synch with build-impl.xsl: -->
 
75
        <xsl:variable name="codename" select="translate($name, ' ', '_')"/>
 
76
        <project name="{$codename}-impl">
 
77
            <xsl:attribute name="default">build</xsl:attribute>
 
78
            <xsl:attribute name="basedir">..</xsl:attribute>
 
79
            <import file="ant-deploy.xml" />
 
80
 
 
81
            <target name="default">
 
82
                <xsl:attribute name="depends">dist</xsl:attribute>
 
83
                <xsl:attribute name="description">Build whole project.</xsl:attribute>
 
84
            </target>
 
85
 
 
86
            <xsl:comment>
 
87
    ======================
 
88
    INITIALIZATION SECTION
 
89
    ======================
 
90
    </xsl:comment>
 
91
 
 
92
            <target name="-pre-init">
 
93
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
 
94
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
 
95
            </target>
 
96
 
 
97
            <target name="-init-private">
 
98
                <xsl:attribute name="depends">-pre-init</xsl:attribute>
 
99
                <property file="nbproject/private/private.properties"/>
 
100
            </target>
 
101
 
 
102
            <target name="-init-user">
 
103
                <xsl:attribute name="depends">-pre-init,-init-private</xsl:attribute>
 
104
                <property file="${{user.properties.file}}"/>
 
105
                <xsl:comment> The two properties below are usually overridden </xsl:comment>
 
106
                <xsl:comment> by the active platform. Just a fallback. </xsl:comment>
 
107
                <property name="default.javac.source" value="1.4"/>
 
108
                <property name="default.javac.target" value="1.4"/>
 
109
            </target>
 
110
 
 
111
            <target name="-init-project">
 
112
                <xsl:attribute name="depends">-pre-init,-init-private,-init-user</xsl:attribute>
 
113
                <property file="nbproject/project.properties"/>
 
114
            </target>
 
115
 
 
116
            <target name="-do-ear-init">
 
117
                <xsl:attribute name="depends">-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property</xsl:attribute>
 
118
                <xsl:attribute name="if">dist.ear.dir</xsl:attribute>
 
119
                <property value="${{build.ear.web.dir}}/META-INF" name="build.meta.inf.dir"/>
 
120
                <property name="build.classes.dir.real" value="${{build.ear.classes.dir}}"/>
 
121
                <property name="build.web.dir.real" value="${{build.ear.web.dir}}"/>
 
122
            </target>
 
123
 
 
124
            <target name="-do-init">
 
125
                <xsl:attribute name="depends">-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property, -do-ear-init</xsl:attribute>
 
126
                <xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:explicit-platform">
 
127
                    <archiveproject:property name="platform.home" value="platforms.${{platform.active}}.home"/>
 
128
                    <archiveproject:property name="platform.bootcp" value="platforms.${{platform.active}}.bootclasspath"/>
 
129
                    <archiveproject:property name="platform.compiler" value="platforms.${{platform.active}}.compile"/>
 
130
                    <archiveproject:property name="platform.javac.tmp" value="platforms.${{platform.active}}.javac"/>
 
131
                    <condition property="platform.javac" value="${{platform.home}}/bin/javac">
 
132
                        <equals arg1="${{platform.javac.tmp}}" arg2="$${{platforms.${{platform.active}}.javac}}"/>
 
133
                    </condition>
 
134
                    <property name="platform.javac" value="${{platform.javac.tmp}}"/>
 
135
                    <archiveproject:property name="platform.java.tmp" value="platforms.${{platform.active}}.java"/>
 
136
                    <condition property="platform.java" value="${{platform.home}}/bin/java">
 
137
                        <equals arg1="${{platform.java.tmp}}" arg2="$${{platforms.${{platform.active}}.java}}"/>
 
138
                    </condition>
 
139
                    <property name="platform.java" value="${{platform.java.tmp}}"/>
 
140
                    <xsl:comment>
 
141
                    <fail unless="platform.home">Must set platform.home</fail>
 
142
                    <fail unless="platform.bootcp">Must set platform.bootcp</fail>
 
143
                    <fail unless="platform.java">Must set platform.java</fail>
 
144
                    <fail unless="platform.javac">Must set platform.javac</fail>
 
145
                    <fail if="platform.invalid">Platform is not correctly set up</fail>
 
146
                    </xsl:comment>
 
147
                </xsl:if>
 
148
                <xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:use-manifest">
 
149
                    <xsl:comment>
 
150
                    <fail unless="manifest.file">Must set manifest.file</fail>
 
151
                    </xsl:comment>
 
152
                </xsl:if>
 
153
                <xsl:call-template name="createRootAvailableTest">
 
154
                    <xsl:with-param name="roots" select="/p:project/p:configuration/archiveproject:data/archiveproject:test-roots"/>
 
155
                    <xsl:with-param name="propName">have.tests</xsl:with-param>
 
156
                </xsl:call-template>
 
157
                <xsl:call-template name="createRootAvailableTest">
 
158
                    <xsl:with-param name="roots" select="/p:project/p:configuration/archiveproject:data/archiveproject:source-roots"/>
 
159
                    <xsl:with-param name="propName">have.sources</xsl:with-param>
 
160
                </xsl:call-template>
 
161
                <condition property="netbeans.home+have.tests">
 
162
                    <and>
 
163
                        <isset property="netbeans.home"/>
 
164
                        <isset property="have.tests"/>
 
165
                    </and>
 
166
                </condition>
 
167
                <property name="javac.compilerargs" value=""/>
 
168
                <condition property="no.deps">
 
169
                    <and>
 
170
                        <istrue value="${{no.dependencies}}"/>
 
171
                    </and>
 
172
                </condition>
 
173
                <condition property="no.dist.ear.dir">
 
174
                    <not>
 
175
                        <isset property="dist.ear.dir"/>
 
176
                    </not>
 
177
                </condition>
 
178
                <property name="build.web.excludes" value="${{build.classes.excludes}}"/>
 
179
                <condition property="do.compile.jsps">
 
180
                    <istrue value="${{compile.jsps}}"/>
 
181
                </condition>
 
182
                <condition property="do.display.browser">
 
183
                    <istrue value="${{display.browser}}"/>
 
184
                </condition>
 
185
                <available file="${{conf.dir}}/MANIFEST.MF" property="has.custom.manifest"/>
 
186
                <available file="${{conf.dir}}/persistence.xml" property="has.persistence.xml"/>
 
187
                
 
188
                <condition property="do.war.package.with.custom.manifest">
 
189
                    <and>
 
190
                        <istrue value="${{war.package}}"/>
 
191
                        <isset property="has.custom.manifest"/>
 
192
                    </and>
 
193
                </condition>
 
194
                <condition property="do.war.package.without.custom.manifest">
 
195
                    <and>
 
196
                        <istrue value="${{war.package}}"/>
 
197
                        <not>
 
198
                            <isset property="has.custom.manifest"/>
 
199
                        </not>
 
200
                    </and>
 
201
                </condition>
 
202
                
 
203
                <property value="${{build.web.dir}}/META-INF" name="build.meta.inf.dir"/>
 
204
                <property name="build.classes.dir.real" value="${{build.classes.dir}}"/>
 
205
                <property name="build.web.dir.real" value="${{build.web.dir}}"/>
 
206
                <property name="dist.archive" value="${{dist.dir}}/${{war.name}}"/>
 
207
            </target>
 
208
 
 
209
            <target name="-post-init">
 
210
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
 
211
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
 
212
            </target>
 
213
 
 
214
            <target name="-init-check">
 
215
                <xsl:attribute name="depends">-pre-init,-init-private,-init-user,-init-project,-do-init</xsl:attribute>
 
216
                <!-- XXX XSLT 2.0 would make it possible to use a for-each here -->
 
217
                <!-- Note that if the properties were defined in project.xml that would be easy -->
 
218
                <!-- But required props should be defined by the AntBasedProjectType, not stored in each project -->
 
219
                <xsl:call-template name="createSourcePathValidityTest">
 
220
                    <xsl:with-param name="roots" select="/p:project/p:configuration/archiveproject:data/archiveproject:source-roots"/>
 
221
                </xsl:call-template>
 
222
                <xsl:call-template name="createSourcePathValidityTest">
 
223
                    <xsl:with-param name="roots" select="/p:project/p:configuration/archiveproject:data/archiveproject:test-roots"/>
 
224
                </xsl:call-template>
 
225
                <xsl:comment>
 
226
                <fail unless="build.dir">Must set build.dir</fail>
 
227
                <fail unless="build.web.dir">Must set build.web.dir</fail>
 
228
                <fail unless="build.generated.dir">Must set build.generated.dir</fail>
 
229
                <fail unless="dist.dir">Must set dist.dir</fail>
 
230
                <fail unless="build.classes.dir">Must set build.classes.dir</fail>
 
231
                <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
 
232
                <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
 
233
                <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
 
234
                <fail unless="dist.war">Must set dist.war</fail>
 
235
                </xsl:comment>
 
236
            </target>
 
237
 
 
238
            <target name="-init-macrodef-property">
 
239
                <macrodef>
 
240
                    <xsl:attribute name="name">property</xsl:attribute>
 
241
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/web-project/1</xsl:attribute>
 
242
                    <attribute>
 
243
                        <xsl:attribute name="name">name</xsl:attribute>
 
244
                    </attribute>
 
245
                    <attribute>
 
246
                        <xsl:attribute name="name">value</xsl:attribute>
 
247
                    </attribute>
 
248
                    <sequential>
 
249
                        <property name="@{{name}}" value="${{@{{value}}}}"/>
 
250
                    </sequential>
 
251
                  </macrodef>
 
252
            </target>
 
253
 
 
254
            <target name="-init-macrodef-javac">
 
255
                <macrodef>
 
256
                    <xsl:attribute name="name">javac</xsl:attribute>
 
257
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/web-project/2</xsl:attribute>
 
258
                    <attribute>
 
259
                        <xsl:attribute name="name">srcdir</xsl:attribute>
 
260
                        <xsl:attribute name="default">
 
261
                            <xsl:call-template name="createPath">
 
262
                                <xsl:with-param name="roots" select="/p:project/p:configuration/archiveproject:data/archiveproject:source-roots"/>
 
263
                            </xsl:call-template>
 
264
                        </xsl:attribute>
 
265
                    </attribute>
 
266
                    <attribute>
 
267
                        <xsl:attribute name="name">destdir</xsl:attribute>
 
268
                        <xsl:attribute name="default">${build.classes.dir.real}</xsl:attribute>
 
269
                    </attribute>
 
270
                    <attribute>
 
271
                        <xsl:attribute name="name">classpath</xsl:attribute>
 
272
                        <xsl:attribute name="default">${javac.classpath}:${j2ee.platform.classpath}</xsl:attribute>
 
273
                    </attribute>
 
274
                    <attribute>
 
275
                        <xsl:attribute name="name">debug</xsl:attribute>
 
276
                        <xsl:attribute name="default">${javac.debug}</xsl:attribute>
 
277
                    </attribute>
 
278
                    <element>
 
279
                        <xsl:attribute name="name">customize</xsl:attribute>
 
280
                        <xsl:attribute name="optional">true</xsl:attribute>
 
281
                    </element>
 
282
                    <sequential>
 
283
                        <javac>
 
284
                            <xsl:attribute name="srcdir">@{srcdir}</xsl:attribute>
 
285
                            <xsl:attribute name="destdir">@{destdir}</xsl:attribute>
 
286
                            <xsl:attribute name="debug">@{debug}</xsl:attribute>
 
287
                            <xsl:attribute name="deprecation">${javac.deprecation}</xsl:attribute>
 
288
                            <xsl:if test ="not(/p:project/p:configuration/archiveproject:data/archiveproject:explicit-platform/@explicit-source-supported ='false')">
 
289
                                <xsl:attribute name="source">${javac.source}</xsl:attribute>
 
290
                                <xsl:attribute name="target">${javac.target}</xsl:attribute>
 
291
                            </xsl:if>
 
292
                            <xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:explicit-platform">
 
293
                                <xsl:attribute name="fork">yes</xsl:attribute>
 
294
                                <xsl:attribute name="executable">${platform.javac}</xsl:attribute>
 
295
                                <xsl:attribute name="tempdir">${java.io.tmpdir}</xsl:attribute> <!-- XXX cf. #51482, Ant #29391 -->
 
296
                            </xsl:if>
 
297
                            <xsl:attribute name="includeantruntime">false</xsl:attribute>
 
298
                            <classpath>
 
299
                                <path path="@{{classpath}}"/>
 
300
                            </classpath>
 
301
                            <compilerarg line="${{javac.compilerargs}}"/>
 
302
                            <customize/>
 
303
                        </javac>
 
304
                    </sequential>
 
305
                 </macrodef>
 
306
            </target>
 
307
 
 
308
            <target name="-init-macrodef-junit">
 
309
                <macrodef>
 
310
                    <xsl:attribute name="name">junit</xsl:attribute>
 
311
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/web-project/2</xsl:attribute>
 
312
                    <attribute>
 
313
                        <xsl:attribute name="name">includes</xsl:attribute>
 
314
                        <xsl:attribute name="default">**/*Test.java</xsl:attribute>
 
315
                    </attribute>
 
316
                    <sequential>
 
317
                        <junit>
 
318
                            <xsl:attribute name="showoutput">true</xsl:attribute>
 
319
                            <xsl:attribute name="fork">true</xsl:attribute>
 
320
                            <xsl:attribute name="dir">${basedir}</xsl:attribute> <!-- #47474: match <java> -->
 
321
                            <xsl:attribute name="failureproperty">tests.failed</xsl:attribute>
 
322
                            <xsl:attribute name="errorproperty">tests.failed</xsl:attribute>
 
323
                            <xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:explicit-platform">
 
324
                                <xsl:attribute name="jvm">${platform.java}</xsl:attribute>
 
325
                            </xsl:if>
 
326
                            <batchtest todir="${{build.test.results.dir}}">
 
327
                                <xsl:call-template name="createFilesets">
 
328
                                    <xsl:with-param name="roots" select="/p:project/p:configuration/archiveproject:data/archiveproject:test-roots"/>
 
329
                                    <xsl:with-param name="includes">@{includes}</xsl:with-param>
 
330
                                </xsl:call-template>
 
331
                            </batchtest>
 
332
                            <classpath>
 
333
                                <path path="${{run.test.classpath}}"/>
 
334
                            </classpath>
 
335
                            <syspropertyset>
 
336
                                <propertyref prefix="test-sys-prop."/>
 
337
                                <mapper type="glob" from="test-sys-prop.*" to="*"/>
 
338
                            </syspropertyset>
 
339
                            <formatter type="brief" usefile="false"/>
 
340
                            <formatter type="xml"/>
 
341
                        </junit>
 
342
                    </sequential>
 
343
                </macrodef>
 
344
            </target>
 
345
 
 
346
            <target name="-init-macrodef-java">
 
347
                <macrodef>
 
348
                    <xsl:attribute name="name">java</xsl:attribute>
 
349
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/web-project/1</xsl:attribute>
 
350
                    <attribute>
 
351
                        <xsl:attribute name="name">classname</xsl:attribute>
 
352
                        <xsl:attribute name="default">${main.class}</xsl:attribute>
 
353
                    </attribute>
 
354
                    <element>
 
355
                        <xsl:attribute name="name">customize</xsl:attribute>
 
356
                        <xsl:attribute name="optional">true</xsl:attribute>
 
357
                    </element>
 
358
                    <sequential>
 
359
                        <java fork="true" classname="@{{classname}}">
 
360
                            <xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:explicit-platform">
 
361
                                <xsl:attribute name="jvm">${platform.java}</xsl:attribute>
 
362
                            </xsl:if>
 
363
                            <jvmarg line="${{runmain.jvmargs}}"/>
 
364
                            <classpath>
 
365
                                <path path="${{build.classes.dir.real}}:${{javac.classpath}}:${{j2ee.platform.classpath}}"/>
 
366
                            </classpath>
 
367
                            <syspropertyset>
 
368
                                <propertyref prefix="run-sys-prop."/>
 
369
                                <mapper type="glob" from="run-sys-prop.*" to="*"/>
 
370
                            </syspropertyset>
 
371
                            <customize/>
 
372
                        </java>
 
373
                    </sequential>
 
374
                </macrodef>
 
375
            </target>
 
376
 
 
377
            <target name="-init-macrodef-nbjpda">
 
378
                <macrodef>
 
379
                    <xsl:attribute name="name">nbjpdastart</xsl:attribute>
 
380
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/web-project/1</xsl:attribute>
 
381
                    <attribute>
 
382
                        <xsl:attribute name="name">name</xsl:attribute>
 
383
                        <xsl:attribute name="default">${main.class}</xsl:attribute>
 
384
                    </attribute>
 
385
                    <attribute>
 
386
                        <xsl:attribute name="name">classpath</xsl:attribute>
 
387
                        <xsl:attribute name="default">${debug.classpath}</xsl:attribute>
 
388
                    </attribute>
 
389
                    <sequential>
 
390
                        <nbjpdastart transport="dt_socket" addressproperty="jpda.address" name="@{{name}}">
 
391
                            <classpath>
 
392
                                <path path="@{{classpath}}"/>
 
393
                            </classpath>
 
394
                            <xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:explicit-platform">
 
395
                                <bootclasspath>
 
396
                                    <path path="${{platform.bootcp}}"/>
 
397
                                </bootclasspath>
 
398
                            </xsl:if>
 
399
                        </nbjpdastart>
 
400
                    </sequential>
 
401
                </macrodef>
 
402
                <macrodef>
 
403
                    <xsl:attribute name="name">nbjpdareload</xsl:attribute>
 
404
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/web-project/1</xsl:attribute>
 
405
                    <attribute>
 
406
                        <xsl:attribute name="name">dir</xsl:attribute>
 
407
                        <xsl:attribute name="default">${build.classes.dir.real}</xsl:attribute>
 
408
                    </attribute>
 
409
                    <sequential>
 
410
                        <nbjpdareload>
 
411
                            <fileset includes="${{fix.includes}}*.class" dir="@{{dir}}"/>
 
412
                        </nbjpdareload>
 
413
                    </sequential>
 
414
                </macrodef>
 
415
            </target>
 
416
 
 
417
            <target name="-init-debug-args">
 
418
                <xsl:choose>
 
419
                    <xsl:when test="/p:project/p:configuration/archiveproject:data/archiveproject:explicit-platform">
 
420
                        <exec executable="${{platform.java}}" outputproperty="version-output">
 
421
                            <arg value="-version"/>
 
422
                        </exec>
 
423
                    </xsl:when>
 
424
                    <xsl:otherwise>
 
425
                        <property name="version-output" value="java version &quot;${{ant.java.version}}"/>
 
426
                    </xsl:otherwise>
 
427
                </xsl:choose>
 
428
                <condition property="have-jdk-older-than-1.4">
 
429
                    <!-- <matches pattern="^java version &quot;1\.[0-3]" string="${version-output}"/> (ANT 1.7) -->
 
430
                    <or>
 
431
                        <contains string="${{version-output}}" substring="java version &quot;1.0"/>
 
432
                        <contains string="${{version-output}}" substring="java version &quot;1.1"/>
 
433
                        <contains string="${{version-output}}" substring="java version &quot;1.2"/>
 
434
                        <contains string="${{version-output}}" substring="java version &quot;1.3"/>
 
435
                    </or>
 
436
                </condition>
 
437
                <condition property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none" else="-Xdebug">
 
438
                    <istrue value="${{have-jdk-older-than-1.4}}"/>
 
439
                </condition>
 
440
            </target>
 
441
 
 
442
            <target name="-init-macrodef-debug" depends="-init-debug-args">
 
443
                <macrodef>
 
444
                    <xsl:attribute name="name">debug</xsl:attribute>
 
445
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/web-project/1</xsl:attribute>
 
446
                    <attribute>
 
447
                        <xsl:attribute name="name">classname</xsl:attribute>
 
448
                        <xsl:attribute name="default">${main.class}</xsl:attribute>
 
449
                    </attribute>
 
450
                    <attribute>
 
451
                        <xsl:attribute name="name">classpath</xsl:attribute>
 
452
                        <xsl:attribute name="default">${debug.classpath}</xsl:attribute>
 
453
                    </attribute>
 
454
                    <attribute>
 
455
                        <xsl:attribute name="name">args</xsl:attribute>
 
456
                        <xsl:attribute name="default">${application.args}</xsl:attribute>
 
457
                    </attribute>
 
458
                    <sequential>
 
459
                        <java fork="true" classname="@{{classname}}">
 
460
                            <xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:explicit-platform">
 
461
                                <xsl:attribute name="jvm">${platform.java}</xsl:attribute>
 
462
                            </xsl:if>
 
463
                            <jvmarg line="${{debug-args-line}}"/>
 
464
                            <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${{jpda.address}}"/>
 
465
                            <jvmarg line="${{runmain.jvmargs}}"/>
 
466
                            <classpath>
 
467
                                <path path="@{{classpath}}"/>
 
468
                            </classpath>
 
469
                            <syspropertyset>
 
470
                                <propertyref prefix="run-sys-prop."/>
 
471
                                <mapper type="glob" from="run-sys-prop.*" to="*"/>
 
472
                            </syspropertyset>
 
473
                            <arg line="@{{args}}"/>
 
474
                        </java>
 
475
                    </sequential>
 
476
                </macrodef>
 
477
            </target>
 
478
 
 
479
            <target name="-init-macrodef-copy-ear-war">
 
480
                <macrodef name="copy-ear-war">
 
481
                    <attribute name="file"/>
 
482
                    <attribute name="propname"/>
 
483
                    <sequential>
 
484
                        <property name="temp.dirname" value="${{dist.ear.dir}}/temp"/>
 
485
                        <mkdir dir="${{dist.ear.dir}}/temp"/>
 
486
                        <basename property="base_@{{propname}}" file="@{{file}}"/>
 
487
                        <unzip src="@{{file}}" dest="${{temp.dirname}}">
 
488
                            <patternset>
 
489
                                <include name="META-INF/tlds/*.tld"/>
 
490
                            </patternset>
 
491
                        </unzip>
 
492
                        <available file="${{temp.dirname}}/META-INF/tlds" type="dir" property="hastlds_@{{propname}}"/>
 
493
                        <condition value="${{build.web.dir.real}}/WEB-INF/lib" property="copy.to.dir_@{{propname}}">
 
494
                            <isset property="hastlds_@{{propname}}"/>
 
495
                        </condition>
 
496
                        <condition value="${{dist.ear.dir}}" property="copy.to.dir_@{{propname}}">
 
497
                            <not>
 
498
                                <isset property="hastlds_@{{propname}}"/>
 
499
                            </not>
 
500
                        </condition>
 
501
                        <copy file="@{{file}}" todir="${{copy.to.dir_@{{propname}}}}"/>
 
502
                        <!--manifest handling-->
 
503
                        <condition value="${{base_@{{propname}}}}" property="@{{propname}}">
 
504
                            <not>
 
505
                                <isset property="hastlds_@{{propname}}"/>
 
506
                            </not>
 
507
                        </condition>
 
508
                        <condition value="" property="@{{propname}}">
 
509
                            <isset property="hastlds_@{{propname}}"/>
 
510
                        </condition>
 
511
                        <delete dir="${{dist.ear.dir}}/temp"/>
 
512
                    </sequential>
 
513
                </macrodef>
 
514
            </target>
 
515
 
 
516
            <target name="init">
 
517
                <xsl:attribute name="depends">-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-java,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-copy-ear-war</xsl:attribute>
 
518
            </target>
 
519
 
 
520
            <xsl:comment>
 
521
    ======================
 
522
    COMPILATION SECTION
 
523
    ======================
 
524
    </xsl:comment>
 
525
            <target name="-pre-pre-compile">
 
526
                <xsl:attribute name="depends">init<xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:web-service-clients/archiveproject:web-service-client">,web-service-client-generate</xsl:if></xsl:attribute>
 
527
                <mkdir dir="${{build.classes.dir.real}}"/>
 
528
            </target>
 
529
 
 
530
            <target name="-pre-compile">
 
531
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
 
532
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
 
533
            </target>
 
534
 
 
535
            <target name="-copy-webdir">
 
536
                <copy todir="${{build.web.dir.real}}">
 
537
                  <fileset excludes="${{build.web.excludes}}" dir="${{web.docbase.dir}}">
 
538
                   <xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:web-services/archiveproject:web-service">
 
539
                     <xsl:attribute name="excludes">WEB-INF/classes/** WEB-INF/web.xml WEB/sun-web.xml</xsl:attribute>
 
540
                   </xsl:if>
 
541
                  </fileset>
 
542
                </copy>
 
543
 
 
544
                <xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:web-services/archiveproject:web-service">
 
545
                    <xsl:comment>For web services, refresh web.xml and sun-web.xml</xsl:comment>
 
546
                    <copy todir="${{build.web.dir.real}}" overwrite="true">
 
547
                      <fileset includes="WEB-INF/web.xml WEB-INF/sun-web.xml" dir="${{web.docbase.dir}}"/>
 
548
                    </copy>
 
549
                 </xsl:if>
 
550
            </target>
 
551
 
 
552
            <target name="-do-compile">
 
553
                <xsl:attribute name="depends">init,  -pre-pre-compile, -pre-compile, -copy-manifest, -copy-webdir</xsl:attribute>
 
554
                <xsl:attribute name="if">have.sources</xsl:attribute>
 
555
 
 
556
                <archiveproject:javac destdir="${{build.classes.dir.real}}"/>
 
557
 
 
558
                <copy todir="${{build.classes.dir.real}}">
 
559
                    <xsl:call-template name="createFilesets">
 
560
                        <xsl:with-param name="roots" select="/p:project/p:configuration/archiveproject:data/archiveproject:source-roots"/>
 
561
                        <xsl:with-param name="excludes">${build.classes.excludes}</xsl:with-param>
 
562
                    </xsl:call-template>
 
563
                </copy>
 
564
            </target>
 
565
 
 
566
            <target name="-copy-manifest" if="has.custom.manifest">
 
567
                <mkdir dir="${{build.meta.inf.dir}}"/>
 
568
                <copy todir="${{build.meta.inf.dir}}">
 
569
                    <fileset dir="${{conf.dir}}" includes="MANIFEST.MF"/>
 
570
                </copy>
 
571
            </target>
 
572
            
 
573
            <target name="-post-compile">
 
574
                <xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:web-services/archiveproject:web-service">
 
575
                    <xsl:attribute name="depends">
 
576
                        <xsl:for-each select="/p:project/p:configuration/archiveproject:data/archiveproject:web-services/archiveproject:web-service">
 
577
                                <xsl:if test="position()!=1"><xsl:text>, </xsl:text>
 
578
                                </xsl:if>
 
579
                                <xsl:choose>
 
580
                                  <xsl:when test="not(archiveproject:from-wsdl)">
 
581
                                    <xsl:value-of select="archiveproject:web-service-name"/><xsl:text>_wscompile</xsl:text>
 
582
                                  </xsl:when>
 
583
                                  <xsl:otherwise>
 
584
                                    <xsl:text>fromwsdl-noop</xsl:text>
 
585
                                  </xsl:otherwise>
 
586
                                </xsl:choose>
 
587
                         </xsl:for-each>
 
588
                    </xsl:attribute>
 
589
                </xsl:if>
 
590
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
 
591
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
 
592
            </target>
 
593
 
 
594
            <target name="compile">
 
595
                <xsl:attribute name="depends">init,-pre-pre-compile,-pre-compile,-do-compile,-post-compile</xsl:attribute>
 
596
                <xsl:attribute name="description">Compile project.</xsl:attribute>
 
597
            </target>
 
598
 
 
599
            <xsl:comment>
 
600
    ======================
 
601
    DIST BUILDING SECTION
 
602
    ======================
 
603
    </xsl:comment>
 
604
 
 
605
            <target name="-pre-dist">
 
606
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
 
607
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
 
608
            </target>
 
609
 
 
610
 
 
611
            <target name="-do-dist">
 
612
                <mkdir dir="${{dist.dir}}"/>
 
613
                <jar jarfile="${{dist.archive}}">
 
614
                    <fileset dir="${{content.dir}}"/>
 
615
                </jar>
 
616
            </target>
 
617
            
 
618
            <target name="-post-dist">
 
619
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
 
620
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
 
621
            </target>
 
622
 
 
623
            <target name="dist">
 
624
                <xsl:attribute name="depends">init,-pre-dist,-do-dist,-post-dist</xsl:attribute>
 
625
                <xsl:attribute name="description">Build distribution (WAR).</xsl:attribute>
 
626
            </target>
 
627
 
 
628
            <xsl:comment>
 
629
    ======================
 
630
    EXECUTION SECTION
 
631
    ======================
 
632
    </xsl:comment>
 
633
 
 
634
            <target name="run-deploy">
 
635
                <xsl:attribute name="depends">init,dist,-run-deploy-nb,-init-deploy-ant,-deploy-ant</xsl:attribute>
 
636
            </target>
 
637
            
 
638
            <target name="-run-deploy-nb" if="netbeans.home">
 
639
                <nbdeploy debugmode="false" clientUrlPart="${{client.urlPart}}" forceRedeploy="${{forceRedeploy}}"/>
 
640
            </target>
 
641
 
 
642
            <target name="-init-deploy-ant" unless="netbeans.home">
 
643
                <property name="deploy.ant.archive" value="${{dist.archive}}"/>
 
644
                <property name="deploy.ant.docbase.dir" value="${{web.docbase.dir}}"/>
 
645
                <property name="deploy.ant.resource.dir" value="${{resource.dir}}"/>
 
646
                <property name="deploy.ant.enabled" value="true"/>
 
647
            </target>
 
648
            
 
649
            <target name="run-undeploy">
 
650
                <xsl:attribute name="depends">dist,-run-undeploy-nb,-init-deploy-ant,-undeploy-ant</xsl:attribute>
 
651
            </target>
 
652
            
 
653
            <target name="-run-undeploy-nb" if="netbeans.home">
 
654
                <fail message="Undeploy is not supported from within the IDE"/>
 
655
            </target>
 
656
 
 
657
            <target name="verify">
 
658
                <xsl:attribute name="depends">init,dist</xsl:attribute>
 
659
                <nbverify file="${{dist.archive}}"/>
 
660
            </target>
 
661
 
 
662
 
 
663
 
 
664
    <xsl:comment>
 
665
 
 
666
    ======================
 
667
    CLEANUP SECTION
 
668
    ======================
 
669
    </xsl:comment>
 
670
 
 
671
            <xsl:call-template name="deps.target">
 
672
                <xsl:with-param name="targetname" select="'deps-clean'"/>
 
673
            </xsl:call-template>
 
674
 
 
675
            <target name="do-clean">
 
676
                <xsl:attribute name="depends">init</xsl:attribute>
 
677
 
 
678
                <condition value="${{build.web.dir.real}}" property="build.dir.to.clean">
 
679
                    <isset property="dist.ear.dir"/>
 
680
                </condition>
 
681
                <property value="${{build.web.dir.real}}" name="build.dir.to.clean"/>
 
682
 
 
683
                <delete includeEmptyDirs="true" quiet="true">
 
684
                    <fileset dir="${{build.dir.to.clean}}/WEB-INF/lib"/>
 
685
                </delete>
 
686
                <delete includeEmptyDirs="true">
 
687
                    <fileset dir=".">
 
688
                        <include name="${{build.dir}}/**"/>
 
689
                        <exclude name="${{build.dir.to.clean}}/WEB-INF/lib/**"/>
 
690
                    </fileset>
 
691
                </delete>
 
692
                <available file="${{build.dir.to.clean}}/WEB-INF/lib" type="dir" property="status.clean-failed"/>
 
693
                <delete dir="${{dist.dir}}"/>
 
694
                <!-- XXX explicitly delete all build.* and dist.* dirs in case they are not subdirs -->
 
695
                <!--
 
696
                <delete dir="${{build.generated.dir}}"/>
 
697
                <delete dir="${{build.web.dir.real}}"/>
 
698
                -->
 
699
            </target>
 
700
 
 
701
            <target name="check-clean">
 
702
                <xsl:attribute name="depends">do-clean</xsl:attribute>
 
703
                <xsl:attribute name="if">status.clean-failed</xsl:attribute>
 
704
                <!--
 
705
                    When undeploy is implemented it should be optional:
 
706
                <xsl:attribute name="unless">clean.check.skip</xsl:attribute>
 
707
                -->
 
708
                <echo message="Warning: unable to delete some files in ${{build.web.dir.real}}/WEB-INF/lib - they are probably locked by the J2EE server. " />
 
709
                <echo level="info" message="To delete all files undeploy the module from Server Registry in Runtime tab and then use Clean again."/>
 
710
                <!--
 
711
                    Here comes the undeploy code when supported by nbdeploy task:
 
712
                <nbdeploy undeploy="true" clientUrlPart="${client.urlPart}"/>
 
713
                    And then another attempt to delete:
 
714
                <delete dir="${{build.web.dir.real}}/WEB-INF/lib"/>
 
715
                -->
 
716
            </target>
 
717
 
 
718
            <target name="-post-clean">
 
719
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
 
720
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
 
721
            </target>
 
722
 
 
723
            <target name="clean">
 
724
                <xsl:attribute name="depends">init,deps-clean,do-clean,check-clean,-post-clean</xsl:attribute>
 
725
                <xsl:attribute name="description">Clean build products.</xsl:attribute>
 
726
            </target>
 
727
 
 
728
            <target name="clean-ear">
 
729
                <xsl:attribute name="depends">clean</xsl:attribute>
 
730
                <xsl:attribute name="description">Clean build products.</xsl:attribute>
 
731
            </target>
 
732
 
 
733
        </project>
 
734
 
 
735
<!-- TBD items:
 
736
 
 
737
Could pass <propertyset> to run, debug, etc. under Ant 1.6,
 
738
optionally, by doing e.g.
 
739
 
 
740
  <propertyset>
 
741
    <propertyref prefix="sysprop."/>
 
742
    <mapper type="glob" from="sysprop.*" to="*"/>
 
743
  </propertyset>
 
744
 
 
745
Now user can add to e.g. project.properties e.g.:
 
746
  sysprop.org.netbeans.modules.javahelp=0
 
747
to simulate
 
748
  -Dorg.netbeans.modules.javahelp=0
 
749
 
 
750
-->
 
751
 
 
752
    </xsl:template>
 
753
 
 
754
    <!---
 
755
    Generic template to build subdependencies of a certain type.
 
756
    Feel free to copy into other modules.
 
757
    @param targetname required name of target to generate
 
758
    @param type artifact-type from project.xml to filter on; optional, if not specified, uses
 
759
                all references, and looks for clean targets rather than build targets
 
760
    @return an Ant target which builds (or cleans) all known subprojects
 
761
    -->
 
762
    <xsl:template name="deps.target">
 
763
        <xsl:param name="targetname"/>
 
764
        <xsl:param name="type"/>
 
765
        <xsl:param name="ear"/>
 
766
        <target name="{$targetname}">
 
767
            <xsl:attribute name="depends">init</xsl:attribute>
 
768
 
 
769
            <xsl:choose>
 
770
                <xsl:when test="$ear">
 
771
                    <xsl:attribute name="if">dist.ear.dir</xsl:attribute>
 
772
                    <xsl:attribute name="unless">no.deps</xsl:attribute>
 
773
                </xsl:when>
 
774
                <xsl:otherwise>
 
775
                    <xsl:attribute name="if">no.dist.ear.dir</xsl:attribute>
 
776
                    <xsl:attribute name="unless">no.deps</xsl:attribute>
 
777
                </xsl:otherwise>
 
778
            </xsl:choose>
 
779
 
 
780
            <xsl:variable name="references" select="/p:project/p:configuration/projdeps:references"/>
 
781
            <xsl:for-each select="$references/projdeps:reference[not($type) or projdeps:artifact-type = $type]">
 
782
                <xsl:variable name="subproj" select="projdeps:foreign-project"/>
 
783
                <xsl:variable name="subtarget">
 
784
                    <xsl:choose>
 
785
                        <xsl:when test="$type">
 
786
                            <xsl:value-of select="projdeps:target"/>
 
787
                        </xsl:when>
 
788
                        <xsl:otherwise>
 
789
                            <xsl:value-of select="projdeps:clean-target"/>
 
790
                        </xsl:otherwise>
 
791
                    </xsl:choose>
 
792
                </xsl:variable>
 
793
                <xsl:variable name="script" select="projdeps:script"/>
 
794
                <!-- Distinguish build of a dependent project as standalone module or as a part of an ear -->
 
795
                <xsl:choose>
 
796
                    <xsl:when test="$ear">
 
797
                        <xsl:choose>
 
798
                            <!-- call standart target if the artifact type is jar (java libraries) -->
 
799
                            <xsl:when test="$subtarget = 'jar'">
 
800
                                <ant target="{$subtarget}" inheritall="false" antfile="${{project.{$subproj}}}/{$script}"/>
 
801
                            </xsl:when>
 
802
                            <xsl:otherwise>
 
803
                                <ant target="dist-ear" inheritall="false" antfile="${{project.{$subproj}}}/{$script}">
 
804
                                    <property name="dist.ear.dir" location="${{build.dir}}"/>
 
805
                                </ant>
 
806
                            </xsl:otherwise>
 
807
                        </xsl:choose>
 
808
                    </xsl:when>
 
809
                    <xsl:otherwise>
 
810
                        <ant target="{$subtarget}" inheritall="false" antfile="${{project.{$subproj}}}/{$script}"/>
 
811
                    </xsl:otherwise>
 
812
                </xsl:choose>
 
813
 
 
814
            </xsl:for-each>
 
815
        </target>
 
816
    </xsl:template>
 
817
 
 
818
    <xsl:template name="createRootAvailableTest">
 
819
        <xsl:param name="roots"/>
 
820
        <xsl:param name="propName"/>
 
821
        <xsl:element name="condition">
 
822
            <xsl:attribute name="property"><xsl:value-of select="$propName"/></xsl:attribute>
 
823
            <or>
 
824
                <xsl:for-each select="$roots/archiveproject:root">
 
825
                    <xsl:element name="available">
 
826
                                <xsl:attribute name="file"><xsl:text>${</xsl:text><xsl:value-of select="@id"/><xsl:text>}</xsl:text></xsl:attribute>
 
827
                            </xsl:element>
 
828
                </xsl:for-each>
 
829
            </or>
 
830
        </xsl:element>
 
831
    </xsl:template>
 
832
 
 
833
    <xsl:template name="createSourcePathValidityTest">
 
834
        <xsl:param name="roots"/>
 
835
        <xsl:for-each select="$roots/archiveproject:root">
 
836
            <xsl:element name="fail">
 
837
                            <xsl:attribute name="unless"><xsl:value-of select="@id"/></xsl:attribute>
 
838
                <xsl:text>Must set </xsl:text><xsl:value-of select="@id"/>
 
839
                    </xsl:element>
 
840
        </xsl:for-each>
 
841
    </xsl:template>
 
842
 
 
843
    <xsl:template name="createFilesets">
 
844
                <xsl:param name="roots"/>
 
845
        <xsl:param name="includes"/>
 
846
        <xsl:param name="excludes"/>
 
847
        <xsl:for-each select="$roots/archiveproject:root">
 
848
            <xsl:element name="fileset">
 
849
                            <xsl:attribute name="dir"><xsl:text>${</xsl:text><xsl:value-of select="@id"/><xsl:text>}</xsl:text></xsl:attribute>
 
850
                <xsl:if test="$includes">
 
851
                    <xsl:attribute name="includes"><xsl:value-of select="$includes"/></xsl:attribute>
 
852
                </xsl:if>
 
853
                <xsl:if test="$excludes">
 
854
                                <xsl:attribute name="excludes"><xsl:value-of select="$excludes"/></xsl:attribute>
 
855
                </xsl:if>
 
856
                    </xsl:element>
 
857
        </xsl:for-each>
 
858
    </xsl:template>
 
859
        
 
860
    <xsl:template name="createPackagesets">
 
861
        <xsl:param name="roots"/>
 
862
        <xsl:param name="includes"/>
 
863
        <xsl:param name="excludes"/>
 
864
        <xsl:for-each select="$roots/archiveproject:root">
 
865
            <xsl:element name="packageset">
 
866
                <xsl:attribute name="dir"><xsl:text>${</xsl:text><xsl:value-of select="@id"/><xsl:text>}</xsl:text></xsl:attribute>
 
867
                <xsl:if test="$includes">
 
868
                    <xsl:attribute name="includes"><xsl:value-of select="$includes"/></xsl:attribute>
 
869
                </xsl:if>
 
870
                <xsl:if test="$excludes">
 
871
                    <xsl:attribute name="excludes"><xsl:value-of select="$excludes"/></xsl:attribute>
 
872
                </xsl:if>
 
873
            </xsl:element>
 
874
        </xsl:for-each>
 
875
    </xsl:template>        
 
876
 
 
877
    <xsl:template name="createPathElements">
 
878
        <xsl:param name="locations"/>
 
879
        <xsl:for-each select="$locations/archiveproject:root">
 
880
            <xsl:element name="pathelement">
 
881
                            <xsl:attribute name="location"><xsl:text>${</xsl:text><xsl:value-of select="@id"/><xsl:text>}</xsl:text></xsl:attribute>
 
882
                    </xsl:element>
 
883
        </xsl:for-each>
 
884
    </xsl:template>
 
885
 
 
886
        <xsl:template name="createPath">
 
887
                <xsl:param name="roots"/>
 
888
                <xsl:for-each select="$roots/archiveproject:root">
 
889
                    <xsl:if test="position() != 1">
 
890
                            <xsl:text>:</xsl:text>
 
891
                    </xsl:if>
 
892
                    <xsl:text>${</xsl:text>
 
893
                    <xsl:value-of select="@id"/>
 
894
                    <xsl:text>}</xsl:text>
 
895
                </xsl:for-each>
 
896
        </xsl:template>
 
897
 
 
898
        <xsl:template name="manifestBasenameIterateFiles" >
 
899
            <xsl:param name="property"/>
 
900
            <xsl:param name="files" /><!-- number of files in the libfile property -->
 
901
            <xsl:param name="libfile"/>
 
902
            <xsl:if test="$files &gt; 0">
 
903
                <xsl:variable name="fileNo" select="$files+(-1)"/>
 
904
                <xsl:variable name="lib" select="concat(substring-before($libfile,'}'),'.libfile.',$files,'}')"/>
 
905
                <xsl:variable name="propertyName" select="concat($property, '.', $fileNo+1)"/>
 
906
                <basename property="{$propertyName}" file="{$lib}"/>
 
907
                <xsl:call-template name="manifestBasenameIterateFiles">
 
908
                    <xsl:with-param name="files" select="$fileNo"/>
 
909
                    <xsl:with-param name="libfile" select="$libfile"/>
 
910
                    <xsl:with-param name="property" select="$property"/>
 
911
                </xsl:call-template>
 
912
            </xsl:if>
 
913
        </xsl:template>
 
914
 
 
915
        <xsl:template name="manifestPrintEntriesIterateFiles" >
 
916
            <xsl:param name="property"/>
 
917
            <xsl:param name="files" /><!-- number of files in the libfile property -->
 
918
            <xsl:param name="libfile"/>
 
919
            <xsl:if test="$files &gt; 0">
 
920
                <xsl:call-template name="manifestPrintEntriesIterateFilesIncreasingOrder">
 
921
                    <xsl:with-param name="files" select="$files"/>
 
922
                    <xsl:with-param name="libfile" select="$libfile"/>
 
923
                    <xsl:with-param name="index" select="1"/>
 
924
                    <xsl:with-param name="property" select="$property"/>
 
925
                </xsl:call-template>
 
926
            </xsl:if>
 
927
        </xsl:template>
 
928
 
 
929
        <xsl:template name="manifestPrintEntriesIterateFilesIncreasingOrder" >
 
930
            <xsl:param name="property"/>
 
931
            <xsl:param name="files" /><!-- number of files in the libfile property -->
 
932
            <xsl:param name="index" /><!-- index of file in libfile property -->
 
933
            <xsl:param name="libfile"/>
 
934
            <xsl:if test="$files &gt; 0">
 
935
                <xsl:variable name="propertyName" select="concat($property, '.', $index)"/>
 
936
                <xsl:text>${</xsl:text><xsl:value-of select="$propertyName"/><xsl:text>.X} </xsl:text>
 
937
                <xsl:call-template name="manifestPrintEntriesIterateFilesIncreasingOrder">
 
938
                    <xsl:with-param name="files" select="$files+(-1)"/>
 
939
                    <xsl:with-param name="index" select="$index+1"/>
 
940
                    <xsl:with-param name="libfile" select="$libfile"/>
 
941
                    <xsl:with-param name="property" select="$property"/>
 
942
                </xsl:call-template>
 
943
            </xsl:if>
 
944
        </xsl:template>
 
945
 
 
946
        <xsl:template name="copyIterateFiles" >
 
947
            <xsl:param name="files" />
 
948
            <xsl:param name="target"/>
 
949
            <xsl:param name="libfile"/>
 
950
            <xsl:param name="ear"/>
 
951
            <xsl:param name="property"/>
 
952
            <xsl:if test="$files &gt; 0">
 
953
                <xsl:variable name="fileNo" select="$files+(-1)"/>
 
954
                <xsl:variable name="lib" select="concat(substring-before($libfile,'}'),'.libfile.',$files,'}')"/>
 
955
                
 
956
                <xsl:variable name="propertyName" select="concat($property, '.', $files, '.X')"/>
 
957
                <xsl:if test="$ear='true'">
 
958
                    <copy-ear-war file="{$lib}" propname="{$propertyName}"/>
 
959
                </xsl:if>
 
960
                
 
961
                <xsl:if test="$ear!='true'">
 
962
                    <copy file="{$lib}" todir="{$target}"/>
 
963
                </xsl:if>
 
964
                
 
965
                <xsl:call-template name="copyIterateFiles">
 
966
                    <xsl:with-param name="files" select="$fileNo"/>
 
967
                    <xsl:with-param name="target" select="$target"/>
 
968
                    <xsl:with-param name="libfile" select="$libfile"/>
 
969
                    <xsl:with-param name="ear" select="$ear"/>
 
970
                    <xsl:with-param name="property" select="$property"/>
 
971
                </xsl:call-template>
 
972
            </xsl:if>
 
973
        </xsl:template>
 
974
 
 
975
        <xsl:template name="copyIterateDirs" >
 
976
            <xsl:param name="files" />
 
977
            <xsl:param name="target"/>
 
978
            <xsl:param name="libfile"/>
 
979
            <xsl:if test="$files &gt; 0">
 
980
                <xsl:variable name="fileNo" select="$files+(-1)"/>
 
981
                <xsl:variable name="lib" select="concat(substring-before($libfile,'}'),'.libdir.',$files,'}')"/>
 
982
                <copy todir="{$target}">
 
983
                    <fileset dir="{$lib}" includes="**/*"/>
 
984
                </copy>
 
985
                <xsl:call-template name="copyIterateDirs">
 
986
                    <xsl:with-param name="files" select="$fileNo"/>
 
987
                    <xsl:with-param name="target" select="$target"/>
 
988
                    <xsl:with-param name="libfile" select="$libfile"/>
 
989
                </xsl:call-template>
 
990
            </xsl:if>
 
991
        </xsl:template>
 
992
</xsl:stylesheet>