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

« back to all changes in this revision

Viewing changes to java/j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.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-2007 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
<xsl:stylesheet version="1.0"
 
44
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 
45
                xmlns:p="http://www.netbeans.org/ns/project/1"
 
46
                xmlns:xalan="http://xml.apache.org/xslt"
 
47
                xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1"
 
48
                xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2"
 
49
                xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3"
 
50
                xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc"
 
51
                xmlns:projdeps="http://www.netbeans.org/ns/ant-project-references/1"
 
52
                xmlns:projdeps2="http://www.netbeans.org/ns/ant-project-references/2"
 
53
                exclude-result-prefixes="xalan p projdeps projdeps2">
 
54
    <!-- XXX should use namespaces for NB in-VM tasks from ant/browsetask and debuggerjpda/ant (Ant 1.6.1 and higher only) -->
 
55
    <xsl:output method="xml" indent="yes" encoding="UTF-8" xalan:indent-amount="4"/>
 
56
    <xsl:template match="/">
 
57
        
 
58
        <xsl:comment><![CDATA[
 
59
*** GENERATED FROM project.xml - DO NOT EDIT  ***
 
60
***         EDIT ../build.xml INSTEAD         ***
 
61
 
 
62
For the purpose of easier reading the script
 
63
is divided into following sections:
 
64
 
 
65
  - initialization
 
66
  - compilation
 
67
  - jar
 
68
  - execution
 
69
  - debugging
 
70
  - javadoc
 
71
  - junit compilation
 
72
  - junit execution
 
73
  - junit debugging
 
74
  - applet
 
75
  - cleanup
 
76
 
 
77
        ]]></xsl:comment>
 
78
        
 
79
        <xsl:variable name="name" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:name"/>
 
80
        <!-- Synch with build-impl.xsl: -->
 
81
        <xsl:variable name="codename" select="translate($name, ' ', '_')"/>
 
82
        <project name="{$codename}-impl">
 
83
            <xsl:attribute name="default">default</xsl:attribute>
 
84
            <xsl:attribute name="basedir">..</xsl:attribute>
 
85
            
 
86
            <target name="default">
 
87
                <xsl:attribute name="depends">test,jar,javadoc</xsl:attribute>
 
88
                <xsl:attribute name="description">Build and test whole project.</xsl:attribute>
 
89
            </target>
 
90
            
 
91
            <xsl:comment> 
 
92
                ======================
 
93
                INITIALIZATION SECTION 
 
94
                ======================
 
95
            </xsl:comment>
 
96
            
 
97
            <target name="-pre-init">
 
98
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
 
99
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
 
100
            </target>
 
101
            
 
102
            <target name="-init-private">
 
103
                <xsl:attribute name="depends">-pre-init</xsl:attribute>
 
104
                <property file="nbproject/private/config.properties"/>
 
105
                <property file="nbproject/private/configs/${{config}}.properties"/>
 
106
                <property file="nbproject/private/private.properties"/>
 
107
            </target>
 
108
            
 
109
            <target name="-init-user">
 
110
                <xsl:attribute name="depends">-pre-init,-init-private</xsl:attribute>
 
111
                <property file="${{user.properties.file}}"/>
 
112
                <xsl:comment> The two properties below are usually overridden </xsl:comment>
 
113
                <xsl:comment> by the active platform. Just a fallback. </xsl:comment>
 
114
                <property name="default.javac.source" value="1.4"/>
 
115
                <property name="default.javac.target" value="1.4"/>
 
116
            </target>
 
117
            
 
118
            <target name="-init-project">
 
119
                <xsl:attribute name="depends">-pre-init,-init-private,-init-user</xsl:attribute>
 
120
                <property file="nbproject/configs/${{config}}.properties"/>
 
121
                <property file="nbproject/project.properties"/>
 
122
            </target>
 
123
            
 
124
            <target name="-do-init">
 
125
                <xsl:attribute name="depends">-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property</xsl:attribute>
 
126
                <xsl:if test="/p:project/p:configuration/j2seproject3:data/j2seproject3:explicit-platform">
 
127
                    <j2seproject1:property name="platform.home" value="platforms.${{platform.active}}.home"/>
 
128
                    <j2seproject1:property name="platform.bootcp" value="platforms.${{platform.active}}.bootclasspath"/>
 
129
                    <j2seproject1:property name="platform.compiler" value="platforms.${{platform.active}}.compile"/>
 
130
                    <j2seproject1: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
                    <j2seproject1: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
                    <j2seproject1:property name="platform.javadoc.tmp" value="platforms.${{platform.active}}.javadoc"/>
 
141
                    <condition property="platform.javadoc" value="${{platform.home}}/bin/javadoc">
 
142
                        <equals arg1="${{platform.javadoc.tmp}}" arg2="$${{platforms.${{platform.active}}.javadoc}}"/>
 
143
                    </condition>
 
144
                    <property name="platform.javadoc" value="${{platform.javadoc.tmp}}"/>
 
145
                    <condition property="platform.invalid" value="true">
 
146
                        <or>
 
147
                            <contains string="${{platform.javac}}" substring="$${{platforms."/>
 
148
                            <contains string="${{platform.java}}" substring="$${{platforms."/>
 
149
                            <contains string="${{platform.javadoc}}" substring="$${{platforms."/>
 
150
                        </or>
 
151
                    </condition>
 
152
                    <fail unless="platform.home">Must set platform.home</fail>
 
153
                    <fail unless="platform.bootcp">Must set platform.bootcp</fail>
 
154
                    <fail unless="platform.java">Must set platform.java</fail>
 
155
                    <fail unless="platform.javac">Must set platform.javac</fail>
 
156
                    <fail if="platform.invalid">Platform is not correctly set up</fail>
 
157
                </xsl:if>
 
158
                <available file="${{manifest.file}}" property="manifest.available"/>
 
159
                <condition property="manifest.available+main.class">
 
160
                    <and>
 
161
                        <isset property="manifest.available"/>
 
162
                        <isset property="main.class"/>
 
163
                        <not>
 
164
                            <equals arg1="${{main.class}}" arg2="" trim="true"/>
 
165
                        </not>
 
166
                    </and>
 
167
                </condition>
 
168
                <condition property="manifest.available+main.class+mkdist.available">
 
169
                    <and>
 
170
                        <istrue value="${{manifest.available+main.class}}"/>
 
171
                        <isset property="libs.CopyLibs.classpath"/>
 
172
                    </and>
 
173
                </condition>
 
174
                <xsl:call-template name="createRootAvailableTest">
 
175
                    <xsl:with-param name="roots" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:test-roots"/>
 
176
                    <xsl:with-param name="propName">have.tests</xsl:with-param>
 
177
                </xsl:call-template>
 
178
                <xsl:call-template name="createRootAvailableTest">
 
179
                    <xsl:with-param name="roots" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:source-roots"/>
 
180
                    <xsl:with-param name="propName">have.sources</xsl:with-param>
 
181
                </xsl:call-template>
 
182
                <condition property="netbeans.home+have.tests">
 
183
                    <and>
 
184
                        <isset property="netbeans.home"/>
 
185
                        <isset property="have.tests"/>
 
186
                    </and>
 
187
                </condition>
 
188
                <condition property="no.javadoc.preview">
 
189
                    <and>
 
190
                        <isset property="javadoc.preview"/>
 
191
                        <isfalse value="${{javadoc.preview}}"/>
 
192
                    </and>
 
193
                </condition>
 
194
                <property name="run.jvmargs" value=""/>
 
195
                <property name="javac.compilerargs" value=""/>
 
196
                <property name="work.dir" value="${{basedir}}"/>
 
197
                <condition property="no.deps">
 
198
                    <and>
 
199
                        <istrue value="${{no.dependencies}}"/>
 
200
                    </and>
 
201
                </condition>
 
202
                <property name="javac.debug" value="true"/>
 
203
                <property name="javadoc.preview" value="true"/>
 
204
                <property name="application.args" value=""/>
 
205
                <property name="source.encoding" value="${{file.encoding}}"/>
 
206
                <condition property="javadoc.encoding.used" value="${{javadoc.encoding}}">
 
207
                    <and>
 
208
                        <isset property="javadoc.encoding"/>
 
209
                        <not>
 
210
                            <equals arg1="${{javadoc.encoding}}" arg2=""/>
 
211
                        </not>
 
212
                    </and>
 
213
                </condition> 
 
214
                <property name="javadoc.encoding.used" value="${{source.encoding}}"/>
 
215
                <property name="includes" value="**"/>
 
216
                <property name="excludes" value=""/>
 
217
                <property name="do.depend" value="false"/>
 
218
                <condition property="do.depend.true">
 
219
                    <istrue value="${{do.depend}}"/>
 
220
                </condition>
 
221
                <condition property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${{jaxws.endorsed.dir}}'" else="">
 
222
                    <and>
 
223
                        <isset property="jaxws.endorsed.dir"/>
 
224
                        <available file="nbproject/jaxws-build.xml"/>
 
225
                    </and>
 
226
                </condition>
 
227
            </target>
 
228
            
 
229
            <target name="-post-init">
 
230
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
 
231
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
 
232
            </target>
 
233
            
 
234
            <target name="-init-check">
 
235
                <xsl:attribute name="depends">-pre-init,-init-private,-init-user,-init-project,-do-init</xsl:attribute>
 
236
                <!-- XXX XSLT 2.0 would make it possible to use a for-each here -->
 
237
                <!-- Note that if the properties were defined in project.xml that would be easy -->
 
