File: lib.xml

package info (click to toggle)
resteasy 3.6.2-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 34,612 kB
  • sloc: java: 265,492; xml: 27,855; javascript: 405; jsp: 166; python: 101; sh: 15; sql: 3; makefile: 2
file content (295 lines) | stat: -rw-r--r-- 12,566 bytes parent folder | download | duplicates (4)
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
<!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright 2010, Red Hat, Inc., and individual contributors
  ~ as indicated by the @author tags. See the copyright.txt file in the
  ~ distribution for a full listing of individual contributors.
  ~
  ~ This is free software; you can redistribute it and/or modify it
  ~ under the terms of the GNU Lesser General Public License as
  ~ published by the Free Software Foundation; either version 2.1 of
  ~ the License, or (at your option) any later version.
  ~
  ~ This software is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  ~ Lesser General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Lesser General Public
  ~ License along with this software; if not, write to the Free
  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  -->

<project name="module-repository-lib" xmlns:artifact="antlib:org.apache.maven.artifact.ant">

    <property name="src.dir" value="src"/>
    <property name="module.repo.src.dir" value="${src.dir}/main/resources/modules"/>
    <property name="module.xml" value="module.xml"/>

    <taskdef resource="net/sf/antcontrib/antlib.xml"/>
    <taskdef name="jandex" classname="org.jboss.jandex.JandexAntTask" />

    <macrodef name="module-def">
        <attribute name="name"/>
        <attribute name="slot" default="main"/>
        <element name="resources" implicit="yes" optional="yes"/>

        <sequential>
            <echo message="Initializing module -> @{name}"/>
            <property name="module.repo.output.dir" value="${output.dir}/modules"/>
            <!-- Figure out the correct module path -->
            <define-module-dir name="@{name}" slot="@{slot}"/>

            <!-- Make the module output director -->
            <mkdir dir="${module.repo.output.dir}/${current.module.path}"/>

            <!-- Copy the module.xml and other stuff to the output director -->
            <copy todir="${module.repo.output.dir}/${current.module.path}" overwrite="true">
                <fileset dir="${module.repo.src.dir}/${current.module.path}">
                    <include name="**"/>
                </fileset>
            </copy>

            <!-- Process the resource -->
            <resources/>

            <!-- Some final cleanup -->
            <replace file="${module.repo.output.dir}/${current.module.path}/${module.xml}">
                <replacetoken>
                    <![CDATA[
        <!-- Insert resources here -->]]></replacetoken>
                <replacevalue>
                </replacevalue>
            </replace>

        </sequential>
    </macrodef>

    <macrodef name="bundle-def">
        <attribute name="name"/>
        <attribute name="slot" default="main"/>
        <element name="resources" implicit="yes" optional="yes"/>

        <sequential>
            <echo message="Initializing bundle -> @{name}"/>
            <property name="bundle.repo.output.dir" value="${output.dir}/bundles/system/layers/base"/>
            <!-- Figure out the correct bundle path -->
            <define-bundle-dir name="@{name}" slot="@{slot}" />

            <!-- Make the bundle output director -->
            <mkdir dir="${bundle.repo.output.dir}/${current.bundle.path}"/>

            <!-- Process the resource -->
            <resources/>

        </sequential>
    </macrodef>

    <macrodef name="maven-bundle" >
        <attribute name="group"/>
        <attribute name="artifact"/>

        <sequential>
            <!-- Copy the jar to the bundle dir -->
            <property name="bundle.repo.output.dir" value="${output.dir}/bundles/system/layers/base"/>
            <copy todir="${bundle.repo.output.dir}/${current.bundle.path}" failonerror="true">
                <fileset file="${@{group}:@{artifact}:jar}"/>
                <mapper type="flatten" />
            </copy>
        </sequential>
    </macrodef>

    <scriptdef name="define-module-dir" language="javascript" manager="bsf">
        <attribute name="name"/>
        <attribute name="slot"/>
        <![CDATA[
            name = attributes.get("name");
            name = name.replace(".", "/");
            project.setProperty("current.module.path", name + "/" + attributes.get("slot"));
        ]]>
    </scriptdef>

    <scriptdef name="define-bundle-dir" language="javascript" manager="bsf">
        <attribute name="name"/>
        <attribute name="slot"/>
        <![CDATA[
            name = attributes.get("name");
            name = name.replace(".", "/");
            project.setProperty("current.bundle.path", name + "/" + attributes.get("slot"));
        ]]>
    </scriptdef>

    <!--
       Get the version from the parent directory of the jar.  If the parent directory is 'target' this
       means that the jar is contained in AS build so extract the version from the file name
    -->
    <scriptdef name="define-maven-artifact" language="javascript"  manager="bsf">
        <attribute name="group"/>
        <attribute name="artifact"/>
        <attribute name="classifier"/>
        <attribute name="element"/>
        <attribute name="path"/>
        <![CDATA[
            importClass(Packages.java.io.File);
            group = attributes.get("group");
            artifact = attributes.get("artifact");
            classifier = attributes.get("classifier");
            element = attributes.get("element");
            path = attributes.get("path");
            if(path.indexOf('${') != -1) {
                throw "Module resource root not found, make sure it is listed in build/pom.xml" + path;
            }
            fp = new File(path);
            version = fp.getParentFile().getName();
            if (version.equals("target")) {
               version = fp.getName();
               version = version.substring(artifact.length() + 1);
               suffix = ".jar";
               if (classifier) {
                  suffix = "-" + classifier + suffix;
               }
               version = version.replace(suffix, "");
            }

            root = "<" + element + " name=\"" + group + ":" + artifact + ":" + version;
            if (classifier) {
               root = root + ":" + classifier;
            }
            root = root + "\"/>";
            project.setProperty("current.maven.root", root);
        ]]>
    </scriptdef>

    <macrodef name="maven-resource" >
        <attribute name="group"/>
        <attribute name="artifact"/>
        <attribute name="jandex" default="false" />

        <sequential>
            <if>
               <equals arg1="${mavenized.modules}" arg2="true"/>
               <then>
                <define-maven-artifact group="@{group}" artifact="@{artifact}" element="artifact" path="${@{group}:@{artifact}:jar}"/>
                <replace file="${module.repo.output.dir}/${current.module.path}/${module.xml}">
                    <replacefilter token="&lt;!-- Insert resources here --&gt;" value="${current.maven.root}&#10;        &lt;!-- Insert resources here --&gt;"/>
                </replace>
               </then>

            <else>
            <!-- Copy the jar to the module dir -->
            <copy todir="${module.repo.output.dir}/${current.module.path}" failonerror="true">
                <fileset file="${@{group}:@{artifact}:jar}"/>
                <mapper type="flatten" />
            </copy>

            <basename file="${@{group}:@{artifact}:jar}" property="resourcename.@{group}.@{artifact}"/>
            <!-- Generate the Jandex Index -->
            <jandex run="@{jandex}" newJar="true" >
                <fileset dir="${module.repo.output.dir}/${current.module.path}" />
            </jandex>
            <!-- Update the resource entry in module.xml -->
            <define-resource-root path="${resourcename.@{group}.@{artifact}}" jandex="@{jandex}"/>
            <replace file="${module.repo.output.dir}/${current.module.path}/${module.xml}">
                <replacefilter token="&lt;!-- Insert resources here --&gt;" value="${current.resource.root}&#10;        &lt;!-- Insert resources here --&gt;"/>
            </replace>
            </else>
            </if>
        </sequential>
    </macrodef>
	
    <macrodef name="maven-resource-bundle" >
        <attribute name="group"/>
        <attribute name="artifact"/>
        <attribute name="subdir"/>

        <sequential>
            <if>
               <equals arg1="${mavenized.modules}" arg2="true"/>
            <then/>
            <else>
               <!-- Copy the jar to the module dir -->
               <copy todir="${module.repo.output.dir}/${current.module.path}/@{subdir}" failonerror="true">
                  <fileset file="${@{group}:@{artifact}:jar}"/>
                  <mapper type="flatten" />
               </copy>
            </else>
            </if>
        </sequential>
    </macrodef>

    <macrodef name="maven-resource-with-classifier" >
        <attribute name="group"/>
        <attribute name="artifact"/>
        <attribute name="classifier"/>
        <attribute name="jandex" default="false" />

        <sequential>
            <if>
            <equals arg1="${mavenized.modules}" arg2="true"/>
            <then>
                <define-maven-artifact group="@{group}" artifact="@{artifact}" element="artifact" classifier="@{classifier}" path="${@{group}:@{artifact}:jar:@{classifier}}"/>
                <replace file="${module.repo.output.dir}/${current.module.path}/${module.xml}">
                    <replacefilter token="&lt;!-- Insert resources here --&gt;" value="${current.maven.root}&#10;        &lt;!-- Insert resources here --&gt;"/>
                </replace>
            </then>
            <else>
            <!-- Copy the jar to the module dir -->
            <copy todir="${module.repo.output.dir}/${current.module.path}" failonerror="true">
                <fileset file="${@{group}:@{artifact}:jar:@{classifier}}"/>
                <!-- http://jira.codehaus.org/browse/MANTRUN-159 -->
                <mapper type="flatten" />
            </copy>

            <basename file="${@{group}:@{artifact}:jar:@{classifier}}" property="resourcename.@{group}.@{artifact}.@{classifier}"/>

            <!-- Update the resource entry in module.xml -->
            <define-resource-root path="${resourcename.@{group}.@{artifact}.@{classifier}}"/>
            <replace file="${module.repo.output.dir}/${current.module.path}/${module.xml}">
                <replacefilter token="&lt;!-- Insert resources here --&gt;" value="${current.resource.root}&#10;        &lt;!-- Insert resources here --&gt;"/>
            </replace>
            </else>
            </if>
        </sequential>
    </macrodef>

    <macrodef name="extract-native-jar" >
        <attribute name="group"/>
        <attribute name="artifact"/>
        <sequential>
            <if>
            <equals arg1="${mavenized.modules}" arg2="true"/>
            <then>
                <define-maven-artifact group="@{group}" artifact="@{artifact}" element="native-artifact" path="${@{group}:@{artifact}:jar}"/>
                <replace file="${module.repo.output.dir}/${current.module.path}/${module.xml}">
                    <replacefilter token="&lt;!-- Insert resources here --&gt;" value="${current.maven.root}&#10;        &lt;!-- Insert resources here --&gt;"/>
                </replace>
            </then>

            <else>
            <unzip src="${@{group}:@{artifact}:jar}" dest="${module.repo.output.dir}/${current.module.path}">
           <patternset>
               <include name="lib/**"/>
           </patternset>
           </unzip>
           </else>
           </if>
        </sequential>
    </macrodef>

    <scriptdef name="define-resource-root" language="javascript" manager="bsf">
        <attribute name="path"/>
        <attribute name="jandex"/>
        <![CDATA[
            path = attributes.get("path");
            root = "<resource-root path=\"" + path + "\"/>";
            if(path.indexOf('${') != -1) {
                throw "Module resource root not found, make sure it is listed in build/pom.xml" + path;
            }
            if(attributes.get("jandex") == "true" ) {
                root = root + "\n\t<resource-root path=\"" + path.replace(".jar","-jandex.jar") + "\"/>";
            }
            project.setProperty("current.resource.root", root);
        ]]>
    </scriptdef>

</project>