aboutsummaryrefslogtreecommitdiffstats
blob: 83c4248e432913e1b0f5c4f4f28a1f999ac73e56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
<!--/*******************************************************************************
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
*   Ant naming conventions:
*   - regardless of the actual OS platform,'/' is the directory separator
*     (Ant will convert as appropriate).
*   - multi-word properties use periods '.'
*   - multi-word targets use hyphens '-'
*   - multi-word macros use underscores '_'
*   - multi-word macro attributes are concatenated
*     e.g. 'runpathref'
*   - multi-word tasks (taskdef) names are concatenated
*     e.g. 'validateconnection'
*   - OS environment variables are in ALLCAPS and have 'env' as a prefix
*     e.g. ${env.XXX}.
*   - Ant properties are lower case.
*
* Contributors:
*     egwin  - initial API and implementation
#******************************************************************************/-->

<project name="compdeps" default="build" basedir=".">

    <available file="../${ant.project.name}" type="dir" property="p2.is.local"/>
    <!-- Test to make sure that the calling script doesn't inherit the variable -->
    <!-- (should be set locally, and be destroyed upon return) -->
    <fail message="Not running from '${ant.project.name}' directory" unless="p2.is.local"/>

    <target name="init">
        <tstamp>
           <format property="compdeps.build.date" pattern="yyyyMMdd"/>
           <format property="compdeps.build.time" pattern="HHmm"/>
        </tstamp>

        <dirname  property="compdeps.build.location_temp" file="${ant.file.compdeps}"/>
        <pathconvert targetos="unix" property="compdeps.build.location">
            <path>
                <pathelement location="${compdeps.build.location_temp}"/>
            </path>
        </pathconvert>
        <property file="${user.home}/build.properties"/>
        <!-- compdeps.2.base.dir needs to be explicit (not relative) for antcall usage            -->
        <!-- (I think the selectbundle call reverts to calling dir - despite the antcall "dir=") -->
        <property name="compdeps.2.base.dir"            value="${compdeps.build.location}/../.."/>
        <property name="compdeps.2.common.dir"          value="${compdeps.2.base.dir}/features/common"/>
        <property name="compdeps.2.common.plugins.dir"  value="${compdeps.2.base.dir}/plugins"/>
        <property name="compdeps.2.jpa.plugins.dir"     value="${compdeps.2.base.dir}/jpa/plugins"/>
        <property name="compdeps.2.sdo.plugins.dir"     value="${compdeps.2.base.dir}/sdo/plugins"/>
        <property name="compdeps.2.util.plugins.dir"    value="${compdeps.2.base.dir}/utils/plugins"/>
        <property name="compdeps.2.buildsys.dir"        value="${compdeps.2.base.dir}/buildsystem"/>
        <echo message="ant.project.name               ='${ant.project.name}'"/>
        <echo message="basedir                        ='${basedir}'"/>
        <echo message="compdeps.build.location        ='${compdeps.build.location}'"/>
        <echo message="compdeps.2.base.dir            ='${compdeps.2.base.dir}'"/>
        <echo message="compdeps.2.common.dir          ='${compdeps.2.common.dir}'"/>
        <echo message="compdeps.2.common.plugins.dir  ='${compdeps.2.common.plugins.dir}'"/>
        <echo message="compdeps.2.jpa.plugins.dir     ='${compdeps.2.jpa.plugins.dir}'"/>
        <echo message="compdeps.2.sdo.plugins.dir     ='${compdeps.2.sdo.plugins.dir}'"/>
        <echo message="compdeps.2.util.plugins.dir    ='${compdeps.2.util.plugins.dir}'"/>
        <echo message="compdeps.2.buildsys.dir        ='${compdeps.2.buildsys.dir}'"/>
        <echo message=" ---"/>

        <!-- Custom task definitions -->
        <property name="custom.tasks.lib"               value="${compdeps.2.buildsys.dir}/ant_customizations.jar"/>
        <property name="custom.echo.task.class"         value="org.eclipse.persistence.buildtools.ant.taskdefs.Say"/>
        <property name="custom.selectbundle.task.class" value="org.eclipse.persistence.buildtools.ant.taskdefs.SelectBundle"/>
        <echo message="custom.tasks.lib               ='${custom.tasks.lib}'"/>
        <echo message="custom.echo.task.class         ='${custom.echo.task.class}'"/>
        <echo message="custom.selectbundle.task.class ='${custom.selectbundle.task.class}'"/>
        <echo message=" ---"/>
        <taskdef name="say"          classname="${custom.echo.task.class}"         classpath="${custom.tasks.lib}"/>
        <taskdef name="selectbundle" classname="${custom.selectbundle.task.class}" classpath="${custom.tasks.lib}"/>

        <!-- Defaults of Pre-Set variables -->
        <property name="compdeps.version"               value="1.0.4"/>
        <property name="compdeps.qualifier"             value="v${compdeps.build.date}${compdeps.build.time}"/>
        <property name="compdeps.version.string"        value="${compdeps.version}.${compdeps.qualifier}"/>
        <property name="bld.src.dir"                    value="${compdeps.build.location}/target"/>
        <property name="p2repo.dir"                     value="${compdeps.build.location}/p2repo"/>
        <property name="specification.vendor"           value="Eclipse.org - EclipseLink Project"/>
        <echo message="compdeps.version               ='${compdeps.version}'"/>
        <echo message="compdeps.qualifier             ='${compdeps.qualifier}'"/>
        <echo message="compdeps.version.string        ='${compdeps.version.string}'"/>
        <echo message="p2repo.dir                     ='${p2repo.dir}'"/>
        <echo message="specification.vendor           ='${specification.vendor}'"/>
        <echo message=" ---"/>

        <!-- Tool definitions -->
        <property name="eclipse.install.dir"            value="D:\Juno-M7\eclipse"/>
        <property name="eclipse.plugin.dir"             value="${eclipse.install.dir}/plugins"/>
        <property name="p2.publisher.prefix"            value="org.eclipse.equinox.p2.publisher"/>
        <property name="p2.launcher.prefix"             value="org.eclipse.equinox.launcher"/>
        <property name="p2.artifact.prefix"             value="org.eclipse.equinox.artifact.repository"/>
        <available file="${eclipse.plugin.dir}" property="eclipse.install.exist"/>
        <echo message="eclipse.install.dir            ='${eclipse.install.dir}'"/>
        <say  message="eclipse.plugin.dir             ='${eclipse.plugin.dir}'"    if="eclipse.install.exist"/>
        <say  message="eclipse.plugin.dir:  '${eclipse.plugin.dir}' not found!" unless="eclipse.install.exist"/>
        <echo message="p2.publisher.jar               ='${p2.publisher.jar}'"/>
        <echo message="p2.launcher.jar                ='${p2.launcher.jar}'"/>
        <echo message="p2.artifact.jar                ='${p2.artifact.jar}'"/>
        <echo message=" ---"/>

        <!-- Input definitions -->
        <property name="p2.feature.dir"                 value="${p2repo.dir}/features"/>
        <property name="p2.bundle.dir"                  value="${p2repo.dir}/plugins"/>
        <echo message="p2.feature.dir                 ='${p2.feature.dir}'"/>
        <echo message="p2.bundle.dir                  ='${p2.bundle.dir}'"/>
        <echo message=" ---"/>

        <!-- Helper definitions derived from Pre-set variables -->
        <property name="compdeps.build.dir"             value="${p2.feature.dir}"/>
        <echo message="compdeps.build.dir             ='${compdeps.build.dir}'"/>
        <echo message=" ---"/>

        <!-- Output definitions -->
        <property name="p2.repos.url"                   value="file:/${p2repo.dir}"/> <!-- DO NOT Override this one -->
        <property name="p2.release.repos.name"          value="EclipseLink Compdeps Repository"/>
        <property name="p2.release.repos.url"           value="http://archive.eclipse.org/rt/eclipselink/compdeps-updates"/>
        <property name="metadata.repos.name"            value="&quot;${p2.release.repos.name}&quot;"/>
        <property name="artifact.repos.name"            value="&quot;EclipseLink Compdeps Artifacts&quot;"/>
        <echo message="p2.repos.url                   ='${p2.repos.url}'"/>
        <echo message="p2.release.repos.name          ='${p2.release.repos.name}'"/>
        <echo message="p2.release.repos.url           ='${p2.release.repos.url}'"/>
        <echo message="metadata.repos.name            ='${metadata.repos.name}'"/>
        <echo message="artifact.repos.name            ='${artifact.repos.name}'"/>

        <!-- Feature Dependency variables -->
        <!-- Defaults, set var in ${user.home}/build.properties if different version required -->
        <property name="javax.xml.bind.prefix" value="javax.xml.bind"/>
        <property name="javax.xml.bind.criteria" value="[0.0.1,5.0.0)"/>
        <property name="sun.tools.xjc.prefix" value="jaxb-xjc"/>
        <property name="sun.tools.xjc.criteria" value="[0.0.1,5.0.0)"/>
        <property name="sun.xml.bind.prefix" value="jaxb-core"/>
        <property name="sun.xml.bind.criteria" value="[0.0.1,5.0.0)"/>
        <property name="jersey.prefix" value="com.sun.jersey"/>
        <property name="jersey.criteria" value="[1.8.0,5.0.0)"/>
        <property name="sdo.prefix" value="commonj.sdo"/>
        <property name="sdo.criteria" value="[2.1.1,5.0.0)"/>
        <property name="ejb.prefix" value="javax.ejb"/>
        <property name="ejb.criteria" value="[0.0.1,5.0.0)"/>
        <property name="jms.prefix" value="javax.jms"/>
        <property name="jms.criteria" value="[0.0.1,5.0.0)"/>
        <property name="persistence.prefix" value="javax.persistence"/>
        <property name="persistence.criteria" value="[2.0.0,5.0.0)"/>
        <property name="resource.prefix" value="javax.resource"/>
        <property name="resource.criteria" value="[0.0.1,5.0.0)"/>
        <property name="validation.prefix" value="javax.validation"/>
        <property name="validation.criteria" value="[0.0.1,5.0.0)"/>
        <property name="servlet.prefix" value="javax.servlet"/>
        <property name="servlet.criteria" value="[0.0.1,5.0.0)"/>
        <property name="wsdl.prefix" value="javax.wsdl"/>
        <property name="wsdl.criteria" value="[0.0.1,5.0.0)"/>
        <property name="xml.soap.prefix" value="javax.xml.soap"/>
        <property name="xml.soap.criteria" value="[0.0.1,5.0.0)"/>
        <!-- For EclipseLink bundles -->
        <property name="antlr.prefix" value="org.eclipse.persistence.antlr"/>
        <property name="antlr.criteria" value="[3.0,5.0)"/>
        <property name="asm.prefix" value="org.eclipse.persistence.asm"/>
        <property name="asm.criteria" value="[3.0,9.0)"/>
        <property name="oracleddl.prefix" value="org.eclipse.persistence.oracleddlparser"/>
        <property name="oracleddl.criteria" value="[0.0.1,5.0)"/>
    </target>

    <!-- Need to copy only the bundles that will be in the features into the "p2repo.dir/plugins" dir
         (so must copy from main plugins to new temp location). Also need to filter copy the feature xml
         files to "p2repo.dir/features" to substitute the actual version.qualifer string into it.
         Then can Generate P2.                                                                        -->
    <target name="build"                         depends="init, build-feature, generate-p2"/>
    <target name="build-feature"                 depends="clean, create-deployable-features"/>

    <!-- Feature Targets -->
    <!-- clean -->
    <target name="clean" depends="init" description="Clean all generated content">
        <delete dir="${bld.src.dir}" includeEmptyDirs="true" failonerror="false"/>
        <delete dir="${p2repo.dir}"  includeEmptyDirs="true" failonerror="false"/>
    </target>

    <target name="resolve-feature-dependencies" if="eclipse.install.exist" depends="init">
        <echo message="Searching ${compdeps.2.common.plugins.dir}..."/>
        <selectbundle basename="${javax.xml.bind.prefix}"  directory="${compdeps.2.common.plugins.dir}"
                      criterion="${javax.xml.bind.criteria}" property="javax.xml.bind.version" versiononly="true"
        />

        <!--START OF HOTFIX for JAXB-CORE and JAXB-XJC dependencies.
            When JAXB-RI builds will generate correct OSGi headers, update the
            dependencies and remove this hotfix.-->
        <unjar overwrite="true"
               src="${compdeps.2.common.plugins.dir}/jaxb-core_2.2.11.v201406210428.jar"
               dest="${compdeps.2.common.plugins.dir}/tmpfix.osgi.core"
        />
        <jar update="false"
             destfile="${compdeps.2.common.plugins.dir}/tmpfix.osgi.aux/jaxb-core_2.2.11.v201406210428.jar"
             basedir="${compdeps.2.common.plugins.dir}/tmpfix.osgi.core"
             manifest="${compdeps.2.common.plugins.dir}/tmpfix.osgi.manifest.core/MANIFEST.MF"
        />
        <selectbundle basename="${sun.xml.bind.prefix}"  directory="${compdeps.2.common.plugins.dir}/tmpfix.osgi.aux"
                      criterion="${sun.xml.bind.criteria}" property="sun.xml.bind.version" versiononly="true"
        />

        <unjar overwrite="true"
               src="${compdeps.2.common.plugins.dir}/jaxb-xjc_2.2.11.v201406210428.jar"
               dest="${compdeps.2.common.plugins.dir}/tmpfix.osgi.xjc"
        />
        <jar update="false"
             destfile="${compdeps.2.common.plugins.dir}/tmpfix.osgi.aux/jaxb-xjc_2.2.11.v201406210428.jar"
             basedir="${compdeps.2.common.plugins.dir}/tmpfix.osgi.xjc"
             manifest="${compdeps.2.common.plugins.dir}/tmpfix.osgi.manifest.xjc/MANIFEST.MF"
        />
        <selectbundle basename="${sun.tools.xjc.prefix}"  directory="${compdeps.2.common.plugins.dir}/tmpfix.osgi.aux"
                      criterion="${sun.tools.xjc.criteria}" property="sun.tools.xjc.version" versiononly="true"
        />
        <!--END OF HOTFIX.-->

        <selectbundle basename="${jersey.prefix}"  directory="${compdeps.2.common.plugins.dir}"
                     criterion="${jersey.criteria}" property="jersey.version" versiononly="true"
        />
        <selectbundle basename="${ejb.prefix}"  directory="${compdeps.2.common.plugins.dir}"
                     criterion="${ejb.criteria}" property="ejb.version" versiononly="true"
        />
        <selectbundle basename="${jms.prefix}"  directory="${compdeps.2.common.plugins.dir}"
                     criterion="${jms.criteria}" property="jms.version" versiononly="true"
        />
        <selectbundle basename="${resource.prefix}"  directory="${compdeps.2.common.plugins.dir}"
                     criterion="${resource.criteria}" property="resource.version" versiononly="true"
        />
        <selectbundle basename="${servlet.prefix}"  directory="${compdeps.2.common.plugins.dir}"
                     criterion="${servlet.criteria}" property="servlet.version" versiononly="true"
        />
        <selectbundle basename="${xml.soap.prefix}"  directory="${compdeps.2.common.plugins.dir}"
                     criterion="${xml.soap.criteria}" property="xml.soap.version" versiononly="true"
        />
        <selectbundle basename="${antlr.prefix}"  directory="${compdeps.2.common.plugins.dir}"
                     criterion="${antlr.criteria}" property="antlr.version" versiononly="true"
        />
        <selectbundle basename="${asm.prefix}"  directory="${compdeps.2.common.plugins.dir}"
                     criterion="${asm.criteria}" property="asm.version" versiononly="true"
        />
        <selectbundle basename="${validation.prefix}"  directory="${compdeps.2.common.plugins.dir}"
                      criterion="${validation.criteria}" property="validation.version" versiononly="true"
        />
        <say  message="   javax.xml.bind.version   = '${javax.xml.bind.version}'"                                                   if="javax.xml.bind.version"/>
        <say  message="   '{$javax.xml.bind.prefix}_{$javax.xml.bind.criteria}' not found! Generated features will be invalid."   unless="javax.xml.bind.version"/>
        <say  message="   sun.tools.xjc.version    = '${sun.tools.xjc.version}'"                                                    if="sun.tools.xjc.version"/>
        <say  message="   '${sun.tools.xjc.prefix}_${sun.tools.xjc.criteria}.jar' not found! Generated features will be invalid." unless="sun.tools.xjc.version"/>
        <say  message="   sun.xml.bind.version     = '${sun.xml.bind.version}'"                                                     if="sun.xml.bind.version"/>
        <say  message="   '${sun.xml.bind.prefix}_${sun.xml.bind.criteria}.jar' not found! Generated features will be invalid."   unless="sun.xml.bind.version"/>
        <say  message="   jersey.version           = '${jersey.version}'"                                                           if="jersey.version"/>
        <say  message="   '${jersey.prefix}_${jersey.criteria}.jar' not found! Generated features will be invalid."             unless="jersey.version"/>
        <say  message="   ejb.version              = '${ejb.version}'"                                                              if="ejb.version"/>
        <say  message="   '${ejb.prefix}_${ejb.criteria}.jar' not found! Generated features will be invalid."                   unless="ejb.version"/>
        <say  message="   jms.version              = '${jms.version}'"                                                              if="jms.version"/>
        <say  message="   '${jms.prefix}_${jms.criteria}.jar' not found! Generated features will be invalid."                   unless="jms.version"/>
        <say  message="   resource.version         = '${resource.version}'"                                                         if="resource.version"/>
        <say  message="   '${resource.prefix}_${resource.criteria}.jar' not found! Generated features will be invalid."         unless="resource.version"/>
        <say  message="   servlet.version          = '${servlet.version}'"                                                          if="servlet.version"/>
        <say  message="   '${servlet.prefix}_${servlet.criteria}.jar' not found! Generated features will be invalid."           unless="servlet.version"/>
        <say  message="   xml.soap.version         = '${xml.soap.version}'"                                                         if="xml.soap.version"/>
        <say  message="   '${xml.soap.prefix}_${xml.soap.criteria}.jar' not found! Generated features will be invalid."         unless="xml.soap.version"/>
        <say  message="   antlr.version            = '${antlr.version}'"                                                            if="antlr.version"/>
        <say  message="   '${antlr.prefix}_${antlr.criteria}.jar' not found! Generated features will be invalid."               unless="antlr.version"/>
        <say  message="   asm.version              = '${asm.version}'"                                                              if="asm.version"/>
        <say  message="   '${asm.prefix}_${asm.criteria}.jar' not found! Generated features will be invalid."                   unless="asm.version"/>
        <say  message="   validation.version       = '${validation.version}'"                                                       if="validation.version"/>
        <say  message="   '${validation.prefix}_${validation.criteria}.jar' not found! Generated features will be invalid."     unless="validation.version"/>

        <echo message="Searching ${compdeps.2.jpa.plugins.dir}..."/>
        <selectbundle basename="${persistence.prefix}"  directory="${compdeps.2.jpa.plugins.dir}"
                     criterion="${persistence.criteria}" property="persistence.version" versiononly="true"
        />
        <say  message="   persistence.version      = '${persistence.version}'"                                                      if="persistence.version"/>
        <say  message="   '${persistence.prefix}_${persistence.criteria}.jar' not found! Generated features will be invalid."   unless="persistence.version"/>

        <echo message="Searching ${compdeps.2.sdo.plugins.dir}..."/>
        <selectbundle basename="${sdo.prefix}"  directory="${compdeps.2.sdo.plugins.dir}"
                     criterion="${sdo.criteria}" property="sdo.version" versiononly="true"
        />
        <say  message="   sdo.version              = '${sdo.version}'"                                                              if="sdo.version"/>
        <say  message="   '${sdo.prefix}_${sdo.criteria}.jar' not found! Generated features will be invalid."                   unless="sdo.version"/>

        <echo message="Searching ${compdeps.2.util.plugins.dir}..."/>
        <selectbundle basename="${oracleddl.prefix}"  directory="${compdeps.2.util.plugins.dir}"
                     criterion="${oracleddl.criteria}" property="oracleddl.version" versiononly="true"
        />
        <selectbundle basename="${wsdl.prefix}"  directory="${compdeps.2.util.plugins.dir}"
                     criterion="${wsdl.criteria}" property="wsdl.version" versiononly="true"
        />
        <say  message="   oracleddl.version        = '${oracleddl.version}'"                                                        if="oracleddl.version"/>
        <say  message="   '${oracleddl.prefix}_${oracleddl.criteria}.jar' not found! Generated features will be invalid."       unless="oracleddl.version"/>
        <say  message="   wsdl.version             = '${wsdl.version}'"                                                             if="wsdl.version"/>
        <say  message="   '${wsdl.prefix}_${wsdl.criteria}.jar' not found! Generated features will be invalid."                 unless="wsdl.version"/>
    </target>

    <!-- build feature jars -->
    <target name="jar-feature" description="General target for packaging a feature">
        <mkdir dir="${compdeps.build.dir}"/>
        <jar jarfile="${compdeps.build.dir}/${feature.name}_${compdeps.version.string}.jar" duplicate="preserve">
            <fileset dir="${compdeps.2.common.dir}">
                <include name="*.html"/>
                <exclude name="*.bak"/>
            </fileset>
            <fileset dir="${compdeps.2.base.dir}">
                <include name="about.html"/>
                <include name="readme.html"/>
                <exclude name="*.bak"/>
            </fileset>
            <fileset dir="${bld.src.dir}/${feature.name}">
                <include name="*.*"/>
                <exclude name="*.bak"/>
            </fileset>
        </jar>
    </target>

    <target name="create-deployable-features" if="eclipse.install.exist" depends="resolve-feature-dependencies">
        <mkdir dir="${bld.src.dir}"/>
        <!--          Filters for feature.xml files                 -->
        <filter token="VERSION"              value="${compdeps.version}"/>
        <filter token="QUALIFIER"            value="${compdeps.qualifier}"/>
        <!--          Filters for dependencies in feature.xml files -->
        <filter token="XJC_VERSION"          value="${sun.tools.xjc.version}"/>
        <filter token="JAXB_CORE_VERSION"    value="${sun.xml.bind.version}"/>
        <filter token="JAVAX_XML_BIND_VERSION"  value="${javax.xml.bind.version}"/>
        <filter token="JERSEY_VERSION"       value="${jersey.version}"/>
        <filter token="EJB_VERSION"          value="${ejb.version}"/>
        <filter token="JMS_VERSION"          value="${jms.version}"/>
        <filter token="RESOURCE_VERSION"     value="${resource.version}"/>
        <filter token="SERVLET_VERSION"      value="${servlet.version}"/>
        <filter token="XML_SOAP_VERSION"     value="${xml.soap.version}"/>
        <filter token="PERSISTENCE_VERSION"  value="${persistence.version}"/>
        <filter token="VALIDATION_VERSION"   value="${validation.version}"/>
        <filter token="SDO_VERSION"          value="${sdo.version}"/>
        <filter token="WSDL_VERSION"         value="${wsdl.version}"/>
        <!--          Filters for product bundles in feature.xml files -->
        <filter token="ANTLR_VERSION"        value="${antlr.version}"/>
        <filter token="ASM_VERSION"          value="${asm.version}"/>
        <filter token="ORACLEDDL_VERSION"    value="${oracleddl.version}"/>
        <!--          Filters for feature.properties files          -->
        <filter token="PROVIDER"             value="${specification.vendor}"/>
        <filter token="REPOS_NAME"           value="${p2.release.repos.name}"/>
        <filter token="MILESTONE_REPOS"      value="${p2.release.repos.name}"/>
        <filter token="PRIME_UPDATE_URL"     value="${p2.release.repos.url}"/>
        <filter token="SECOND_UPDATE_URL"    value="${p2.release.repos.url}"/>
        <copy todir="${bld.src.dir}" filtering="true">
            <fileset dir="${compdeps.build.location}">
                <include name="**/feature*.*"/>
            </fileset>
        </copy>
        <antcall target="jar-feature">
          <param name="feature.name" value="org.eclipse.persistence.compdeps"/>
        </antcall>
    </target>

    <!-- P2 Targets -->
    <target name="populate-p2-site" if="eclipse.install.exist" depends="init, resolve-feature-dependencies">
        <delete dir="${p2.bundle.dir}" failonerror="false"/>
        <mkdir dir="${p2.bundle.dir}"/>
        <!-- populate bundle jars -->
        <copy todir="${p2.bundle.dir}">
            <fileset
                dir="${compdeps.2.common.plugins.dir}"
                includes="${jersey.prefix}_${jersey.version}.jar,
                          ${ejb.prefix}_${ejb.version}.jar,
                          ${jms.prefix}_${jms.version}.jar,
                          ${resource.prefix}_${resource.version}.jar,
                          ${servlet.prefix}_${servlet.version}.jar,
                          ${xml.soap.prefix}_${xml.soap.version}.jar,
                          ${antlr.prefix}_${antlr.version}.jar,
                          ${antlr.prefix}.source_${antlr.version}.jar,
                          ${asm.prefix}_${asm.version}.jar,
                          ${asm.prefix}.source_${asm.version}.jar,
                          ${validation.prefix}_${validation.version}.jar"
            />
            <fileset
                    dir="${compdeps.2.common.plugins.dir}/tmpfix.osgi.aux/"
                    includes="${sun.tools.xjc.prefix}_${sun.tools.xjc.version}.jar,
                          ${sun.xml.bind.prefix}_${sun.xml.bind.version}.jar"
            />
            <fileset
                dir="${compdeps.2.jpa.plugins.dir}"
                includes="${persistence.prefix}_${persistence.version}.jar,
                          ${persistence.prefix}.source_${persistence.version}.jar"
            />
            <fileset
                dir="${compdeps.2.sdo.plugins.dir}"
                includes="${sdo.prefix}_${sdo.version}.jar"
            />
            <fileset
                dir="${compdeps.2.util.plugins.dir}"
                includes="${oracleddl.prefix}_${oracleddl.version}.jar,
                          ${oracleddl.prefix}.source_${oracleddl.version}.jar,
                          ${wsdl.prefix}_${wsdl.version}.jar"
            />
        </copy>
        <!--START OF HOTFIX
            We don't want to have the new jar files anywhere in EclipseLink
            because of licence issues.-->
        <delete includeemptydirs="true">
            <fileset dir="${compdeps.2.common.plugins.dir}/tmpfix.osgi.aux" includes="**/*"/>
            <fileset dir="${compdeps.2.common.plugins.dir}/tmpfix.osgi.xjc" includes="**/*"/>
            <fileset dir="${compdeps.2.common.plugins.dir}/tmpfix.osgi.core" includes="**/*"/>
        </delete>
        <!--END OF HOTFIX-->
    </target>

    <target name="configure-tooling" if="eclipse.install.exist" depends="init">
        <selectbundle basename="${p2.launcher.prefix}"   directory="${eclipse.plugin.dir}"
                     criterion="[0.0.1,9.0.0)" property="p2.launcher.jar"
        />
        <selectbundle basename="${p2.publisher.prefix}"  directory="${eclipse.plugin.dir}"
                     criterion="[0.0.1,9.0.0)" property="p2.publisher.jar"
        />
        <echo message="eclipse.plugin.dir ='${eclipse.plugin.dir}'"/>
        <say  message="p2.launcher.jar   ='${p2.launcher.jar}'"                                               if="p2.launcher.jar"/>
        <say  message="   '${p2.launcher.prefix}_[0.0.1,9.0.0).jar' not found! P2 Generation will fail."  unless="p2.launcher.jar"/>
        <say  message="p2.publisher.jar  ='${p2.publisher.jar}'"                                              if="p2.publisher.jar"/>
        <say  message="   '${p2.publisher.prefix}_[0.0.1,9.0.0).jar' not found!P2 Generation will fail."  unless="p2.publisher.jar"/>
        <condition property="p2.tooling.available">
            <and>
                <isset property="p2.launcher.jar"/>
                <isset property="p2.publisher.jar"/>
            </and>
        </condition>
        <say  message="All P2 Generation libraries not available. Generation aborted!"  unless="p2.tooling.available"/>
    </target>

    <target name="generate-p2" if="p2.tooling.available" depends="configure-tooling, populate-p2-site">
        <delete file="${p2repo.dir}/site.xml" quiet="true"/>
        <filter token="REPOS_URL"          value="${p2.release.repos.url}"/>
        <filter token="VERSION"            value="${compdeps.version}"/>
        <filter token="QUALIFIER"          value="${compdeps.qualifier}"/>
        <copy todir="${p2repo.dir}" file="${compdeps.build.location}/site.xml" filtering="true"/>

        <echo message="java.home         ='${java.home}'"/>
        <echo message="-----"/>
        <echo message="p2repo.dir           ='${p2repo.dir}'"/>
        <echo message="p2.repos.url         ='${p2.repos.url}'"/>
        <echo message="p2.release.repos.url ='${p2.release.repos.url}'"/>
        <echo message="-----"/>
        <!-- Metadata generator apparently doesn't rebuild the artifact and content xml files if they already exist -->
        <delete  failonerror="false">
            <fileset dir="${p2repo.dir}" includes="artifact*.*, content*.*"/>
        </delete>
        <java classname="org.eclipse.equinox.launcher.Main" fork="true" timeout="10800000" taskname="p2"
            jvm="${java.home}/bin/java" failonerror="false" maxmemory="256m">
            <classpath>
                <fileset dir="${eclipse.plugin.dir}"
                    includes="${p2.launcher.jar},
                              ${p2.publisher.jar}"/>
                <pathelement location="${eclipse.plugin.dir}" />
            </classpath>
            <arg line=" -application org.eclipse.equinox.p2.publisher.UpdateSitePublisher" />
            <arg line=" -metadataRepository ${p2.repos.url}" />
            <arg line=" -artifactRepository ${p2.repos.url}" />
            <arg line=" -source ${p2repo.dir}" />
            <arg line=" -compress -publishArtifacts -configs all" />
        </java>
    </target>

</project>