238
                <!-- But required props should be defined by the AntBasedProjectType, not stored in each project -->
 
239
                <xsl:call-template name="createSourcePathValidityTest">
 
240
                    <xsl:with-param name="roots" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:source-roots"/>
 
241
                </xsl:call-template>
 
242
                <xsl:call-template name="createSourcePathValidityTest">
 
243
                    <xsl:with-param name="roots" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:test-roots"/>
 
244
                </xsl:call-template>
 
245
                <fail unless="build.dir">Must set build.dir</fail>
 
246
                <fail unless="dist.dir">Must set dist.dir</fail>
 
247
                <fail unless="build.classes.dir">Must set build.classes.dir</fail>
 
248
                <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
 
249
                <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
 
250
                <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
 
251
                <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
 
252
                <fail unless="dist.jar">Must set dist.jar</fail>
 
253
            </target>
 
254
            
 
255
            <target name="-init-macrodef-property">
 
256
                <macrodef>
 
257
                    <xsl:attribute name="name">property</xsl:attribute>
 
258
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/1</xsl:attribute>
 
259
                    <attribute>
 
260
                        <xsl:attribute name="name">name</xsl:attribute>
 
261
                    </attribute>
 
262
                    <attribute>
 
263
                        <xsl:attribute name="name">value</xsl:attribute>
 
264
                    </attribute>
 
265
                    <sequential>
 
266
                        <property name="@{{name}}" value="${{@{{value}}}}"/>
 
267
                    </sequential>
 
268
                </macrodef>
 
269
            </target>
 
270
            
 
271
            <target name="-init-macrodef-javac">
 
272
                <macrodef>
 
273
                    <xsl:attribute name="name">javac</xsl:attribute>
 
274
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
 
275
                    <attribute>
 
276
                        <xsl:attribute name="name">srcdir</xsl:attribute>
 
277
                        <xsl:attribute name="default">
 
278
                            <xsl:call-template name="createPath">
 
279
                                <xsl:with-param name="roots" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:source-roots"/>
 
280
                            </xsl:call-template>
 
281
                        </xsl:attribute>
 
282
                    </attribute>
 
283
                    <attribute>
 
284
                        <xsl:attribute name="name">destdir</xsl:attribute>
 
285
                        <xsl:attribute name="default">${build.classes.dir}</xsl:attribute>
 
286
                    </attribute>
 
287
                    <attribute>
 
288
                        <xsl:attribute name="name">classpath</xsl:attribute>
 
289
                        <xsl:attribute name="default">${javac.classpath}</xsl:attribute>
 
290
                    </attribute>
 
291
                    <attribute>
 
292
                        <xsl:attribute name="name">includes</xsl:attribute>
 
293
                        <xsl:attribute name="default">${includes}</xsl:attribute>
 
294
                    </attribute>
 
295
                    <attribute>
 
296
                        <xsl:attribute name="name">excludes</xsl:attribute>
 
297
                        <xsl:attribute name="default">${excludes}</xsl:attribute>
 
298
                    </attribute>
 
299
                    <attribute>
 
300
                        <xsl:attribute name="name">debug</xsl:attribute>
 
301
                        <xsl:attribute name="default">${javac.debug}</xsl:attribute>
 
302
                    </attribute>
 
303
                    <attribute>
 
304
                        <xsl:attribute name="name">sourcepath</xsl:attribute>
 
305
                        <xsl:attribute name="default"/>
 
306
                    </attribute>
 
307
                    <element>
 
308
                        <xsl:attribute name="name">customize</xsl:attribute>
 
309
                        <xsl:attribute name="optional">true</xsl:attribute>
 
310
                    </element>
 
311
                    <sequential>
 
312
                        <javac>
 
313
                            <xsl:attribute name="srcdir">@{srcdir}</xsl:attribute>
 
314
                            <xsl:attribute name="sourcepath">@{sourcepath}</xsl:attribute>
 
315
                            <xsl:attribute name="destdir">@{destdir}</xsl:attribute>
 
316
                            <xsl:attribute name="debug">@{debug}</xsl:attribute>
 
317
                            <xsl:attribute name="deprecation">${javac.deprecation}</xsl:attribute>
 
318
                            <xsl:attribute name="encoding">${source.encoding}</xsl:attribute>
 
319
                            <xsl:if test ="not(/p:project/p:configuration/j2seproject3:data/j2seproject3:explicit-platform/@explicit-source-supported ='false')">                            
 
320
                                <xsl:attribute name="source">${javac.source}</xsl:attribute>
 
321
                                <xsl:attribute name="target">${javac.target}</xsl:attribute>
 
322
                            </xsl:if>                            
 
323
                            <xsl:attribute name="includes">@{includes}</xsl:attribute>
 
324
                            <xsl:attribute name="excludes">@{excludes}</xsl:attribute>
 
325
                            <xsl:if test="/p:project/p:configuration/j2seproject3:data/j2seproject3:explicit-platform">
 
326
                                <xsl:attribute name="fork">yes</xsl:attribute>
 
327
                                <xsl:attribute name="executable">${platform.javac}</xsl:attribute>
 
328
                                <xsl:attribute name="tempdir">${java.io.tmpdir}</xsl:attribute> <!-- XXX cf. #51482, Ant #29391 -->
 
329
                            </xsl:if>
 
330
                            <xsl:attribute name="includeantruntime">false</xsl:attribute>
 
331
                            <classpath>
 
332
                                <path path="@{{classpath}}"/>
 
333
                            </classpath>
 
334
                            <compilerarg line="${{javac.compilerargs}} ${{javac.compilerargs.jaxws}}"/>
 
335
                            <customize/>
 
336
                        </javac>
 
337
                    </sequential>
 
338
                </macrodef>
 
339
                <macrodef> <!-- #36033, #85707 -->
 
340
                    <xsl:attribute name="name">depend</xsl:attribute>
 
341
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
 
342
                    <attribute>
 
343
                        <xsl:attribute name="name">srcdir</xsl:attribute>
 
344
                        <xsl:attribute name="default">
 
345
                            <xsl:call-template name="createPath">
 
346
                                <xsl:with-param name="roots" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:source-roots"/>
 
347
                            </xsl:call-template>
 
348
                        </xsl:attribute>
 
349
                    </attribute>
 
350
                    <attribute>
 
351
                        <xsl:attribute name="name">destdir</xsl:attribute>
 
352
                        <xsl:attribute name="default">${build.classes.dir}</xsl:attribute>
 
353
                    </attribute>
 
354
                    <attribute>
 
355
                        <xsl:attribute name="name">classpath</xsl:attribute>
 
356
                        <xsl:attribute name="default">${javac.classpath}</xsl:attribute>
 
357
                    </attribute>
 
358
                    <sequential>
 
359
                        <depend>
 
360
                            <xsl:attribute name="srcdir">@{srcdir}</xsl:attribute>
 
361
                            <xsl:attribute name="destdir">@{destdir}</xsl:attribute>
 
362
                            <xsl:attribute name="cache">${build.dir}/depcache</xsl:attribute>
 
363
                            <xsl:attribute name="includes">${includes}</xsl:attribute>
 
364
                            <xsl:attribute name="excludes">${excludes}</xsl:attribute>
 
365
                            <classpath>
 
366
                                <path path="@{{classpath}}"/>
 
367
                            </classpath>
 
368
                        </depend>
 
369
                    </sequential>
 
370
                </macrodef>
 
371
                <macrodef> <!-- #85707 -->
 
372
                    <xsl:attribute name="name">force-recompile</xsl:attribute>
 
373
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
 
374
                    <attribute>
 
375
                        <xsl:attribute name="name">destdir</xsl:attribute>
 
376
                        <xsl:attribute name="default">${build.classes.dir}</xsl:attribute>
 
377
                    </attribute>
 
378
                    <sequential>
 
379
                        <fail unless="javac.includes">Must set javac.includes</fail>
 
380
                        <!-- XXX one little flaw in this weird trick: does not work on folders. -->
 
381
                        <pathconvert>
 
382
                            <xsl:attribute name="property">javac.includes.binary</xsl:attribute>
 
383
                            <xsl:attribute name="pathsep">,</xsl:attribute>
 
384
                            <path>
 
385
                                <filelist>
 
386
                                    <xsl:attribute name="dir">@{destdir}</xsl:attribute>
 
387
                                    <xsl:attribute name="files">${javac.includes}</xsl:attribute>
 
388
                                </filelist>
 
389
                            </path>
 
390
                            <globmapper>
 
391
                                <xsl:attribute name="from">*.java</xsl:attribute>
 
392
                                <xsl:attribute name="to">*.class</xsl:attribute>
 
393
                            </globmapper>
 
394
                        </pathconvert>
 
395
                        <delete>
 
396
                            <files includes="${{javac.includes.binary}}"/>
 
397
                        </delete>
 
398
                    </sequential>
 
399
                </macrodef>
 
400
            </target>
 
401
            
 
402
            <target name="-init-macrodef-junit">
 
403
                <macrodef>
 
404
                    <xsl:attribute name="name">junit</xsl:attribute>
 
405
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
 
406
                    <attribute>
 
407
                        <xsl:attribute name="name">includes</xsl:attribute>
 
408
                        <xsl:attribute name="default">${includes}</xsl:attribute>
 
409
                    </attribute>
 
410
                    <attribute>
 
411
                        <xsl:attribute name="name">excludes</xsl:attribute>
 
412
                        <xsl:attribute name="default">${excludes}</xsl:attribute>
 
413
                    </attribute>
 
