1
<?xml version="1.0" encoding="UTF-8"?>
3
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5
Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
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]"
28
The Original Software is NetBeans. The Initial Developer of the Original
29
Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
30
Microsystems, Inc. All Rights Reserved.
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.
44
<xsl:stylesheet version="1.0"
45
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
46
xmlns:p="http://www.netbeans.org/ns/project/1"
47
xmlns:xalan="http://xml.apache.org/xslt"
48
xmlns:archiveproject="http://www.netbeans.org/ns/archive-project/1"
49
xmlns:projdeps="http://www.netbeans.org/ns/ant-project-references/1"
50
exclude-result-prefixes="xalan p projdeps">
51
<xsl:output method="xml" indent="yes" encoding="UTF-8" xalan:indent-amount="4"/>
52
<xsl:template match="/">
54
<xsl:comment><![CDATA[
55
*** GENERATED FROM project.xml - DO NOT EDIT ***
56
*** EDIT ../build.xml INSTEAD ***
58
For the purpose of easier reading the script
59
is divided into following sections:
73
<xsl:variable name="name" select="/p:project/p:configuration/archiveproject:data/archiveproject:name"/>
74
<!-- Synch with build-impl.xsl: -->
75
<xsl:variable name="codename" select="translate($name, ' ', '_')"/>
76
<project name="{$codename}-impl">
77
<xsl:attribute name="default">build</xsl:attribute>
78
<xsl:attribute name="basedir">..</xsl:attribute>
79
<import file="ant-deploy.xml" />
81
<target name="default">
82
<xsl:attribute name="depends">dist</xsl:attribute>
83
<xsl:attribute name="description">Build whole project.</xsl:attribute>
87
======================
88
INITIALIZATION SECTION
89
======================
92
<target name="-pre-init">
93
<xsl:comment> Empty placeholder for easier customization. </xsl:comment>
94
<xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
97
<target name="-init-private">
98
<xsl:attribute name="depends">-pre-init</xsl:attribute>
99
<property file="nbproject/private/private.properties"/>
102
<target name="-init-user">
103
<xsl:attribute name="depends">-pre-init,-init-private</xsl:attribute>
104
<property file="${{user.properties.file}}"/>
105
<xsl:comment> The two properties below are usually overridden </xsl:comment>
106
<xsl:comment> by the active platform. Just a fallback. </xsl:comment>
107
<property name="default.javac.source" value="1.4"/>
108
<property name="default.javac.target" value="1.4"/>
111
<target name="-init-project">
112
<xsl:attribute name="depends">-pre-init,-init-private,-init-user</xsl:attribute>
113
<property file="nbproject/project.properties"/>
116
<target name="-do-ear-init">
117
<xsl:attribute name="depends">-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property</xsl:attribute>
118
<xsl:attribute name="if">dist.ear.dir</xsl:attribute>
119
<property value="${{build.ear.web.dir}}/META-INF" name="build.meta.inf.dir"/>
120
<property name="build.classes.dir.real" value="${{build.ear.classes.dir}}"/>
121
<property name="build.web.dir.real" value="${{build.ear.web.dir}}"/>
124
<target name="-do-init">
125
<xsl:attribute name="depends">-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property, -do-ear-init</xsl:attribute>
126
<xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:explicit-platform">
127
<archiveproject:property name="platform.home" value="platforms.${{platform.active}}.home"/>
128
<archiveproject:property name="platform.bootcp" value="platforms.${{platform.active}}.bootclasspath"/>
129
<archiveproject:property name="platform.compiler" value="platforms.${{platform.active}}.compile"/>
130
<archiveproject:property name="platform.javac.tmp" value="platforms.${{platform.active}}.javac"/>
131
<condition property="platform.javac" value="${{platform.home}}/bin/javac">
132
<equals arg1="${{platform.javac.tmp}}" arg2="$${{platforms.${{platform.active}}.javac}}"/>
134
<property name="platform.javac" value="${{platform.javac.tmp}}"/>
135
<archiveproject:property name="platform.java.tmp" value="platforms.${{platform.active}}.java"/>
136
<condition property="platform.java" value="${{platform.home}}/bin/java">
137
<equals arg1="${{platform.java.tmp}}" arg2="$${{platforms.${{platform.active}}.java}}"/>
139
<property name="platform.java" value="${{platform.java.tmp}}"/>
141
<fail unless="platform.home">Must set platform.home</fail>
142
<fail unless="platform.bootcp">Must set platform.bootcp</fail>
143
<fail unless="platform.java">Must set platform.java</fail>
144
<fail unless="platform.javac">Must set platform.javac</fail>
145
<fail if="platform.invalid">Platform is not correctly set up</fail>
148
<xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:use-manifest">
150
<fail unless="manifest.file">Must set manifest.file</fail>
153
<xsl:call-template name="createRootAvailableTest">
154
<xsl:with-param name="roots" select="/p:project/p:configuration/archiveproject:data/archiveproject:test-roots"/>
155
<xsl:with-param name="propName">have.tests</xsl:with-param>
157
<xsl:call-template name="createRootAvailableTest">
158
<xsl:with-param name="roots" select="/p:project/p:configuration/archiveproject:data/archiveproject:source-roots"/>
159
<xsl:with-param name="propName">have.sources</xsl:with-param>
161
<condition property="netbeans.home+have.tests">
163
<isset property="netbeans.home"/>
164
<isset property="have.tests"/>
167
<property name="javac.compilerargs" value=""/>
168
<condition property="no.deps">
170
<istrue value="${{no.dependencies}}"/>
173
<condition property="no.dist.ear.dir">
175
<isset property="dist.ear.dir"/>
178
<property name="build.web.excludes" value="${{build.classes.excludes}}"/>
179
<condition property="do.compile.jsps">
180
<istrue value="${{compile.jsps}}"/>
182
<condition property="do.display.browser">
183
<istrue value="${{display.browser}}"/>
185
<available file="${{conf.dir}}/MANIFEST.MF" property="has.custom.manifest"/>
186
<available file="${{conf.dir}}/persistence.xml" property="has.persistence.xml"/>
188
<condition property="do.war.package.with.custom.manifest">
190
<istrue value="${{war.package}}"/>
191
<isset property="has.custom.manifest"/>
194
<condition property="do.war.package.without.custom.manifest">
196
<istrue value="${{war.package}}"/>
198
<isset property="has.custom.manifest"/>
203
<property value="${{build.web.dir}}/META-INF" name="build.meta.inf.dir"/>
204
<property name="build.classes.dir.real" value="${{build.classes.dir}}"/>
205
<property name="build.web.dir.real" value="${{build.web.dir}}"/>
206
<property name="dist.archive" value="${{dist.dir}}/${{war.name}}"/>
209
<target name="-post-init">
210
<xsl:comment> Empty placeholder for easier customization. </xsl:comment>
211
<xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
214
<target name="-init-check">
215
<xsl:attribute name="depends">-pre-init,-init-private,-init-user,-init-project,-do-init</xsl:attribute>
216
<!-- XXX XSLT 2.0 would make it possible to use a for-each here -->
217
<!-- Note that if the properties were defined in project.xml that would be easy -->
218
<!-- But required props should be defined by the AntBasedProjectType, not stored in each project -->
219
<xsl:call-template name="createSourcePathValidityTest">
220
<xsl:with-param name="roots" select="/p:project/p:configuration/archiveproject:data/archiveproject:source-roots"/>
222
<xsl:call-template name="createSourcePathValidityTest">
223
<xsl:with-param name="roots" select="/p:project/p:configuration/archiveproject:data/archiveproject:test-roots"/>
226
<fail unless="build.dir">Must set build.dir</fail>
227
<fail unless="build.web.dir">Must set build.web.dir</fail>
228
<fail unless="build.generated.dir">Must set build.generated.dir</fail>
229
<fail unless="dist.dir">Must set dist.dir</fail>
230
<fail unless="build.classes.dir">Must set build.classes.dir</fail>
231
<fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
232
<fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
233
<fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
234
<fail unless="dist.war">Must set dist.war</fail>
238
<target name="-init-macrodef-property">
240
<xsl:attribute name="name">property</xsl:attribute>
241
<xsl:attribute name="uri">http://www.netbeans.org/ns/web-project/1</xsl:attribute>
243
<xsl:attribute name="name">name</xsl:attribute>
246
<xsl:attribute name="name">value</xsl:attribute>
249
<property name="@{{name}}" value="${{@{{value}}}}"/>
254
<target name="-init-macrodef-javac">
256
<xsl:attribute name="name">javac</xsl:attribute>
257
<xsl:attribute name="uri">http://www.netbeans.org/ns/web-project/2</xsl:attribute>
259
<xsl:attribute name="name">srcdir</xsl:attribute>
260
<xsl:attribute name="default">
261
<xsl:call-template name="createPath">
262
<xsl:with-param name="roots" select="/p:project/p:configuration/archiveproject:data/archiveproject:source-roots"/>
267
<xsl:attribute name="name">destdir</xsl:attribute>
268
<xsl:attribute name="default">${build.classes.dir.real}</xsl:attribute>
271
<xsl:attribute name="name">classpath</xsl:attribute>
272
<xsl:attribute name="default">${javac.classpath}:${j2ee.platform.classpath}</xsl:attribute>
275
<xsl:attribute name="name">debug</xsl:attribute>
276
<xsl:attribute name="default">${javac.debug}</xsl:attribute>
279
<xsl:attribute name="name">customize</xsl:attribute>
280
<xsl:attribute name="optional">true</xsl:attribute>
284
<xsl:attribute name="srcdir">@{srcdir}</xsl:attribute>
285
<xsl:attribute name="destdir">@{destdir}</xsl:attribute>
286
<xsl:attribute name="debug">@{debug}</xsl:attribute>
287
<xsl:attribute name="deprecation">${javac.deprecation}</xsl:attribute>
288
<xsl:if test ="not(/p:project/p:configuration/archiveproject:data/archiveproject:explicit-platform/@explicit-source-supported ='false')">
289
<xsl:attribute name="source">${javac.source}</xsl:attribute>
290
<xsl:attribute name="target">${javac.target}</xsl:attribute>
292
<xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:explicit-platform">
293
<xsl:attribute name="fork">yes</xsl:attribute>
294
<xsl:attribute name="executable">${platform.javac}</xsl:attribute>
295
<xsl:attribute name="tempdir">${java.io.tmpdir}</xsl:attribute> <!-- XXX cf. #51482, Ant #29391 -->
297
<xsl:attribute name="includeantruntime">false</xsl:attribute>
299
<path path="@{{classpath}}"/>
301
<compilerarg line="${{javac.compilerargs}}"/>
308
<target name="-init-macrodef-junit">
310
<xsl:attribute name="name">junit</xsl:attribute>
311
<xsl:attribute name="uri">http://www.netbeans.org/ns/web-project/2</xsl:attribute>
313
<xsl:attribute name="name">includes</xsl:attribute>
314
<xsl:attribute name="default">**/*Test.java</xsl:attribute>
318
<xsl:attribute name="showoutput">true</xsl:attribute>
319
<xsl:attribute name="fork">true</xsl:attribute>
320
<xsl:attribute name="dir">${basedir}</xsl:attribute> <!-- #47474: match <java> -->
321
<xsl:attribute name="failureproperty">tests.failed</xsl:attribute>
322
<xsl:attribute name="errorproperty">tests.failed</xsl:attribute>
323
<xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:explicit-platform">
324
<xsl:attribute name="jvm">${platform.java}</xsl:attribute>
326
<batchtest todir="${{build.test.results.dir}}">
327
<xsl:call-template name="createFilesets">
328
<xsl:with-param name="roots" select="/p:project/p:configuration/archiveproject:data/archiveproject:test-roots"/>
329
<xsl:with-param name="includes">@{includes}</xsl:with-param>
333
<path path="${{run.test.classpath}}"/>
336
<propertyref prefix="test-sys-prop."/>
337
<mapper type="glob" from="test-sys-prop.*" to="*"/>
339
<formatter type="brief" usefile="false"/>
340
<formatter type="xml"/>
346
<target name="-init-macrodef-java">
348
<xsl:attribute name="name">java</xsl:attribute>
349
<xsl:attribute name="uri">http://www.netbeans.org/ns/web-project/1</xsl:attribute>
351
<xsl:attribute name="name">classname</xsl:attribute>
352
<xsl:attribute name="default">${main.class}</xsl:attribute>
355
<xsl:attribute name="name">customize</xsl:attribute>
356
<xsl:attribute name="optional">true</xsl:attribute>
359
<java fork="true" classname="@{{classname}}">
360
<xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:explicit-platform">
361
<xsl:attribute name="jvm">${platform.java}</xsl:attribute>
363
<jvmarg line="${{runmain.jvmargs}}"/>
365
<path path="${{build.classes.dir.real}}:${{javac.classpath}}:${{j2ee.platform.classpath}}"/>
368
<propertyref prefix="run-sys-prop."/>
369
<mapper type="glob" from="run-sys-prop.*" to="*"/>
377
<target name="-init-macrodef-nbjpda">
379
<xsl:attribute name="name">nbjpdastart</xsl:attribute>
380
<xsl:attribute name="uri">http://www.netbeans.org/ns/web-project/1</xsl:attribute>
382
<xsl:attribute name="name">name</xsl:attribute>
383
<xsl:attribute name="default">${main.class}</xsl:attribute>
386
<xsl:attribute name="name">classpath</xsl:attribute>
387
<xsl:attribute name="default">${debug.classpath}</xsl:attribute>
390
<nbjpdastart transport="dt_socket" addressproperty="jpda.address" name="@{{name}}">
392
<path path="@{{classpath}}"/>
394
<xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:explicit-platform">
396
<path path="${{platform.bootcp}}"/>
403
<xsl:attribute name="name">nbjpdareload</xsl:attribute>
404
<xsl:attribute name="uri">http://www.netbeans.org/ns/web-project/1</xsl:attribute>
406
<xsl:attribute name="name">dir</xsl:attribute>
407
<xsl:attribute name="default">${build.classes.dir.real}</xsl:attribute>
411
<fileset includes="${{fix.includes}}*.class" dir="@{{dir}}"/>
417
<target name="-init-debug-args">
419
<xsl:when test="/p:project/p:configuration/archiveproject:data/archiveproject:explicit-platform">
420
<exec executable="${{platform.java}}" outputproperty="version-output">
421
<arg value="-version"/>
425
<property name="version-output" value="java version "${{ant.java.version}}"/>
428
<condition property="have-jdk-older-than-1.4">
429
<!-- <matches pattern="^java version "1\.[0-3]" string="${version-output}"/> (ANT 1.7) -->
431
<contains string="${{version-output}}" substring="java version "1.0"/>
432
<contains string="${{version-output}}" substring="java version "1.1"/>
433
<contains string="${{version-output}}" substring="java version "1.2"/>
434
<contains string="${{version-output}}" substring="java version "1.3"/>
437
<condition property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none" else="-Xdebug">
438
<istrue value="${{have-jdk-older-than-1.4}}"/>
442
<target name="-init-macrodef-debug" depends="-init-debug-args">
444
<xsl:attribute name="name">debug</xsl:attribute>
445
<xsl:attribute name="uri">http://www.netbeans.org/ns/web-project/1</xsl:attribute>
447
<xsl:attribute name="name">classname</xsl:attribute>
448
<xsl:attribute name="default">${main.class}</xsl:attribute>
451
<xsl:attribute name="name">classpath</xsl:attribute>
452
<xsl:attribute name="default">${debug.classpath}</xsl:attribute>
455
<xsl:attribute name="name">args</xsl:attribute>
456
<xsl:attribute name="default">${application.args}</xsl:attribute>
459
<java fork="true" classname="@{{classname}}">
460
<xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:explicit-platform">
461
<xsl:attribute name="jvm">${platform.java}</xsl:attribute>
463
<jvmarg line="${{debug-args-line}}"/>
464
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${{jpda.address}}"/>
465
<jvmarg line="${{runmain.jvmargs}}"/>
467
<path path="@{{classpath}}"/>
470
<propertyref prefix="run-sys-prop."/>
471
<mapper type="glob" from="run-sys-prop.*" to="*"/>
473
<arg line="@{{args}}"/>
479
<target name="-init-macrodef-copy-ear-war">
480
<macrodef name="copy-ear-war">
481
<attribute name="file"/>
482
<attribute name="propname"/>
484
<property name="temp.dirname" value="${{dist.ear.dir}}/temp"/>
485
<mkdir dir="${{dist.ear.dir}}/temp"/>
486
<basename property="base_@{{propname}}" file="@{{file}}"/>
487
<unzip src="@{{file}}" dest="${{temp.dirname}}">
489
<include name="META-INF/tlds/*.tld"/>
492
<available file="${{temp.dirname}}/META-INF/tlds" type="dir" property="hastlds_@{{propname}}"/>
493
<condition value="${{build.web.dir.real}}/WEB-INF/lib" property="copy.to.dir_@{{propname}}">
494
<isset property="hastlds_@{{propname}}"/>
496
<condition value="${{dist.ear.dir}}" property="copy.to.dir_@{{propname}}">
498
<isset property="hastlds_@{{propname}}"/>
501
<copy file="@{{file}}" todir="${{copy.to.dir_@{{propname}}}}"/>
502
<!--manifest handling-->
503
<condition value="${{base_@{{propname}}}}" property="@{{propname}}">
505
<isset property="hastlds_@{{propname}}"/>
508
<condition value="" property="@{{propname}}">
509
<isset property="hastlds_@{{propname}}"/>
511
<delete dir="${{dist.ear.dir}}/temp"/>
517
<xsl:attribute name="depends">-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-java,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-copy-ear-war</xsl:attribute>
521
======================
523
======================
525
<target name="-pre-pre-compile">
526
<xsl:attribute name="depends">init<xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:web-service-clients/archiveproject:web-service-client">,web-service-client-generate</xsl:if></xsl:attribute>
527
<mkdir dir="${{build.classes.dir.real}}"/>
530
<target name="-pre-compile">
531
<xsl:comment> Empty placeholder for easier customization. </xsl:comment>
532
<xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
535
<target name="-copy-webdir">
536
<copy todir="${{build.web.dir.real}}">
537
<fileset excludes="${{build.web.excludes}}" dir="${{web.docbase.dir}}">
538
<xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:web-services/archiveproject:web-service">
539
<xsl:attribute name="excludes">WEB-INF/classes/** WEB-INF/web.xml WEB/sun-web.xml</xsl:attribute>
544
<xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:web-services/archiveproject:web-service">
545
<xsl:comment>For web services, refresh web.xml and sun-web.xml</xsl:comment>
546
<copy todir="${{build.web.dir.real}}" overwrite="true">
547
<fileset includes="WEB-INF/web.xml WEB-INF/sun-web.xml" dir="${{web.docbase.dir}}"/>
552
<target name="-do-compile">
553
<xsl:attribute name="depends">init, -pre-pre-compile, -pre-compile, -copy-manifest, -copy-webdir</xsl:attribute>
554
<xsl:attribute name="if">have.sources</xsl:attribute>
556
<archiveproject:javac destdir="${{build.classes.dir.real}}"/>
558
<copy todir="${{build.classes.dir.real}}">
559
<xsl:call-template name="createFilesets">
560
<xsl:with-param name="roots" select="/p:project/p:configuration/archiveproject:data/archiveproject:source-roots"/>
561
<xsl:with-param name="excludes">${build.classes.excludes}</xsl:with-param>
566
<target name="-copy-manifest" if="has.custom.manifest">
567
<mkdir dir="${{build.meta.inf.dir}}"/>
568
<copy todir="${{build.meta.inf.dir}}">
569
<fileset dir="${{conf.dir}}" includes="MANIFEST.MF"/>
573
<target name="-post-compile">
574
<xsl:if test="/p:project/p:configuration/archiveproject:data/archiveproject:web-services/archiveproject:web-service">
575
<xsl:attribute name="depends">
576
<xsl:for-each select="/p:project/p:configuration/archiveproject:data/archiveproject:web-services/archiveproject:web-service">
577
<xsl:if test="position()!=1"><xsl:text>, </xsl:text>
580
<xsl:when test="not(archiveproject:from-wsdl)">
581
<xsl:value-of select="archiveproject:web-service-name"/><xsl:text>_wscompile</xsl:text>
584
<xsl:text>fromwsdl-noop</xsl:text>
590
<xsl:comment> Empty placeholder for easier customization. </xsl:comment>
591
<xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
594
<target name="compile">
595
<xsl:attribute name="depends">init,-pre-pre-compile,-pre-compile,-do-compile,-post-compile</xsl:attribute>
596
<xsl:attribute name="description">Compile project.</xsl:attribute>
600
======================
601
DIST BUILDING SECTION
602
======================
605
<target name="-pre-dist">
606
<xsl:comment> Empty placeholder for easier customization. </xsl:comment>
607
<xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
611
<target name="-do-dist">
612
<mkdir dir="${{dist.dir}}"/>
613
<jar jarfile="${{dist.archive}}">
614
<fileset dir="${{content.dir}}"/>
618
<target name="-post-dist">
619
<xsl:comment> Empty placeholder for easier customization. </xsl:comment>
620
<xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
624
<xsl:attribute name="depends">init,-pre-dist,-do-dist,-post-dist</xsl:attribute>
625
<xsl:attribute name="description">Build distribution (WAR).</xsl:attribute>
629
======================
631
======================
634
<target name="run-deploy">
635
<xsl:attribute name="depends">init,dist,-run-deploy-nb,-init-deploy-ant,-deploy-ant</xsl:attribute>
638
<target name="-run-deploy-nb" if="netbeans.home">
639
<nbdeploy debugmode="false" clientUrlPart="${{client.urlPart}}" forceRedeploy="${{forceRedeploy}}"/>
642
<target name="-init-deploy-ant" unless="netbeans.home">
643
<property name="deploy.ant.archive" value="${{dist.archive}}"/>
644
<property name="deploy.ant.docbase.dir" value="${{web.docbase.dir}}"/>
645
<property name="deploy.ant.resource.dir" value="${{resource.dir}}"/>
646
<property name="deploy.ant.enabled" value="true"/>
649
<target name="run-undeploy">
650
<xsl:attribute name="depends">dist,-run-undeploy-nb,-init-deploy-ant,-undeploy-ant</xsl:attribute>
653
<target name="-run-undeploy-nb" if="netbeans.home">
654
<fail message="Undeploy is not supported from within the IDE"/>
657
<target name="verify">
658
<xsl:attribute name="depends">init,dist</xsl:attribute>
659
<nbverify file="${{dist.archive}}"/>
666
======================
668
======================
671
<xsl:call-template name="deps.target">
672
<xsl:with-param name="targetname" select="'deps-clean'"/>
675
<target name="do-clean">
676
<xsl:attribute name="depends">init</xsl:attribute>
678
<condition value="${{build.web.dir.real}}" property="build.dir.to.clean">
679
<isset property="dist.ear.dir"/>
681
<property value="${{build.web.dir.real}}" name="build.dir.to.clean"/>
683
<delete includeEmptyDirs="true" quiet="true">
684
<fileset dir="${{build.dir.to.clean}}/WEB-INF/lib"/>
686
<delete includeEmptyDirs="true">
688
<include name="${{build.dir}}/**"/>
689
<exclude name="${{build.dir.to.clean}}/WEB-INF/lib/**"/>
692
<available file="${{build.dir.to.clean}}/WEB-INF/lib" type="dir" property="status.clean-failed"/>
693
<delete dir="${{dist.dir}}"/>
694
<!-- XXX explicitly delete all build.* and dist.* dirs in case they are not subdirs -->
696
<delete dir="${{build.generated.dir}}"/>
697
<delete dir="${{build.web.dir.real}}"/>
701
<target name="check-clean">
702
<xsl:attribute name="depends">do-clean</xsl:attribute>
703
<xsl:attribute name="if">status.clean-failed</xsl:attribute>
705
When undeploy is implemented it should be optional:
706
<xsl:attribute name="unless">clean.check.skip</xsl:attribute>
708
<echo message="Warning: unable to delete some files in ${{build.web.dir.real}}/WEB-INF/lib - they are probably locked by the J2EE server. " />
709
<echo level="info" message="To delete all files undeploy the module from Server Registry in Runtime tab and then use Clean again."/>
711
Here comes the undeploy code when supported by nbdeploy task:
712
<nbdeploy undeploy="true" clientUrlPart="${client.urlPart}"/>
713
And then another attempt to delete:
714
<delete dir="${{build.web.dir.real}}/WEB-INF/lib"/>
718
<target name="-post-clean">
719
<xsl:comment> Empty placeholder for easier customization. </xsl:comment>
720
<xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
723
<target name="clean">
724
<xsl:attribute name="depends">init,deps-clean,do-clean,check-clean,-post-clean</xsl:attribute>
725
<xsl:attribute name="description">Clean build products.</xsl:attribute>
728
<target name="clean-ear">
729
<xsl:attribute name="depends">clean</xsl:attribute>
730
<xsl:attribute name="description">Clean build products.</xsl:attribute>
737
Could pass <propertyset> to run, debug, etc. under Ant 1.6,
738
optionally, by doing e.g.
741
<propertyref prefix="sysprop."/>
742
<mapper type="glob" from="sysprop.*" to="*"/>
745
Now user can add to e.g. project.properties e.g.:
746
sysprop.org.netbeans.modules.javahelp=0
748
-Dorg.netbeans.modules.javahelp=0
755
Generic template to build subdependencies of a certain type.
756
Feel free to copy into other modules.
757
@param targetname required name of target to generate
758
@param type artifact-type from project.xml to filter on; optional, if not specified, uses
759
all references, and looks for clean targets rather than build targets
760
@return an Ant target which builds (or cleans) all known subprojects
762
<xsl:template name="deps.target">
763
<xsl:param name="targetname"/>
764
<xsl:param name="type"/>
765
<xsl:param name="ear"/>
766
<target name="{$targetname}">
767
<xsl:attribute name="depends">init</xsl:attribute>
770
<xsl:when test="$ear">
771
<xsl:attribute name="if">dist.ear.dir</xsl:attribute>
772
<xsl:attribute name="unless">no.deps</xsl:attribute>
775
<xsl:attribute name="if">no.dist.ear.dir</xsl:attribute>
776
<xsl:attribute name="unless">no.deps</xsl:attribute>
780
<xsl:variable name="references" select="/p:project/p:configuration/projdeps:references"/>
781
<xsl:for-each select="$references/projdeps:reference[not($type) or projdeps:artifact-type = $type]">
782
<xsl:variable name="subproj" select="projdeps:foreign-project"/>
783
<xsl:variable name="subtarget">
785
<xsl:when test="$type">
786
<xsl:value-of select="projdeps:target"/>
789
<xsl:value-of select="projdeps:clean-target"/>
793
<xsl:variable name="script" select="projdeps:script"/>
794
<!-- Distinguish build of a dependent project as standalone module or as a part of an ear -->
796
<xsl:when test="$ear">
798
<!-- call standart target if the artifact type is jar (java libraries) -->
799
<xsl:when test="$subtarget = 'jar'">
800
<ant target="{$subtarget}" inheritall="false" antfile="${{project.{$subproj}}}/{$script}"/>
803
<ant target="dist-ear" inheritall="false" antfile="${{project.{$subproj}}}/{$script}">
804
<property name="dist.ear.dir" location="${{build.dir}}"/>
810
<ant target="{$subtarget}" inheritall="false" antfile="${{project.{$subproj}}}/{$script}"/>
818
<xsl:template name="createRootAvailableTest">
819
<xsl:param name="roots"/>
820
<xsl:param name="propName"/>
821
<xsl:element name="condition">
822
<xsl:attribute name="property"><xsl:value-of select="$propName"/></xsl:attribute>
824
<xsl:for-each select="$roots/archiveproject:root">
825
<xsl:element name="available">
826
<xsl:attribute name="file"><xsl:text>${</xsl:text><xsl:value-of select="@id"/><xsl:text>}</xsl:text></xsl:attribute>
833
<xsl:template name="createSourcePathValidityTest">
834
<xsl:param name="roots"/>
835
<xsl:for-each select="$roots/archiveproject:root">
836
<xsl:element name="fail">
837
<xsl:attribute name="unless"><xsl:value-of select="@id"/></xsl:attribute>
838
<xsl:text>Must set </xsl:text><xsl:value-of select="@id"/>
843
<xsl:template name="createFilesets">
844
<xsl:param name="roots"/>
845
<xsl:param name="includes"/>
846
<xsl:param name="excludes"/>
847
<xsl:for-each select="$roots/archiveproject:root">
848
<xsl:element name="fileset">
849
<xsl:attribute name="dir"><xsl:text>${</xsl:text><xsl:value-of select="@id"/><xsl:text>}</xsl:text></xsl:attribute>
850
<xsl:if test="$includes">
851
<xsl:attribute name="includes"><xsl:value-of select="$includes"/></xsl:attribute>
853
<xsl:if test="$excludes">
854
<xsl:attribute name="excludes"><xsl:value-of select="$excludes"/></xsl:attribute>
860
<xsl:template name="createPackagesets">
861
<xsl:param name="roots"/>
862
<xsl:param name="includes"/>
863
<xsl:param name="excludes"/>
864
<xsl:for-each select="$roots/archiveproject:root">
865
<xsl:element name="packageset">
866
<xsl:attribute name="dir"><xsl:text>${</xsl:text><xsl:value-of select="@id"/><xsl:text>}</xsl:text></xsl:attribute>
867
<xsl:if test="$includes">
868
<xsl:attribute name="includes"><xsl:value-of select="$includes"/></xsl:attribute>
870
<xsl:if test="$excludes">
871
<xsl:attribute name="excludes"><xsl:value-of select="$excludes"/></xsl:attribute>
877
<xsl:template name="createPathElements">
878
<xsl:param name="locations"/>
879
<xsl:for-each select="$locations/archiveproject:root">
880
<xsl:element name="pathelement">
881
<xsl:attribute name="location"><xsl:text>${</xsl:text><xsl:value-of select="@id"/><xsl:text>}</xsl:text></xsl:attribute>
886
<xsl:template name="createPath">
887
<xsl:param name="roots"/>
888
<xsl:for-each select="$roots/archiveproject:root">
889
<xsl:if test="position() != 1">
890
<xsl:text>:</xsl:text>
892
<xsl:text>${</xsl:text>
893
<xsl:value-of select="@id"/>
894
<xsl:text>}</xsl:text>
898
<xsl:template name="manifestBasenameIterateFiles" >
899
<xsl:param name="property"/>
900
<xsl:param name="files" /><!-- number of files in the libfile property -->
901
<xsl:param name="libfile"/>
902
<xsl:if test="$files > 0">
903
<xsl:variable name="fileNo" select="$files+(-1)"/>
904
<xsl:variable name="lib" select="concat(substring-before($libfile,'}'),'.libfile.',$files,'}')"/>
905
<xsl:variable name="propertyName" select="concat($property, '.', $fileNo+1)"/>
906
<basename property="{$propertyName}" file="{$lib}"/>
907
<xsl:call-template name="manifestBasenameIterateFiles">
908
<xsl:with-param name="files" select="$fileNo"/>
909
<xsl:with-param name="libfile" select="$libfile"/>
910
<xsl:with-param name="property" select="$property"/>
915
<xsl:template name="manifestPrintEntriesIterateFiles" >
916
<xsl:param name="property"/>
917
<xsl:param name="files" /><!-- number of files in the libfile property -->
918
<xsl:param name="libfile"/>
919
<xsl:if test="$files > 0">
920
<xsl:call-template name="manifestPrintEntriesIterateFilesIncreasingOrder">
921
<xsl:with-param name="files" select="$files"/>
922
<xsl:with-param name="libfile" select="$libfile"/>
923
<xsl:with-param name="index" select="1"/>
924
<xsl:with-param name="property" select="$property"/>
929
<xsl:template name="manifestPrintEntriesIterateFilesIncreasingOrder" >
930
<xsl:param name="property"/>
931
<xsl:param name="files" /><!-- number of files in the libfile property -->
932
<xsl:param name="index" /><!-- index of file in libfile property -->
933
<xsl:param name="libfile"/>
934
<xsl:if test="$files > 0">
935
<xsl:variable name="propertyName" select="concat($property, '.', $index)"/>
936
<xsl:text>${</xsl:text><xsl:value-of select="$propertyName"/><xsl:text>.X} </xsl:text>
937
<xsl:call-template name="manifestPrintEntriesIterateFilesIncreasingOrder">
938
<xsl:with-param name="files" select="$files+(-1)"/>
939
<xsl:with-param name="index" select="$index+1"/>
940
<xsl:with-param name="libfile" select="$libfile"/>
941
<xsl:with-param name="property" select="$property"/>
946
<xsl:template name="copyIterateFiles" >
947
<xsl:param name="files" />
948
<xsl:param name="target"/>
949
<xsl:param name="libfile"/>
950
<xsl:param name="ear"/>
951
<xsl:param name="property"/>
952
<xsl:if test="$files > 0">
953
<xsl:variable name="fileNo" select="$files+(-1)"/>
954
<xsl:variable name="lib" select="concat(substring-before($libfile,'}'),'.libfile.',$files,'}')"/>
956
<xsl:variable name="propertyName" select="concat($property, '.', $files, '.X')"/>
957
<xsl:if test="$ear='true'">
958
<copy-ear-war file="{$lib}" propname="{$propertyName}"/>
961
<xsl:if test="$ear!='true'">
962
<copy file="{$lib}" todir="{$target}"/>
965
<xsl:call-template name="copyIterateFiles">
966
<xsl:with-param name="files" select="$fileNo"/>
967
<xsl:with-param name="target" select="$target"/>
968
<xsl:with-param name="libfile" select="$libfile"/>
969
<xsl:with-param name="ear" select="$ear"/>
970
<xsl:with-param name="property" select="$property"/>
975
<xsl:template name="copyIterateDirs" >
976
<xsl:param name="files" />
977
<xsl:param name="target"/>
978
<xsl:param name="libfile"/>
979
<xsl:if test="$files > 0">
980
<xsl:variable name="fileNo" select="$files+(-1)"/>
981
<xsl:variable name="lib" select="concat(substring-before($libfile,'}'),'.libdir.',$files,'}')"/>
982
<copy todir="{$target}">
983
<fileset dir="{$lib}" includes="**/*"/>
985
<xsl:call-template name="copyIterateDirs">
986
<xsl:with-param name="files" select="$fileNo"/>
987
<xsl:with-param name="target" select="$target"/>
988
<xsl:with-param name="libfile" select="$libfile"/>