1
<?xml version="1.0" encoding="UTF-8"?>
3
Sun Public License Notice
5
The contents of this file are subject to the Sun Public License
6
Version 1.0 (the "License"). You may not use this file except in
7
compliance with the License. A copy of the License is available at
10
The Original Code is NetBeans. The Initial Developer of the Original
11
Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
12
Microsystems, Inc. All Rights Reserved.
14
If you wish your version of this file to be governed by only the CDDL
15
or only the GPL Version 2, indicate your decision by adding
16
"[Contributor] elects to include this software in this distribution
17
under the [CDDL or GPL Version 2] license." If you do not indicate a
18
single choice of license, a recipient has the option to distribute
19
your version of this file under either the CDDL, the GPL Version 2 or
20
to extend the choice of license to its licensees as provided above.
21
However, if you add GPL Version 2 code and therefore, elected the GPL
22
Version 2 license, then the option applies only if the new code is
23
made subject to such option by the copyright holder.
25
<xsl:stylesheet version="1.0"
26
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
27
xmlns:p="http://www.netbeans.org/ns/project/1"
28
xmlns:xalan="http://xml.apache.org/xslt"
29
xmlns:groovy="http://www.netbeans.org/ns/groovy-project/1"
30
xmlns:groovyproject="http://www.netbeans.org/ns/groovy-project/1"
31
xmlns:projdeps="http://www.netbeans.org/ns/ant-project-references/1"
32
exclude-result-prefixes="xalan p groovy projdeps">
33
<!-- XXX should use namespaces for NB in-VM tasks from ant/browsetask and debuggerjpda/ant (Ant 1.6.1 and higher only) -->
34
<xsl:output method="xml" indent="yes" encoding="UTF-8" xalan:indent-amount="4"/>
35
<xsl:template match="/">
37
<xsl:comment><![CDATA[
38
*** GENERATED FROM project.xml - DO NOT EDIT ***
39
*** EDIT ../build.xml INSTEAD ***
41
For the purpose of easier reading the script
42
is divided into following sections:
52
<xsl:variable name="name" select="/p:project/p:configuration/groovyproject:data/groovyproject:name"/>
53
<!-- Synch with build-impl.xsl: -->
54
<xsl:variable name="codename" select="translate($name, ' ', '_')"/>
55
<project name="{$codename}-impl">
56
<xsl:attribute name="default">build</xsl:attribute>
57
<xsl:attribute name="basedir">..</xsl:attribute>
59
<target name="default">
60
<xsl:attribute name="depends">jar</xsl:attribute>
61
<xsl:attribute name="description">Build the whole project.</xsl:attribute>
65
======================
66
INITIALIZATION SECTION
67
======================
70
<target name="-pre-init">
71
<xsl:comment> Empty placeholder for easier customization. </xsl:comment>
72
<xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
75
<target name="-init-private">
76
<xsl:attribute name="depends">-pre-init</xsl:attribute>
77
<property file="nbproject/private/private.properties"/>
80
<target name="-init-user">
81
<xsl:attribute name="depends">-pre-init,-init-private</xsl:attribute>
82
<property file="${{user.properties.file}}"/>
83
<xsl:comment> The two properties below are usually overridden </xsl:comment>
84
<xsl:comment> by the active platform. Just a fallback. </xsl:comment>
85
<property name="default.javac.source" value="1.4"/>
86
<property name="default.javac.target" value="1.4"/>
89
<target name="-init-project">
90
<xsl:attribute name="depends">-pre-init,-init-private,-init-user</xsl:attribute>
91
<property file="nbproject/project.properties"/>
94
<target name="-do-init">
95
<xsl:attribute name="depends">-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property</xsl:attribute>
96
<xsl:if test="/p:project/p:configuration/groovy:data/groovy:explicit-platform">
97
<groovyproject:property name="platform.home" value="platforms.${{platform.active}}.home"/>
98
<groovyproject:property name="platform.bootcp" value="platforms.${{platform.active}}.bootclasspath"/>
99
<groovyproject:property name="platform.compiler" value="platforms.${{platform.active}}.compile"/>
100
<groovyproject:property name="platform.javac.tmp" value="platforms.${{platform.active}}.javac"/>
101
<condition property="platform.javac" value="${{platform.home}}/bin/javac">
102
<equals arg1="${{platform.javac.tmp}}" arg2="$${{platforms.${{platform.active}}.javac}}"/>
104
<property name="platform.javac" value="${{platform.javac.tmp}}"/>
105
<groovyproject:property name="platform.java.tmp" value="platforms.${{platform.active}}.java"/>
106
<condition property="platform.java" value="${{platform.home}}/bin/java">
107
<equals arg1="${{platform.java.tmp}}" arg2="$${{platforms.${{platform.active}}.java}}"/>
109
<property name="platform.java" value="${{platform.java.tmp}}"/>
110
<condition property="platform.invalid" value="true">
112
<contains string="${{platform.javac}}" substring="$${{platforms."/>
113
<contains string="${{platform.java}}" substring="$${{platforms."/>
116
<fail unless="platform.home">Must set platform.home</fail>
117
<fail unless="platform.bootcp">Must set platform.bootcp</fail>
118
<fail unless="platform.java">Must set platform.java</fail>
119
<fail unless="platform.javac">Must set platform.javac</fail>
120
<fail if="platform.invalid">Platform is not correctly set up</fail>
122
<available file="${{manifest.file}}" property="manifest.available"/>
123
<condition property="manifest.available+main.script">
125
<isset property="manifest.available"/>
126
<isset property="main.script"/>
128
<equals arg1="${{main.script}}" arg2="" trim="true"/>
132
<condition property="netbeans.home">
134
<isset property="netbeans.home"/>
137
<property name="run.jvmargs" value=""/>
138
<property name="javac.compilerargs" value=""/>
139
<property name="work.dir" value="${{basedir}}"/>
140
<condition property="no.deps">
142
<istrue value="${{no.dependencies}}"/>
147
<target name="-post-init">
148
<xsl:comment> Empty placeholder for easier customization. </xsl:comment>
149
<xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
152
<target name="-init-check">
153
<xsl:attribute name="depends">-pre-init,-init-private,-init-user,-init-project,-do-init</xsl:attribute>
154
<!-- XXX XSLT 2.0 would make it possible to use a for-each here -->
155
<!-- Note that if the properties were defined in project.xml that would be easy -->
156
<!-- But required props should be defined by the AntBasedProjectType, not stored in each project -->
157
<fail unless="src.dir">Must set src.dir</fail>
158
<fail unless="build.dir">Must set build.dir</fail>
159
<fail unless="dist.dir">Must set dist.dir</fail>
160
<fail unless="build.classes.dir">Must set build.classes.dir</fail>
161
<fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
162
<fail unless="dist.jar">Must set dist.jar</fail>
165
<target name="-init-macrodef-property">
167
<xsl:attribute name="name">property</xsl:attribute>
168
<xsl:attribute name="uri">http://www.netbeans.org/ns/groovy-project/1</xsl:attribute>
170
<xsl:attribute name="name">name</xsl:attribute>
173
<xsl:attribute name="name">value</xsl:attribute>
176
<property name="@{{name}}" value="${{@{{value}}}}"/>
181
<target name="-init-macrodef-groovyc">
182
<taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
184
<fileset dir="${{groovy.home}}/lib">
185
<include name="*.jar"/>
190
<xsl:attribute name="name">groovyc</xsl:attribute>
191
<xsl:attribute name="uri">http://www.netbeans.org/ns/groovy-project/1</xsl:attribute>
193
<xsl:attribute name="name">srcdir</xsl:attribute>
194
<xsl:attribute name="default">${src.dir}</xsl:attribute>
197
<xsl:attribute name="name">destdir</xsl:attribute>
198
<xsl:attribute name="default">${build.classes.dir}</xsl:attribute>
201
<xsl:attribute name="name">classpath</xsl:attribute>
202
<xsl:attribute name="default">${javac.classpath}</xsl:attribute>
205
<xsl:attribute name="name">debug</xsl:attribute>
206
<xsl:attribute name="default">${javac.debug}</xsl:attribute>
209
<xsl:attribute name="name">customize</xsl:attribute>
210
<xsl:attribute name="optional">true</xsl:attribute>
214
<xsl:attribute name="srcdir">@{srcdir}</xsl:attribute>
215
<xsl:attribute name="destdir">@{destdir}</xsl:attribute>
217
<path path="@{{classpath}}"/>
225
<target name="-init-macrodef-groovy">
227
<xsl:attribute name="name">groovy</xsl:attribute>
228
<xsl:attribute name="uri">http://www.netbeans.org/ns/groovy-project/1</xsl:attribute>
230
<xsl:attribute name="name">script</xsl:attribute>
231
<xsl:attribute name="default">${main.script}</xsl:attribute>
234
<xsl:attribute name="name">customize</xsl:attribute>
235
<xsl:attribute name="optional">true</xsl:attribute>
238
<java fork="true" classname="groovy.lang.GroovyShell">
239
<xsl:attribute name="dir">${work.dir}</xsl:attribute>
240
<xsl:if test="/p:project/p:configuration/groovy:data/groovy:explicit-platform">
241
<xsl:attribute name="jvm">${platform.java}</xsl:attribute>
243
<arg line="${{run.jvmargs}} ${{src.dir}}/@{{script}}"/>
244
<sysproperty key="groovy.home" value="${{groovy.home}}"/>
246
<path path="${{run.classpath}}"/>
247
<fileset dir="${{groovy.home}}/lib">
248
<include name="*.jar"/>
252
<propertyref prefix="run-sys-prop."/>
253
<mapper type="glob" from="run-sys-prop.*" to="*"/>
261
<target name="-init-presetdef-jar">
263
<xsl:attribute name="name">jar</xsl:attribute>
264
<xsl:attribute name="uri">http://www.netbeans.org/ns/groovy-project/1</xsl:attribute>
265
<jar jarfile="${{dist.jar}}" compress="${{jar.compress}}">
266
<fileset dir="${{build.classes.dir}}"/>
267
<!-- XXX should have a property serving as the excludes list -->
273
<xsl:attribute name="depends">-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-groovyc,-init-macrodef-groovy,-init-presetdef-jar</xsl:attribute>
282
<xsl:call-template name="deps.target">
283
<xsl:with-param name="targetname" select="'deps-jar'"/>
284
<xsl:with-param name="type" select="'jar'"/>
287
<target name="-pre-pre-compile">
288
<xsl:attribute name="depends">init,deps-jar</xsl:attribute>
289
<mkdir dir="${{build.classes.dir}}"/>
292
<target name="-pre-compile">
293
<xsl:comment> Empty placeholder for easier customization. </xsl:comment>
294
<xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
297
<target name="-do-compile">
298
<xsl:attribute name="depends">init,deps-jar,-pre-pre-compile,-pre-compile</xsl:attribute>
299
<groovyproject:groovyc/>
300
<copy todir="${{build.classes.dir}}">
301
<fileset dir="${{src.dir}}" excludes="${{build.classes.excludes}}"/>
305
<target name="-post-compile">
306
<xsl:comment> Empty placeholder for easier customization. </xsl:comment>
307
<xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
310
<target name="compile">
311
<xsl:attribute name="depends">init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile</xsl:attribute>
312
<xsl:attribute name="description">Compile project.</xsl:attribute>
315
<target name="-pre-compile-single">
316
<xsl:comment> Empty placeholder for easier customization. </xsl:comment>
317
<xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
320
<target name="-do-compile-single">
321
<xsl:attribute name="depends">init,deps-jar,-pre-pre-compile</xsl:attribute>
322
<fail unless="groovyc.includes">Must select some files in the IDE or set groovyc.includes</fail>
323
<groovyproject:groovyc>
325
<patternset includes="${{groovyc.includes}}"/>
327
</groovyproject:groovyc>
330
<target name="-post-compile-single">
331
<xsl:comment> Empty placeholder for easier customization. </xsl:comment>
332
<xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
335
<target name="compile-single">
336
<xsl:attribute name="depends">init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single</xsl:attribute>
345
<target name="-pre-pre-jar">
346
<xsl:attribute name="depends">init</xsl:attribute>
347
<dirname property="dist.jar.dir" file="${{dist.jar}}"/>
348
<mkdir dir="${{dist.jar.dir}}"/>
351
<target name="-pre-jar">
352
<xsl:comment> Empty placeholder for easier customization. </xsl:comment>
353
<xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
356
<target name="-do-jar-without-manifest">
357
<xsl:attribute name="depends">init,compile,-pre-pre-jar,-pre-jar</xsl:attribute>
358
<xsl:attribute name="unless">manifest.available</xsl:attribute>
362
<target name="-do-jar-with-manifest">
363
<xsl:attribute name="depends">init,compile,-pre-pre-jar,-pre-jar</xsl:attribute>
364
<xsl:attribute name="if">manifest.available</xsl:attribute>
365
<xsl:attribute name="unless">manifest.available+main.script</xsl:attribute>
366
<groovyproject:jar manifest="${{manifest.file}}"/>
369
<target name="-do-jar-with-mainclass">
370
<xsl:attribute name="depends">init,compile,-pre-pre-jar,-pre-jar</xsl:attribute>
371
<xsl:attribute name="if">manifest.available+main.script</xsl:attribute>
372
<groovyproject:jar manifest="${{manifest.file}}">
374
<attribute name="Main-Class" value="${{main.script}}"/>
379
<target name="-post-jar">
380
<xsl:comment> Empty placeholder for easier customization. </xsl:comment>
381
<xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
385
<xsl:attribute name="depends">init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-post-jar</xsl:attribute>
386
<xsl:attribute name="description">Build JAR.</xsl:attribute>
396
<xsl:attribute name="depends">init,deps-jar</xsl:attribute>
397
<xsl:attribute name="description">Run a main script.</xsl:attribute>
398
<groovyproject:groovy>
400
<arg line="${{application.args}}"/>
402
</groovyproject:groovy>
405
<target name="run-single">
406
<xsl:attribute name="depends">init,deps-jar</xsl:attribute>
407
<fail unless="run.script">Must select one file in the IDE or set run.script</fail>
408
<groovyproject:groovy script="${{run.script}}"/>
417
<xsl:call-template name="deps.target">
418
<xsl:with-param name="targetname" select="'deps-clean'"/>
421
<target name="-do-clean">
422
<xsl:attribute name="depends">init</xsl:attribute>
423
<delete dir="${{build.dir}}"/>
424
<delete dir="${{dist.dir}}"/>
425
<delete dir="jpywork"/>
426
<!-- XXX explicitly delete all build.* and dist.* dirs in case they are not subdirs -->
429
<target name="-post-clean">
430
<xsl:comment> Empty placeholder for easier customization. </xsl:comment>
431
<xsl:comment> You can override this target in the ../build.xml file. </xsl:comment>
434
<target name="clean">
435
<xsl:attribute name="depends">init,deps-clean,-do-clean,-post-clean</xsl:attribute>
436
<xsl:attribute name="description">Clean build products.</xsl:attribute>
443
Could pass <propertyset> to run, debug, etc. under Ant 1.6,
444
optionally, by doing e.g.
447
<propertyref prefix="sysprop."/>
448
<mapper type="glob" from="sysprop.*" to="*"/>
451
Now user can add to e.g. project.properties e.g.:
452
sysprop.org.netbeans.modules.javahelp=0
454
-Dorg.netbeans.modules.javahelp=0
461
Generic template to build subdependencies of a certain type.
462
Feel free to copy into other modules.
463
@param targetname required name of target to generate
464
@param type artifact-type from project.xml to filter on; optional, if not specified, uses
465
all references, and looks for clean targets rather than build targets
466
@return an Ant target which builds (or cleans) all known subprojects
468
<xsl:template name="deps.target">
469
<xsl:param name="targetname"/>
470
<xsl:param name="type"/>
471
<target name="{$targetname}">
472
<xsl:attribute name="depends">init</xsl:attribute>
473
<xsl:attribute name="unless">no.deps</xsl:attribute>
474
<xsl:variable name="references" select="/p:project/p:configuration/projdeps:references"/>
475
<xsl:for-each select="$references/projdeps:reference[not($type) or projdeps:artifact-type = $type]">
476
<xsl:variable name="subproj" select="projdeps:foreign-project"/>
477
<xsl:variable name="subtarget">
479
<xsl:when test="$type">
480
<xsl:value-of select="projdeps:target"/>
483
<xsl:value-of select="projdeps:clean-target"/>
487
<xsl:variable name="script" select="projdeps:script"/>
488
<ant target="{$subtarget}" inheritall="false" antfile="${{project.{$subproj}}}/{$script}"/>