414
                    <attribute>
 
415
                        <xsl:attribute name="name">testincludes</xsl:attribute>
 
416
                        <xsl:attribute name="default">**</xsl:attribute>
 
417
                    </attribute>
 
418
                    <sequential>
 
419
                        <junit>
 
420
                            <xsl:attribute name="showoutput">true</xsl:attribute>
 
421
                            <xsl:attribute name="fork">true</xsl:attribute>
 
422
                            <xsl:attribute name="dir">${work.dir}</xsl:attribute> <!-- #47474: match <java> --> 
 
423
                            <xsl:attribute name="failureproperty">tests.failed</xsl:attribute>
 
424
                            <xsl:attribute name="errorproperty">tests.failed</xsl:attribute>
 
425
                            <xsl:if test="/p:project/p:configuration/j2seproject3:data/j2seproject3:explicit-platform">
 
426
                                <xsl:attribute name="jvm">${platform.java}</xsl:attribute>
 
427
                            </xsl:if>
 
428
                            <batchtest todir="${{build.test.results.dir}}">
 
429
                                <xsl:call-template name="createFilesets">
 
430
                                    <xsl:with-param name="roots" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:test-roots"/>
 
431
                                    <xsl:with-param name="includes">@{includes}</xsl:with-param>
 
432
                                    <xsl:with-param name="includes2">@{testincludes}</xsl:with-param>
 
433
                                    <xsl:with-param name="excludes">@{excludes}</xsl:with-param>
 
434
                                </xsl:call-template>
 
435
                            </batchtest>
 
436
                            <classpath>
 
437
                                <path path="${{run.test.classpath}}"/>
 
438
                            </classpath>
 
439
                            <syspropertyset>
 
440
                                <propertyref prefix="test-sys-prop."/>
 
441
                                <mapper type="glob" from="test-sys-prop.*" to="*"/>
 
442
                            </syspropertyset>
 
443
                            <formatter type="brief" usefile="false"/>
 
444
                            <formatter type="xml"/>
 
445
                            <jvmarg line="${{run.jvmargs}}"/>
 
446
                        </junit>
 
447
                    </sequential>
 
448
                </macrodef>
 
449
            </target>
 
450
            
 
451
            <target name="-init-macrodef-nbjpda">
 
452
                <macrodef>
 
453
                    <xsl:attribute name="name">nbjpdastart</xsl:attribute>
 
454
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/1</xsl:attribute>
 
455
                    <attribute>
 
456
                        <xsl:attribute name="name">name</xsl:attribute>
 
457
                        <xsl:attribute name="default">${main.class}</xsl:attribute>
 
458
                    </attribute>
 
459
                    <attribute>
 
460
                        <xsl:attribute name="name">classpath</xsl:attribute>
 
461
                        <xsl:attribute name="default">${debug.classpath}</xsl:attribute>
 
462
                    </attribute>
 
463
                    <attribute>
 
464
                        <xsl:attribute name="name">stopclassname</xsl:attribute>
 
465
                        <xsl:attribute name="default"></xsl:attribute>
 
466
                    </attribute>
 
467
                    <sequential>
 
468
                        <nbjpdastart transport="dt_socket" addressproperty="jpda.address" name="@{{name}}" stopclassname="@{{stopclassname}}">
 
469
                            <classpath>
 
470
                                <path path="@{{classpath}}"/>
 
471
                            </classpath>
 
472
                            <xsl:if test="/p:project/p:configuration/j2seproject3:data/j2seproject3:explicit-platform">
 
473
                                <bootclasspath>
 
474
                                    <path path="${{platform.bootcp}}"/>
 
475
                                </bootclasspath>
 
476
                            </xsl:if>
 
477
                        </nbjpdastart>
 
478
                    </sequential>
 
479
                </macrodef>
 
480
                <macrodef>
 
481
                    <xsl:attribute name="name">nbjpdareload</xsl:attribute>
 
482
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/1</xsl:attribute>
 
483
                    <attribute>
 
484
                        <xsl:attribute name="name">dir</xsl:attribute>
 
485
                        <xsl:attribute name="default">${build.classes.dir}</xsl:attribute>
 
486
                    </attribute>
 
487
                    <sequential>
 
488
                        <nbjpdareload>
 
489
                            <fileset includes="${{fix.includes}}*.class" dir="@{{dir}}"/>
 
490
                        </nbjpdareload>
 
491
                    </sequential>
 
492
                </macrodef>
 
493
            </target>
 
494
            
 
495
            <target name="-init-debug-args">
 
496
                <xsl:choose>
 
497
                    <xsl:when test="/p:project/p:configuration/j2seproject3:data/j2seproject3:explicit-platform">
 
498
                        <exec executable="${{platform.java}}" outputproperty="version-output">
 
499
                            <arg value="-version"/>
 
500
                        </exec>
 
501
                    </xsl:when>
 
502
                    <xsl:otherwise>
 
503
                        <property name="version-output" value="java version &quot;${{ant.java.version}}"/>
 
504
                    </xsl:otherwise>
 
505
                </xsl:choose>
 
506
                <condition property="have-jdk-older-than-1.4">
 
507
                    <!-- <matches pattern="^java version &quot;1\.[0-3]" string="${version-output}"/> (ANT 1.7) -->
 
508
                    <or>
 
509
                        <contains string="${{version-output}}" substring="java version &quot;1.0"/>
 
510
                        <contains string="${{version-output}}" substring="java version &quot;1.1"/>
 
511
                        <contains string="${{version-output}}" substring="java version &quot;1.2"/>
 
512
                        <contains string="${{version-output}}" substring="java version &quot;1.3"/>
 
513
                    </or>
 
514
                </condition>
 
515
                <condition property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none" else="-Xdebug">
 
516
                    <istrue value="${{have-jdk-older-than-1.4}}"/>
 
517
                </condition>
 
518
            </target>
 
519
            
 
520
            <target name="-init-macrodef-debug" depends="-init-debug-args">
 
521
                <macrodef>
 
522
                    <xsl:attribute name="name">debug</xsl:attribute>
 
523
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
 
524
                    <attribute>
 
525
                        <xsl:attribute name="name">classname</xsl:attribute>
 
526
                        <xsl:attribute name="default">${main.class}</xsl:attribute>
 
527
                    </attribute>
 
528
                    <attribute>
 
529
                        <xsl:attribute name="name">classpath</xsl:attribute>
 
530
                        <xsl:attribute name="default">${debug.classpath}</xsl:attribute>
 
531
                    </attribute>
 
532
                    <element>
 
533
                        <xsl:attribute name="name">customize</xsl:attribute>
 
534
                        <xsl:attribute name="optional">true</xsl:attribute>
 
535
                    </element>
 
536
                    <sequential>
 
537
                        <java fork="true" classname="@{{classname}}">
 
538
                            <xsl:attribute name="dir">${work.dir}</xsl:attribute>
 
539
                            <xsl:if test="/p:project/p:configuration/j2seproject3:data/j2seproject3:explicit-platform">
 
540
                                <xsl:attribute name="jvm">${platform.java}</xsl:attribute>
 
541
                            </xsl:if>
 
542
                            <jvmarg line="${{debug-args-line}}"/>
 
543
                            <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${{jpda.address}}"/>
 
544
                            <jvmarg line="${{run.jvmargs}}"/>
 
545
                            <classpath>
 
546
                                <path path="@{{classpath}}"/>
 
547
                            </classpath>
 
548
                            <syspropertyset>
 
549
                                <propertyref prefix="run-sys-prop."/>
 
550
                                <mapper type="glob" from="run-sys-prop.*" to="*"/>
 
551
                            </syspropertyset>
 
552
                            <customize/>
 
553
                        </java>
 
554
                    </sequential>
 
555
                </macrodef>
 
556
            </target>
 
557
            
 
558
            <target name="-init-macrodef-java">
 
559
                <macrodef>
 
560
                    <xsl:attribute name="name">java</xsl:attribute>
 
561
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/1</xsl:attribute>
 
562
                    <attribute>
 
563
                        <xsl:attribute name="name">classname</xsl:attribute>
 
564
                        <xsl:attribute name="default">${main.class}</xsl:attribute>
 
565
                    </attribute>
 
566
                    <element>
 
567
                        <xsl:attribute name="name">customize</xsl:attribute>
 
568
                        <xsl:attribute name="optional">true</xsl:attribute>
 
569
                    </element>
 
570
                    <sequential>
 
571
                        <java fork="true" classname="@{{classname}}">
 
572
                            <xsl:attribute name="dir">${work.dir}</xsl:attribute>
 
573
                            <xsl:if test="/p:project/p:configuration/j2seproject3:data/j2seproject3:explicit-platform">
 
574
                                <xsl:attribute name="jvm">${platform.java}</xsl:attribute>
 
575
                            </xsl:if>
 
576
                            <jvmarg line="${{run.jvmargs}}"/>
 
577
                            <classpath>
 
578
                                <path path="${{run.classpath}}"/>
 
579
                            </classpath>
 
580
                            <syspropertyset>
 
581
                                <propertyref prefix="run-sys-prop."/>
 
582
                                <mapper type="glob" from="run-sys-prop.*" to="*"/>
 
583
                            </syspropertyset>
 
584
                            <customize/>
 
585
                        </java>
 
586
                    </sequential>
 
587
                </macrodef>
 
588
            </target>
 
589
            
 
590
            <target name="-init-presetdef-jar">
 
591
                <presetdef>
 
592
                    <xsl:attribute name="name">jar</xsl:attribute>
 
593
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/1</xsl:attribute>
 
594
                    <jar jarfile="${{dist.jar}}" compress="${{jar.compress}}">
 
595
                        <j2seproject1:fileset dir="${{build.classes.dir}}"/>
 
596
                        <!-- XXX should have a property serving as the excludes list -->
 
597
                    </jar>
 
598
                </presetdef>
 
599
            </target>
 
600
            
 
601
            <target name="init">
 
602
                <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-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar</xsl:attribute>
 
603
            </target>
 
604
            
 
605
            <xsl:comment>
 
606
                ===================
 
607
                COMPILATION SECTION
 
608
                ===================
 
609
            </xsl:comment>
 
610
            
 
611
            <xsl:call-template name="deps.target">
 
612
                <xsl:with-param name="targetname" select="'deps-jar'"/>
 
613
                <xsl:with-param name="type" select="'jar'"/>
 
614
            </xsl:call-template>
 
615
            
 
616
            <xsl:if test="/p:project/p:configuration/jaxrpc:web-service-clients/jaxrpc:web-service-client">
 
617
                <target name="wscompile-init" depends="init">
 
618
                    <taskdef name="wscompile" classname="com.sun.xml.rpc.tools.ant.Wscompile"
 
619
                             classpath="${{wscompile.classpath}}"/>
 
620
                    <taskdef name="wsclientuptodate" classname="org.netbeans.modules.websvc.jaxrpc.ant.WsClientUpToDate"
 
621
                             classpath="${{wsclientuptodate.classpath}}"/>
 
622
                    
 
623
                    <mkdir dir="${{build.classes.dir}}"/>
 
624
                    <mkdir dir="${{build.generated.dir}}/wsclient"/>
 
625
                    <mkdir dir="${{build.generated.dir}}/wsbinary"/>
 
626
                    
 
627
                    <xsl:for-each select="/p:project/p:configuration/jaxrpc:web-service-clients/jaxrpc:web-service-client">
 
628
                        <xsl:variable name="wsclientname">
 
629
                            <xsl:value-of select="jaxrpc:web-service-client-name"/>
 
630
                        </xsl:variable>
 
631
                        
 
632
                        <wsclientuptodate property="wscompile.client.{$wsclientname}.notrequired"
 
633
                                          sourcewsdl="${{meta.inf.dir}}/wsdl/{$wsclientname}.wsdl"
 
634
                                          targetdir="${{build.generated.dir}}/wsclient"/>
 
635
                    </xsl:for-each>
 
636
                </target>
 
637
            </xsl:if>
 
638
            
 
639
            <xsl:for-each select="/p:project/p:configuration/jaxrpc:web-service-clients/jaxrpc:web-service-client">
 
640
                <xsl:variable name="wsclientname">
 
641
                    <xsl:value-of select="jaxrpc:web-service-client-name"/>
 
642
                </xsl:variable>
 
643
                <xsl:variable name="useimport">
 
644
                    <xsl:choose>
 
645
                        <xsl:when test="jaxrpc:web-service-stub-type">
 
646
                            <xsl:value-of select="jaxrpc:web-service-stub-type='jsr-109_client'"/>
 
647
                        </xsl:when>
 
648
                        <xsl:otherwise>true</xsl:otherwise>
 
649
                    </xsl:choose>
 
650
                </xsl:variable>
 
651
                <xsl:variable name="useclient">
 
652
                    <xsl:choose>
 
653
                        <xsl:when test="jaxrpc:web-service-stub-type">
 
654
                            <xsl:value-of select="jaxrpc:web-service-stub-type='jaxrpc_static_client'"/>
 
655
                        </xsl:when>
 
656
                        <xsl:otherwise>false</xsl:otherwise>
 
657
                    </xsl:choose>
 
658
                </xsl:variable>
 
659
                
 
660
                <target name="{$wsclientname}-client-wscompile" depends="wscompile-init" unless="wscompile.client.{$wsclientname}.notrequired">
 
661
                    <property name="config_target" location="${{meta.inf.dir}}/wsdl"/>
 
662
                    <copy file="${{meta.inf.dir}}/wsdl/{$wsclientname}-config.xml"
 
663
                          tofile="${{build.generated.dir}}/wsclient/wsdl/{$wsclientname}-config.xml" filtering="on" encoding="UTF-8">
 
664
                        <filterset>
 
665
                            <!-- replace token with reference to WSDL file in source tree, not build tree, since the
 
666
                                 the file probably has not have been copied to the build tree yet. -->
 
667
                            <filter token="CONFIG_ABSOLUTE_PATH" value="${{config_target}}"/>
 
668
                        </filterset>
 
669
                    </copy>
 
670
                    <wscompile
 
671
                        verbose="${{wscompile.client.{$wsclientname}.verbose}}"
 
672
                        debug="${{wscompile.client.{$wsclientname}.debug}}"
 
673
                        xPrintStackTrace="${{wscompile.client.{$wsclientname}.xPrintStackTrace}}"
 
674
                        xSerializable="${{wscompile.client.{$wsclientname}.xSerializable}}"
 
675
                        optimize="${{wscompile.client.{$wsclientname}.optimize}}"
 
676
                        fork="true" keep="true"
 
677
                        client="{$useclient}" import="{$useimport}"
 
678
                        features="${{wscompile.client.{$wsclientname}.features}}"
 
679
                        base="${{build.generated.dir}}/wsbinary"
 
680
                        sourceBase="${{build.generated.dir}}/wsclient"
 
681
                        classpath="${{wscompile.classpath}}:${{javac.classpath}}"
 
682
                        mapping="${{build.generated.dir}}/wsclient/wsdl/{$wsclientname}-mapping.xml"
 
683
                        httpproxy="${{wscompile.client.{$wsclientname}.proxy}}"
 
684
                        config="${{build.generated.dir}}/wsclient/wsdl/{$wsclientname}-config.xml">
 
685
                    </wscompile>
 
686
                </target>
 
687
            </xsl:for-each>
 
688
            
 
689
            <xsl:if test="/p:project/p:configuration/jaxrpc:web-service-clients/jaxrpc:web-service-client">
 
690
                <target name="web-service-client-generate">
 
691
                    <xsl:attribute name="depends">
 
692
                        <xsl:for-each select="/p:project/p:configuration/jaxrpc:web-service-clients/jaxrpc:web-service-client">
 
693
                            <xsl:if test="position()!=1"><xsl:text>, </xsl:text></xsl:if>
 
694
                            <xsl:variable name="wsname2">
 
695
                                <xsl:value-of select="jaxrpc:web-service-client-name"/>
 
696
                            </xsl:variable>
 
697
                            <xsl:value-of select="jaxrpc:web-service-client-name"/><xsl:text>-client-wscompile</xsl:text>
 
698
                        </xsl:for-each>
 
699
                    </xsl:attribute>
 
700
                </target>
 
701
                <target name="-web-service-client-compile-depend" if="do.depend.true">
 
702
                    <j2seproject3:depend srcdir="${{build.generated.dir}}/wsclient" classpath="${{wscompile.classpath}}:${{javac.classpath}}" destdir="${{build.classes.dir}}"/>
 
703
                </target>
 
704
                <target name="web-service-client-compile" depends="web-service-client-generate,-web-service-client-compile-depend">
 
705
                    <j2seproject3:javac srcdir="${{build.generated.dir}}/wsclient" classpath="${{wscompile.classpath}}:${{javac.classpath}}" destdir="${{build.classes.dir}}"/>
 
706
                </target>
 
707
            </xsl:if>
 
708
            
 
709
            <target name="-pre-pre-compile">
 
710
                <xsl:attribute name="depends">init,deps-jar<xsl:if test="/p:project/p:configuration/jaxrpc:web-service-clients/jaxrpc:web-service-client">,web-service-client-generate</xsl:if></xsl:attribute>
 
711
                <mkdir dir="${{build.classes.dir}}"/>
 
712
            </target>
 
713
            
 
714
            <target name="-pre-compile">
 
715
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
 
716
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
 
717
            </target>
 
718
            
 
719
            <target name="-compile-depend" if="do.depend.true">
 
720
                <j2seproject3:depend/>
 
721
            </target>
 
722
            <target name="-do-compile">
 
723
                <xsl:attribute name="depends">init,deps-jar,-pre-pre-compile,-pre-compile<xsl:if test="/p:project/p:configuration/jaxrpc:web-service-clients/jaxrpc:web-service-client">,web-service-client-compile</xsl:if>,-compile-depend</xsl:attribute>
 
724
                <xsl:attribute name="if">have.sources</xsl:attribute>
 
725
                <j2seproject3:javac/>
 
726
                <copy todir="${{build.classes.dir}}">
 
727
                    <xsl:call-template name="createFilesets">
 
728
                        <xsl:with-param name="roots" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:source-roots"/>
 
729
                        <!-- XXX should perhaps use ${includes} and ${excludes} -->
 
730
                        <xsl:with-param name="excludes">${build.classes.excludes}</xsl:with-param>
 
731
                    </xsl:call-template>
 
732
                </copy>
 
733
            </target>
 
734
            
 
735
            <target name="-post-compile">
 
736
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
 
737
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
 
738
            </target>
 
739
            
 
740
            <target name="compile">
 
741
                <xsl:attribute name="depends">init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile</xsl:attribute>
 
742
                <xsl:attribute name="description">Compile project.</xsl:attribute>
 
743
            </target>
 
744
            
 
745
            <target name="-pre-compile-single">
 
746
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
 
747
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
 
748
            </target>
 
749
            
 
750
            <target name="-do-compile-single">
 
751
                <xsl:attribute name="depends">init,deps-jar,-pre-pre-compile<xsl:if test="/p:project/p:configuration/jaxrpc:web-service-clients/jaxrpc:web-service-client">,web-service-client-compile</xsl:if></xsl:attribute>
 
752
                <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 
753
                <j2seproject3:force-recompile/>
 
754
                <xsl:element name="j2seproject3:javac">
 
755
                    <xsl:attribute name="includes">${javac.includes}</xsl:attribute>
 
756
                    <xsl:attribute name="excludes"/>
 
757
                    <xsl:attribute name="sourcepath"> <!-- #115918 -->
 
758
                        <xsl:call-template name="createPath">
 
759
                            <xsl:with-param name="roots" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:source-roots"/>
 
760
                        </xsl:call-template>
 
761
                    </xsl:attribute>
 
762
                </xsl:element>
 
763
            </target>
 
764
            
 
765
            <target name="-post-compile-single">
 
766
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
 
767
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
 
768
            </target>
 
769
            
 
770
            <target name="compile-single">
 
771
                <xsl:attribute name="depends">init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single</xsl:attribute>
 
772
            </target>
 
773
            
 
774
            <xsl:comment>
 
775
                ====================
 
776
                JAR BUILDING SECTION
 
777
                ====================
 
778
            </xsl:comment>
 
779
            
 
780
            <target name="-pre-pre-jar">
 
781
                <xsl:attribute name="depends">init</xsl:attribute>
 
782
                <dirname property="dist.jar.dir" file="${{dist.jar}}"/>
 
783
                <mkdir dir="${{dist.jar.dir}}"/>
 
784
            </target>
 
785
            
 
786
            <target name="-pre-jar">
 
787
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
 
788
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
 
789
            </target>
 
790
            
 
791
            <target name="-do-jar-without-manifest">
 
792
                <xsl:attribute name="depends">init,compile,-pre-pre-jar,-pre-jar</xsl:attribute>
 
793
                <xsl:attribute name="unless">manifest.available</xsl:attribute>
 
794
                <j2seproject1:jar/>
 
795
            </target>
 
796
            
 
797
            <target name="-do-jar-with-manifest">
 
798
                <xsl:attribute name="depends">init,compile,-pre-pre-jar,-pre-jar</xsl:attribute>
 
799
                <xsl:attribute name="if">manifest.available</xsl:attribute>
 
800
                <xsl:attribute name="unless">manifest.available+main.class</xsl:attribute>
 
801
                <j2seproject1:jar manifest="${{manifest.file}}"/>
 
802
            </target>
 
803
            
 
804
            <target name="-do-jar-with-mainclass">
 
805
                <xsl:attribute name="depends">init,compile,-pre-pre-jar,-pre-jar</xsl:attribute>
 
806
                <xsl:attribute name="if">manifest.available+main.class</xsl:attribute>
 
807
                <xsl:attribute name="unless">manifest.available+main.class+mkdist.available</xsl:attribute>
 
808
                <j2seproject1:jar manifest="${{manifest.file}}">
 
809
                    <j2seproject1:manifest>
 
810
                        <j2seproject1:attribute name="Main-Class" value="${{main.class}}"/>
 
811
                    </j2seproject1:manifest>
 
812
                </j2seproject1:jar>
 
813
                <echo>To run this application from the command line without Ant, try:</echo>
 
814
                <property name="build.classes.dir.resolved" location="${{build.classes.dir}}"/>
 
815
                <property name="dist.jar.resolved" location="${{dist.jar}}"/>
 
816
                <pathconvert property="run.classpath.with.dist.jar">
 
817
                    <path path="${{run.classpath}}"/>
 
818
                    <map from="${{build.classes.dir.resolved}}" to="${{dist.jar.resolved}}"/>
 
819
                </pathconvert>
 
820
                <echo><xsl:choose>
 
821
                        <xsl:when test="/p:project/p:configuration/j2seproject3:data/j2seproject3:explicit-platform">${platform.java}</xsl:when>
 
822
                        <xsl:otherwise>java</xsl:otherwise>
 
823
                </xsl:choose> -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
 
824
            </target>
 
825
            
 
826
            <target name="-do-jar-with-libraries">
 
827
                <xsl:attribute name="depends">init,compile,-pre-pre-jar,-pre-jar</xsl:attribute>
 
828
                <xsl:attribute name="if">manifest.available+main.class+mkdist.available</xsl:attribute>
 
829
                
 
830
                <property name="build.classes.dir.resolved" location="${{build.classes.dir}}"/>
 
831
                <pathconvert property="run.classpath.without.build.classes.dir">
 
832
                    <path path="${{run.classpath}}"/>
 
833
                    <map from="${{build.classes.dir.resolved}}" to=""/>
 
834
                </pathconvert>        
 
835
                <pathconvert property="jar.classpath" pathsep=" ">
 
836
                    <path path="${{run.classpath.without.build.classes.dir}}"/>
 
837
                    <chainedmapper>
 
838
                        <flattenmapper/>
 
839
                        <globmapper from="*" to="lib/*"/>
 
840
                    </chainedmapper>
 
841
                </pathconvert>        
 
842
                <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" name="copylibs" classpath="${{libs.CopyLibs.classpath}}"/>
 
843
                <copylibs manifest="${{manifest.file}}" runtimeclasspath="${{run.classpath.without.build.classes.dir}}" jarfile="${{dist.jar}}" compress="${{jar.compress}}">
 
844
                    <fileset dir="${{build.classes.dir}}"/>
 
845
                    <manifest>
 
846
                        <attribute name="Main-Class" value="${{main.class}}"/>
 
847
                        <attribute name="Class-Path" value="${{jar.classpath}}"/>
 
848
                    </manifest>
 
849
                </copylibs>                                
 
850
                <echo>To run this application from the command line without Ant, try:</echo>
 
851
                <property name="dist.jar.resolved" location="${{dist.jar}}"/>
 
852
                <echo><xsl:choose>
 
853
                        <xsl:when test="/p:project/p:configuration/j2seproject3:data/j2seproject3:explicit-platform">${platform.java}</xsl:when>
 
854
                        <xsl:otherwise>java</xsl:otherwise>
 
855
                </xsl:choose> -jar "${dist.jar.resolved}"</echo>                
 
856
            </target>
 
857
            
 
858
            <target name="-post-jar">
 
859
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
 
860
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
 
861
            </target>
 
862
            
 
863
            <target name="jar">
 
864
                <xsl:attribute name="depends">init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar</xsl:attribute>
 
865
                <xsl:attribute name="description">Build JAR.</xsl:attribute>
 
866
            </target>
 
867
            
 
868
            <xsl:comment>
 
869
                =================
 
870
                EXECUTION SECTION
 
871
                =================
 
872
            </xsl:comment>
 
873
            
 
874
            <target name="run">
 
875
                <xsl:attribute name="depends">init,compile</xsl:attribute>
 
876
                <xsl:attribute name="description">Run a main class.</xsl:attribute>
 
877
                <j2seproject1:java>
 
878
                    <customize>
 
879
                        <arg line="${{application.args}}"/>
 
880
                    </customize>
 
881
                </j2seproject1:java>
 
882
            </target>
 
883
            
 
884
            <target name="-do-not-recompile">
 
885
                <property name="javac.includes.binary" value=""/> <!-- #116230 hack -->
 
886
            </target>
 
887
            <target name="run-single">
 
888
                <xsl:attribute name="depends">init,-do-not-recompile,compile-single</xsl:attribute>
 
889
                <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
 
890
                <j2seproject1:java classname="${{run.class}}"/>
 
891
            </target>
 
892
            
 
893
            <xsl:comment>
 
894
                =================
 
895
                DEBUGGING SECTION
 
896
                =================
 
897
            </xsl:comment>
 
898
            
 
899
            <target name="-debug-start-debugger">
 
900
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
 
901
                <xsl:attribute name="depends">init</xsl:attribute>
 
902
                <j2seproject1:nbjpdastart name="${{debug.class}}"/>
 
903
            </target>
 
904
            
 
905
            <target name="-debug-start-debuggee">
 
906
                <xsl:attribute name="depends">init,compile</xsl:attribute>
 
907
                <j2seproject3:debug>
 
908
                    <customize>
 
909
                        <arg line="${{application.args}}"/>
 
910
                    </customize>
 
911
                </j2seproject3:debug>
 
912
            </target>
 
913
            
 
914
            <target name="debug">
 
915
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
 
916
                <xsl:attribute name="depends">init,compile,-debug-start-debugger,-debug-start-debuggee</xsl:attribute>
 
917
                <xsl:attribute name="description">Debug project in IDE.</xsl:attribute>
 
918
            </target>
 
919
            
 
920
            <target name="-debug-start-debugger-stepinto">
 
921
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
 
922
                <xsl:attribute name="depends">init</xsl:attribute>
 
923
                <j2seproject1:nbjpdastart stopclassname="${{main.class}}"/>
 
924
            </target>
 
925
            
 
926
            <target name="debug-stepinto">
 
927
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
 
928
                <xsl:attribute name="depends">init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee</xsl:attribute>
 
929
            </target>
 
930
            
 
931
            <target name="-debug-start-debuggee-single">
 
932
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
 
933
                <xsl:attribute name="depends">init,compile-single</xsl:attribute>
 
934
                <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
 
935
                <j2seproject3:debug classname="${{debug.class}}"/>
 
936
            </target>
 
937
            
 
938
            <target name="debug-single">
 
939
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
 
940
                <xsl:attribute name="depends">init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single</xsl:attribute>
 
941
            </target>
 
942
            
 
943
            <target name="-pre-debug-fix">
 
944
                <xsl:attribute name="depends">init</xsl:attribute>
 
945
                <fail unless="fix.includes">Must set fix.includes</fail>
 
946
                <property name="javac.includes" value="${{fix.includes}}.java"/>
 
947
            </target>
 
948
            
 
949
            <target name="-do-debug-fix">
 
950
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
 
951
                <xsl:attribute name="depends">init,-pre-debug-fix,compile-single</xsl:attribute>
 
952
                <j2seproject1:nbjpdareload/>
 
953
            </target>
 
954
            
 
955
            <target name="debug-fix">
 
956
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
 
957
                <xsl:attribute name="depends">init,-pre-debug-fix,-do-debug-fix</xsl:attribute>
 
958
            </target>
 
959
            
 
960
            <xsl:comment>
 
961
                ===============
 
962
                JAVADOC SECTION
 
963
                ===============
 
964
            </xsl:comment>
 
965
            
 
966
            <target name="-javadoc-build">
 
967
                <xsl:attribute name="depends">init</xsl:attribute>
 
968
                <mkdir dir="${{dist.javadoc.dir}}"/>
 
969
                <!-- XXX do an up-to-date check first -->
 
970
                <javadoc>
 
971
                    <xsl:attribute name="destdir">${dist.javadoc.dir}</xsl:attribute>
 
972
                    <xsl:attribute name="source">${javac.source}</xsl:attribute>
 
973
                    <xsl:attribute name="notree">${javadoc.notree}</xsl:attribute>
 
974
                    <xsl:attribute name="use">${javadoc.use}</xsl:attribute>
 
975
                    <xsl:attribute name="nonavbar">${javadoc.nonavbar}</xsl:attribute>
 
976
                    <xsl:attribute name="noindex">${javadoc.noindex}</xsl:attribute>
 
977
                    <xsl:attribute name="splitindex">${javadoc.splitindex}</xsl:attribute>
 
978
                    <xsl:attribute name="author">${javadoc.author}</xsl:attribute>
 
979
                    <xsl:attribute name="version">${javadoc.version}</xsl:attribute>
 
980
                    <xsl:attribute name="windowtitle">${javadoc.windowtitle}</xsl:attribute>
 
981
                    <xsl:attribute name="private">${javadoc.private}</xsl:attribute>
 
982
                    <xsl:attribute name="additionalparam">${javadoc.additionalparam}</xsl:attribute>
 
983
                    <xsl:attribute name="failonerror">true</xsl:attribute> <!-- #47325 -->
 
984
                    <xsl:attribute name="useexternalfile">true</xsl:attribute> <!-- #57375, requires Ant >=1.6.5 -->
 
985
                    <xsl:attribute name="encoding">${javadoc.encoding.used}</xsl:attribute>
 
986
                    <xsl:attribute name="docencoding">UTF-8</xsl:attribute>
 
987
                    <xsl:attribute name="charset">UTF-8</xsl:attribute>
 
988
                    <xsl:if test="/p:project/p:configuration/j2seproject3:data/j2seproject3:explicit-platform">
 
989
                        <xsl:attribute name="executable">${platform.javadoc}</xsl:attribute>
 
990
                    </xsl:if>                                                        
 
991
                    <classpath>
 
992
                        <path path="${{javac.classpath}}"/>
 
993
                    </classpath>
 
994
                    <!-- Does not work with includes/excludes:
 
995
                    <sourcepath>
 
996
                        <xsl:call-template name="createPathElements">
 
997
                            <xsl:with-param name="locations" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:source-roots"/>
 
998
                        </xsl:call-template>
 
999
                    </sourcepath>
 
1000
                    -->
 
1001
                    <!-- Does not work with includes/excludes either, and duplicates class names in index:
 
1002
                    <xsl:call-template name="createPackagesets">
 
1003
                        <xsl:with-param name="roots" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:source-roots"/>
 
1004
                    </xsl:call-template>
 
1005
                    -->
 
1006
                    <xsl:call-template name="createFilesets">
 
1007
                        <xsl:with-param name="roots" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:source-roots"/>
 
1008
                        <xsl:with-param name="includes2">**/*.java</xsl:with-param>
 
1009
                    </xsl:call-template>
 
1010
                </javadoc>
 
1011
            </target>
 
1012
            
 
1013
            <target name="-javadoc-browse">
 
1014
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
 
1015
                <xsl:attribute name="unless">no.javadoc.preview</xsl:attribute>
 
1016
                <xsl:attribute name="depends">init,-javadoc-build</xsl:attribute>
 
1017
                <nbbrowse file="${{dist.javadoc.dir}}/index.html"/>
 
1018
            </target>
 
1019
            
 
1020
            <target name="javadoc">
 
1021
                <xsl:attribute name="depends">init,-javadoc-build,-javadoc-browse</xsl:attribute>
 
1022
                <xsl:attribute name="description">Build Javadoc.</xsl:attribute>
 
1023
            </target>
 
1024
            
 
1025
            <xsl:comment>
 
1026
                =========================
 
1027
                JUNIT COMPILATION SECTION
 
1028
                =========================
 
1029
            </xsl:comment>
 
1030
            
 
1031
            <target name="-pre-pre-compile-test">
 
1032
                <xsl:attribute name="if">have.tests</xsl:attribute>
 
1033
                <xsl:attribute name="depends">init,compile</xsl:attribute>
 
1034
                <mkdir dir="${{build.test.classes.dir}}"/>
 
1035
            </target>
 
1036
            
 
1037
            <target name="-pre-compile-test">
 
1038
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
 
1039
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
 
1040
            </target>
 
1041
            
 
1042
            <target name="-compile-test-depend" if="do.depend.true">
 
1043
                <xsl:element name="j2seproject3:depend">
 
1044
                    <xsl:attribute name="srcdir">
 
1045
                        <xsl:call-template name="createPath">
 
1046
                            <xsl:with-param name="roots" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:test-roots"/>
 
1047
                        </xsl:call-template>
 
1048
                    </xsl:attribute>
 
1049
                    <xsl:attribute name="destdir">${build.test.classes.dir}</xsl:attribute>
 
1050
                    <xsl:attribute name="classpath">${javac.test.classpath}</xsl:attribute>
 
1051
                </xsl:element>
 
1052
            </target>
 
1053
            <target name="-do-compile-test">
 
1054
                <xsl:attribute name="if">have.tests</xsl:attribute>
 
1055
                <xsl:attribute name="depends">init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend</xsl:attribute>
 
1056
                <xsl:element name="j2seproject3:javac">
 
1057
                    <xsl:attribute name="srcdir">
 
1058
                        <xsl:call-template name="createPath">
 
1059
                            <xsl:with-param name="roots" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:test-roots"/>
 
1060
                        </xsl:call-template>
 
1061
                    </xsl:attribute>
 
1062
                    <xsl:attribute name="destdir">${build.test.classes.dir}</xsl:attribute>
 
1063
                    <xsl:attribute name="debug">true</xsl:attribute>
 
1064
                    <xsl:attribute name="classpath">${javac.test.classpath}</xsl:attribute>
 
1065
                </xsl:element>
 
1066
                <copy todir="${{build.test.classes.dir}}">
 
1067
                    <xsl:call-template name="createFilesets">
 
1068
                        <xsl:with-param name="roots" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:test-roots"/>
 
1069
                        <xsl:with-param name="excludes">${build.classes.excludes}</xsl:with-param>
 
1070
                    </xsl:call-template>
 
1071
                </copy>
 
1072
            </target>
 
1073
            
 
1074
            <target name="-post-compile-test">
 
1075
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
 
1076
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
 
1077
            </target>
 
1078
            
 
1079
            <target name="compile-test">
 
1080
                <xsl:attribute name="depends">init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test</xsl:attribute>
 
1081
            </target>
 
1082
            
 
1083
            <target name="-pre-compile-test-single">
 
1084
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
 
1085
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
 
1086
            </target>
 
1087
            
 
1088
            <target name="-do-compile-test-single">
 
1089
                <xsl:attribute name="if">have.tests</xsl:attribute>
 
1090
                <xsl:attribute name="depends">init,compile,-pre-pre-compile-test,-pre-compile-test-single</xsl:attribute>
 
1091
                <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
 
1092
                <xsl:element name="j2seproject3:force-recompile">
 
1093
                    <xsl:attribute name="destdir">${build.test.classes.dir}</xsl:attribute>
 
1094
                </xsl:element>
 
1095
                <xsl:element name="j2seproject3:javac">
 
1096
                    <xsl:attribute name="srcdir">
 
1097
                        <xsl:call-template name="createPath">
 
1098
                            <xsl:with-param name="roots" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:test-roots"/>
 
1099
                        </xsl:call-template>
 
1100
                    </xsl:attribute>
 
1101
                    <xsl:attribute name="sourcepath">
 
1102
                        <xsl:call-template name="createPath">
 
1103
                            <xsl:with-param name="roots" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:test-roots"/>
 
1104
                        </xsl:call-template>
 
1105
                    </xsl:attribute>
 
1106
                    <xsl:attribute name="destdir">${build.test.classes.dir}</xsl:attribute>
 
1107
                    <xsl:attribute name="debug">true</xsl:attribute>
 
1108
                    <xsl:attribute name="classpath">${javac.test.classpath}</xsl:attribute>
 
1109
                    <xsl:attribute name="includes">${javac.includes}</xsl:attribute>
 
1110
                    <xsl:attribute name="excludes"/>
 
1111
                </xsl:element>
 
1112
                <copy todir="${{build.test.classes.dir}}">
 
1113
                    <xsl:call-template name="createFilesets">
 
1114
                        <xsl:with-param name="roots" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:test-roots"/>
 
1115
                        <xsl:with-param name="excludes">${build.classes.excludes}</xsl:with-param>
 
1116
                    </xsl:call-template>
 
1117
                </copy>
 
1118
            </target>
 
1119
            
 
1120
            <target name="-post-compile-test-single">
 
1121
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
 
1122
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
 
1123
            </target>
 
1124
            
 
1125
            <target name="compile-test-single">
 
1126
                <xsl:attribute name="depends">init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single</xsl:attribute>
 
1127
            </target>
 
1128
            
 
1129
            <xsl:comment>
 
1130
                =======================
 
1131
                JUNIT EXECUTION SECTION
 
1132
                =======================
 
1133
            </xsl:comment>
 
1134
            
 
1135
            <target name="-pre-test-run">
 
1136
                <xsl:attribute name="if">have.tests</xsl:attribute>
 
1137
                <xsl:attribute name="depends">init</xsl:attribute>
 
1138
                <mkdir dir="${{build.test.results.dir}}"/>
 
1139
            </target>
 
1140
            
 
1141
            <target name="-do-test-run">
 
1142
                <xsl:attribute name="if">have.tests</xsl:attribute>
 
1143
                <xsl:attribute name="depends">init,compile-test,-pre-test-run</xsl:attribute>
 
1144
                <j2seproject3:junit testincludes="**/*Test.java"/>
 
1145
            </target>
 
1146
            
 
1147
            <target name="-post-test-run">
 
1148
                <xsl:attribute name="if">have.tests</xsl:attribute>
 
1149
                <xsl:attribute name="depends">init,compile-test,-pre-test-run,-do-test-run</xsl:attribute>
 
1150
                <fail if="tests.failed">Some tests failed; see details above.</fail>
 
1151
            </target>
 
1152
            
 
1153
            <target name="test-report">
 
1154
                <xsl:attribute name="if">have.tests</xsl:attribute>
 
1155
                <xsl:attribute name="depends">init</xsl:attribute>
 
1156
                <!-- TBD
 
1157
                <junitreport todir="${{build.test.results.dir}}">
 
1158
                    <fileset dir="${{build.test.results.dir}}">
 
1159
                        <include name="TEST-*.xml"/>
 
1160
                    </fileset>
 
1161
                    <report format="noframes" todir="${{build.test.results.dir}}"/>
 
1162
                </junitreport>
 
1163
                -->
 
1164
            </target>
 
1165
            
 
1166
            <target name="-test-browse">
 
1167
                <xsl:attribute name="if">netbeans.home+have.tests</xsl:attribute>
 
1168
                <xsl:attribute name="depends">init</xsl:attribute>
 
1169
                <!-- TBD
 
1170
                <nbbrowse file="${{build.test.results.dir}}/junit-noframes.html"/>
 
1171
                -->
 
1172
            </target>
 
1173
            
 
1174
            <target name="test">
 
1175
                <xsl:attribute name="depends">init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse</xsl:attribute>
 
1176
                <xsl:attribute name="description">Run unit tests.</xsl:attribute>
 
1177
            </target>
 
1178
            
 
1179
            <target name="-pre-test-run-single">
 
1180
                <xsl:attribute name="if">have.tests</xsl:attribute>
 
1181
                <xsl:attribute name="depends">init</xsl:attribute>
 
1182
                <mkdir dir="${{build.test.results.dir}}"/>
 
1183
            </target>
 
1184
            
 
1185
            <target name="-do-test-run-single">
 
1186
                <xsl:attribute name="if">have.tests</xsl:attribute>
 
1187
                <xsl:attribute name="depends">init,compile-test-single,-pre-test-run-single</xsl:attribute>
 
1188
                <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
 
1189
                <j2seproject3:junit includes="${{test.includes}}" excludes=""/>
 
1190
            </target>
 
1191
            
 
1192
            <target name="-post-test-run-single">
 
1193
                <xsl:attribute name="if">have.tests</xsl:attribute>
 
1194
                <xsl:attribute name="depends">init,compile-test-single,-pre-test-run-single,-do-test-run-single</xsl:attribute>
 
1195
                <fail if="tests.failed">Some tests failed; see details above.</fail>
 
1196
            </target>
 
1197
            
 
1198
            <target name="test-single">
 
1199
                <xsl:attribute name="depends">init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single</xsl:attribute>
 
1200
                <xsl:attribute name="description">Run single unit test.</xsl:attribute>
 
1201
            </target>
 
1202
            
 
1203
            <xsl:comment>
 
1204
                =======================
 
1205
                JUNIT DEBUGGING SECTION
 
1206
                =======================
 
1207
            </xsl:comment>
 
1208
            
 
1209
            <target name="-debug-start-debuggee-test">
 
1210
                <xsl:attribute name="if">have.tests</xsl:attribute>
 
1211
                <xsl:attribute name="depends">init,compile-test</xsl:attribute>
 
1212
                <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
 
1213
                <property name="test.report.file" location="${{build.test.results.dir}}/TEST-${{test.class}}.xml"/>
 
1214
                <delete file="${{test.report.file}}"/>
 
1215
                <mkdir dir="${{build.test.results.dir}}"/>
 
1216
                <!--Ugly, puts ant and ant-junit to the test classpath, but there is probably no other solution how to run the XML formatter -->
 
1217
                <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${{ant.home}}/lib/ant.jar:${{ant.home}}/lib/ant-junit.jar:${{debug.test.classpath}}">
 
1218
                    <customize>                        
 
1219
                        <syspropertyset>
 
1220
                            <propertyref prefix="test-sys-prop."/>
 
1221
                            <mapper type="glob" from="test-sys-prop.*" to="*"/>
 
1222
                        </syspropertyset>                        
 
1223
                        <arg value="${{test.class}}"/>
 
1224
                        <arg value="showoutput=true"/>
 
1225
                        <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
 
1226
                        <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${{test.report.file}}"/>
 
1227
                    </customize>
 
1228
                </j2seproject3:debug>
 
1229
            </target>
 
1230
            
 
1231
            <target name="-debug-start-debugger-test">
 
1232
                <xsl:attribute name="if">netbeans.home+have.tests</xsl:attribute>
 
1233
                <xsl:attribute name="depends">init,compile-test</xsl:attribute>
 
1234
                <j2seproject1:nbjpdastart name="${{test.class}}" classpath="${{debug.test.classpath}}"/>
 
1235
            </target>
 
1236
            
 
1237
            <target name="debug-test">
 
1238
                <xsl:attribute name="depends">init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test</xsl:attribute>
 
1239
            </target>
 
1240
            
 
1241
            <target name="-do-debug-fix-test">
 
1242
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
 
1243
                <xsl:attribute name="depends">init,-pre-debug-fix,compile-test-single</xsl:attribute>
 
1244
                <j2seproject1:nbjpdareload dir="${{build.test.classes.dir}}"/>
 
1245
            </target>
 
1246
            
 
1247
            <target name="debug-fix-test">
 
1248
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
 
1249
                <xsl:attribute name="depends">init,-pre-debug-fix,-do-debug-fix-test</xsl:attribute>
 
1250
            </target>
 
1251
            
 
1252
            
 
1253
            <xsl:comment>
 
1254
                =========================
 
1255
                APPLET EXECUTION SECTION
 
1256
                =========================
 
1257
            </xsl:comment>
 
1258
            
 
1259
            <target name="run-applet">
 
1260
                <xsl:attribute name="depends">init,compile-single</xsl:attribute>
 
1261
                <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 
1262
                <j2seproject1:java classname="sun.applet.AppletViewer">
 
1263
                    <customize>
 
1264
                        <arg value="${{applet.url}}"/>
 
1265
                    </customize>
 
1266
                </j2seproject1:java>
 
1267
            </target>
 
1268
            
 
1269
            <xsl:comment>
 
1270
                =========================
 
1271
                APPLET DEBUGGING  SECTION
 
1272
                =========================
 
1273
            </xsl:comment>
 
1274
            
 
1275
            <target name="-debug-start-debuggee-applet">
 
1276
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
 
1277
                <xsl:attribute name="depends">init,compile-single</xsl:attribute>
 
1278
                <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
 
1279
                <j2seproject3:debug classname="sun.applet.AppletViewer">
 
1280
                    <customize>
 
1281
                        <arg value="${{applet.url}}"/>
 
1282
                    </customize>
 
1283
                </j2seproject3:debug>
 
1284
            </target>
 
1285
            
 
1286
            <target name="debug-applet">
 
1287
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
 
1288
                <xsl:attribute name="depends">init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet</xsl:attribute>
 
1289
            </target>
 
1290
            
 
1291
            <xsl:comment>
 
1292
                ===============
 
1293
                CLEANUP SECTION
 
1294
                ===============
 
1295
            </xsl:comment>
 
1296
            
 
1297
            <xsl:call-template name="deps.target">
 
1298
                <xsl:with-param name="targetname" select="'deps-clean'"/>
 
1299
            </xsl:call-template>
 
1300
            
 
1301
            <target name="-do-clean">
 
1302
                <xsl:attribute name="depends">init</xsl:attribute>
 
1303
                <delete dir="${{build.dir}}"/>
 
1304
                <delete dir="${{dist.dir}}"/>
 
1305
                <!-- XXX explicitly delete all build.* and dist.* dirs in case they are not subdirs -->
 
1306
            </target>
 
1307
            
 
1308
            <target name="-post-clean">
 
1309
                <xsl:comment> Empty placeholder for easier customization. </xsl:comment>
 
1310
                <xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
 
1311
            </target>
 
1312
            
 
1313
            <target name="clean">
 
1314
                <xsl:attribute name="depends">init,deps-clean,-do-clean,-post-clean</xsl:attribute>
 
1315
                <xsl:attribute name="description">Clean build products.</xsl:attribute>
 
1316
            </target>
 
1317
            
 
1318
        </project>
 
1319
        
 
1320
    </xsl:template>
 
1321
    
 
1322
    <!---
 
1323
    Generic template to build subdependencies of a certain type.
 
1324
    Feel free to copy into other modules.
 
1325
    @param targetname required name of target to generate
 
1326
    @param type artifact-type from project.xml to filter on; optional, if not specified, uses
 
1327
                all references, and looks for clean targets rather than build targets
 
1328
    @return an Ant target which builds (or cleans) all known subprojects
 
1329
    -->
 
1330
    <xsl:template name="deps.target">
 
1331
        <xsl:param name="targetname"/>
 
1332
        <xsl:param name="type"/>
 
1333
        <target name="{$targetname}">
 
1334
            <xsl:attribute name="depends">init</xsl:attribute>
 
1335
            <xsl:attribute name="unless">no.deps</xsl:attribute>
 
1336
            
 
1337
            <xsl:variable name="references2" select="/p:project/p:configuration/projdeps2:references"/>
 
1338
            <xsl:for-each select="$references2/projdeps2:reference[not($type) or projdeps2:artifact-type = $type]">
 
1339
                <xsl:variable name="subproj" select="projdeps2:foreign-project"/>
 
1340
                <xsl:variable name="subtarget">
 
1341
                    <xsl:choose>
 
1342
                        <xsl:when test="$type">
 
1343
                            <xsl:value-of select="projdeps2:target"/>
 
1344
                        </xsl:when>
 
1345
                        <xsl:otherwise>
 
1346
                            <xsl:value-of select="projdeps2:clean-target"/>
 
1347
                        </xsl:otherwise>
 
1348
                    </xsl:choose>
 
1349
                </xsl:variable>
 
1350
                <xsl:variable name="script" select="projdeps2:script"/>
 
1351
                <xsl:choose>
 
1352
                    <xsl:when test="projdeps2:properties">
 
1353
                        <ant target="{$subtarget}" inheritall="false" antfile="{$script}">
 
1354
                            <xsl:for-each select="projdeps2:properties/projdeps2:property">
 
1355
                                <property name="{@name}" value="{.}"/>
 
1356
                            </xsl:for-each>
 
1357
                        </ant>
 
1358
                    </xsl:when>
 
1359
                    <xsl:otherwise>
 
1360
                        <ant target="{$subtarget}" inheritall="false" antfile="{$script}"/>
 
1361
                    </xsl:otherwise>
 
1362
                </xsl:choose>
 
1363
            </xsl:for-each>
 
1364
            
 
1365
            <xsl:variable name="references" select="/p:project/p:configuration/projdeps:references"/>
 
1366
            <xsl:for-each select="$references/projdeps:reference[not($type) or projdeps:artifact-type = $type]">
 
1367
                <xsl:variable name="subproj" select="projdeps:foreign-project"/>
 
1368
                <xsl:variable name="subtarget">
 
1369
                    <xsl:choose>
 
1370
                        <xsl:when test="$type">
 
1371
                            <xsl:value-of select="projdeps:target"/>
 
1372
                        </xsl:when>
 
1373
                        <xsl:otherwise>
 
1374
                            <xsl:value-of select="projdeps:clean-target"/>
 
1375
                        </xsl:otherwise>
 
1376
                    </xsl:choose>
 
1377
                </xsl:variable>
 
1378
                <xsl:variable name="script" select="projdeps:script"/>
 
1379
                <ant target="{$subtarget}" inheritall="false" antfile="${{project.{$subproj}}}/{$script}"/>
 
1380
            </xsl:for-each>
 
1381
            
 
1382
        </target>
 
1383
    </xsl:template>
 
1384
    
 
1385
    <xsl:template name="createRootAvailableTest">
 
1386
        <xsl:param name="roots"/>
 
1387
        <xsl:param name="propName"/>
 
1388
        <xsl:element name="condition">
 
1389
            <xsl:attribute name="property"><xsl:value-of select="$propName"/></xsl:attribute>
 
1390
            <or>
 
1391
                <xsl:for-each select="$roots/j2seproject3:root">
 
1392
                    <xsl:element name="available">
 
1393
                        <xsl:attribute name="file"><xsl:text>${</xsl:text><xsl:value-of select="@id"/><xsl:text>}</xsl:text></xsl:attribute>
 
1394
                    </xsl:element>
 
1395
                </xsl:for-each>
 
1396
            </or>
 
1397
        </xsl:element>
 
1398
    </xsl:template>
 
1399
    
 
1400
    <xsl:template name="createSourcePathValidityTest">
 
1401
        <xsl:param name="roots"/>
 
1402
        <xsl:for-each select="$roots/j2seproject3:root">
 
1403
            <xsl:element name="fail">
 
1404
                <xsl:attribute name="unless"><xsl:value-of select="@id"/></xsl:attribute>
 
1405
                <xsl:text>Must set </xsl:text><xsl:value-of select="@id"/>
 
1406
            </xsl:element>
 
1407
        </xsl:for-each>
 
1408
    </xsl:template>
 
1409
    
 
1410
    <xsl:template name="createFilesets">
 
1411
        <xsl:param name="roots"/>
 
1412
        <xsl:param name="includes" select="'${includes}'"/>
 
1413
        <xsl:param name="includes2"/>
 
1414
        <xsl:param name="excludes"/>
 
1415
        <xsl:for-each select="$roots/j2seproject3:root">
 
1416
            <xsl:element name="fileset">
 
1417
                <xsl:attribute name="dir"><xsl:text>${</xsl:text><xsl:value-of select="@id"/><xsl:text>}</xsl:text></xsl:attribute>
 
1418
                <xsl:attribute name="includes"><xsl:value-of select="$includes"/></xsl:attribute>
 
1419
                <xsl:choose>
 
1420
                    <xsl:when test="$excludes">
 
1421
                        <xsl:attribute name="excludes"><xsl:value-of select="$excludes"/>,${excludes}</xsl:attribute>
 
1422
                    </xsl:when>
 
1423
                    <xsl:otherwise>
 
1424
                        <xsl:attribute name="excludes">${excludes}</xsl:attribute>
 
1425
                    </xsl:otherwise>
 
1426
                </xsl:choose>
 
1427
                <xsl:if test="$includes2">
 
1428
                    <filename name="{$includes2}"/>
 
1429
                </xsl:if>
 
1430
            </xsl:element>
 
1431
        </xsl:for-each>
 
1432
    </xsl:template>
 
1433
    
 
1434
    <xsl:template name="createPackagesets">
 
1435
        <xsl:param name="roots"/>
 
1436
        <xsl:param name="includes" select="'${includes}'"/>
 
1437
        <xsl:param name="excludes"/>
 
1438
        <xsl:for-each select="$roots/j2seproject3:root">
 
1439
            <xsl:element name="packageset">
 
1440
                <xsl:attribute name="dir"><xsl:text>${</xsl:text><xsl:value-of select="@id"/><xsl:text>}</xsl:text></xsl:attribute>
 
1441
                <xsl:attribute name="includes"><xsl:value-of select="$includes"/></xsl:attribute>
 
1442
                <xsl:choose>
 
1443
                    <xsl:when test="$excludes">
 
1444
                        <xsl:attribute name="excludes"><xsl:value-of select="$excludes"/>,${excludes}</xsl:attribute>
 
1445
                    </xsl:when>
 
1446
                    <xsl:otherwise>
 
1447
                        <xsl:attribute name="excludes">${excludes}</xsl:attribute>
 
1448
                    </xsl:otherwise>
 
1449
                </xsl:choose>
 
1450
            </xsl:element>
 
1451
        </xsl:for-each>
 
1452
    </xsl:template>        
 
1453
    
 
1454
    <xsl:template name="createPathElements">
 
1455
        <xsl:param name="locations"/>
 
1456
        <xsl:for-each select="$locations/j2seproject3:root">
 
1457
            <xsl:element name="pathelement">
 
1458
                <xsl:attribute name="location"><xsl:text>${</xsl:text><xsl:value-of select="@id"/><xsl:text>}</xsl:text></xsl:attribute>
 
1459
            </xsl:element>
 
1460
        </xsl:for-each>
 
1461
    </xsl:template>
 
1462
    
 
1463
    <xsl:template name="createPath">
 
1464
        <xsl:param name="roots"/>
 
1465
        <xsl:for-each select="$roots/j2seproject3:root">
 
1466
            <xsl:if test="position() != 1">
 
1467
                <xsl:text>:</xsl:text>
 
1468
            </xsl:if>
 
1469
            <xsl:text>${</xsl:text>
 
1470
            <xsl:value-of select="@id"/>
 
1471
            <xsl:text>}</xsl:text>
 
1472
        </xsl:for-each>                                         
 
1473
    </xsl:template>
 
1474
    
 
1475
</xsl:stylesheet>