587
|
1 |
<?xml version="1.0"?>
|
|
2 |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exslt="http://exslt.org/common" exclude-result-prefixes="exslt">
|
|
3 |
<!--Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
4 |
All rights reserved.
|
|
5 |
This component and the accompanying materials are made available
|
628
|
6 |
under the terms of the License "Eclipse Public License v1.0"
|
587
|
7 |
which accompanies this distribution, and is available
|
|
8 |
at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
9 |
|
|
10 |
Initial Contributors:
|
|
11 |
Nokia Corporation - initial contribution.
|
|
12 |
Contributors:
|
|
13 |
Description:
|
|
14 |
Filter a sysdef in the 2.0 or 3.0 syntax
|
628
|
15 |
The functionality of these filters is not supported outside of this tool.
|
|
16 |
The filtering concepts here may not be carried forward in future system definition processing tools
|
587
|
17 |
-->
|
628
|
18 |
<!--Description:This filters a sysdef in either the 2.0 or 3.0 syntax
|
|
19 |
If using the 3.0 syntax, specific IDs optionally be included verbatim
|
|
20 |
-->
|
|
21 |
|
|
22 |
<!--Input:<sysdef> - (required) The system definition XML file to process.
|
|
23 |
Can be in the 2.0 or 3.0 format, and can be a fragment or
|
|
24 |
stand-alone.-->
|
|
25 |
<!--Output:<sysdef> - (optional) The system definition XML file to save the
|
|
26 |
output as. If not present it will write to stdout.-->
|
|
27 |
|
587
|
28 |
<xsl:output method="xml" indent="yes"/>
|
|
29 |
|
628
|
30 |
<xsl:param name="filter-type">only</xsl:param>
|
|
31 |
<!-- <type> - The method of filtering. Legal values are:
|
|
32 |
"only" = every component/unit can only have zero or more of
|
|
33 |
these specified filters. ie, it can only have filters
|
|
34 |
from this list, no other filters are allowed. This
|
|
35 |
covers the common use case of "I want anything with gt
|
|
36 |
and or techview, but no other filters" that was the
|
|
37 |
first step in all old symbian.com builds.
|
|
38 |
|
|
39 |
"has" = every component/unit must have all of these filters.
|
|
40 |
ie it can have any other filters, but all specified
|
|
41 |
filters must all be present. This covers the case where
|
|
42 |
filter="test" identifies tests and there is no special
|
|
43 |
filter to identify things that are not tests. So a
|
|
44 |
filter for "!test" will strip out anything with
|
|
45 |
filter="test" (plus any other filters) for a production
|
|
46 |
build, and a filter of "test" will strip out everything
|
|
47 |
that does not have filter="test" (plus any other
|
|
48 |
filters) for a test build. Opposite filters will
|
|
49 |
generate sets that are exactly opposite to each other.
|
587
|
50 |
|
628
|
51 |
"with" = components/units that have the opposite filter are
|
|
52 |
removed. This covers the old symbian.com case of
|
|
53 |
java, !java and "don't care" components. In other words
|
|
54 |
we have a global feature that every item can be built
|
|
55 |
only when the feature is set, only when the feature is
|
|
56 |
not set, or it does not care and will always be built.
|
|
57 |
So for a !java build only items containing filter="java"
|
|
58 |
are stripped out. For a java build, only items with
|
|
59 |
filter="!java" are stripped out. Anything which does not
|
|
60 |
explicitly mention java are always unaffected. Opposite
|
|
61 |
filters will generate sets which overlap.
|
|
62 |
-->
|
|
63 |
|
587
|
64 |
|
628
|
65 |
<xsl:param name="filter"/> <!-- <list> - (required) A comma-separated list of filters
|
|
66 |
used to process the sysdef.-->
|
|
67 |
|
|
68 |
<xsl:param name="addbuild" select="0"/> <!--1 - (optional) If present, it will add a system build
|
|
69 |
section that accepts everything. This is needed for genxml
|
|
70 |
processing -->
|
587
|
71 |
|
628
|
72 |
<xsl:param name="verbatim"/> <!-- <list> - (optional) A comma-separated list of system
|
|
73 |
model IDs to include unfiltered. IDs must take the form as in
|
|
74 |
the document they appear (ie using the same namespace prefix).
|
|
75 |
This does not work on 2.0 syntax sysdefs. -->
|
|
76 |
|
|
77 |
<xsl:variable name="ID-list" select="concat(',',translate(normalize-space($verbatim),' ',''),',')"/> <!-- remove all spaces from $idlist and add surrounding commas for easier processing-->
|
587
|
78 |
|
|
79 |
<xsl:template match="node()|@*"><xsl:copy-of select="."/></xsl:template>
|
|
80 |
<xsl:template match="*"><xsl:param name="data"/>
|
|
81 |
<xsl:copy>
|
|
82 |
<xsl:copy-of select="@*"/>
|
|
83 |
<xsl:apply-templates select="node()">
|
|
84 |
<xsl:with-param name="data" select="$data"/>
|
|
85 |
</xsl:apply-templates>
|
|
86 |
</xsl:copy>
|
|
87 |
</xsl:template>
|
|
88 |
|
|
89 |
<xsl:template match="component|unit"><xsl:param name="data"/> <!-- filterable items -->
|
|
90 |
<xsl:variable name="display">
|
|
91 |
<xsl:apply-templates select="$data" mode="filter">
|
|
92 |
<xsl:with-param name="item" select="current()"/>
|
|
93 |
</xsl:apply-templates>
|
|
94 |
</xsl:variable>
|
628
|
95 |
<xsl:if test="$display != 'hide' or ($verbatim != '' and ancestor-or-self::*[contains($ID-list,concat(',',@id,','))])">
|
|
96 |
<!-- if 'hide', remove completely from the output, but always include any ID listed as a $ID-list item-->
|
587
|
97 |
<xsl:copy>
|
|
98 |
<xsl:copy-of select="@*"/>
|
|
99 |
<xsl:apply-templates select="node()">
|
|
100 |
<xsl:with-param name="data" select="$data"/>
|
|
101 |
</xsl:apply-templates>
|
|
102 |
</xsl:copy>
|
|
103 |
</xsl:if>
|
|
104 |
</xsl:template>
|
|
105 |
|
|
106 |
<xsl:template match="/SystemDefinition">
|
|
107 |
<xsl:variable name="f">
|
|
108 |
<xsl:element name="filter-{$filter-type}">
|
|
109 |
<xsl:call-template name="filter-list">
|
|
110 |
<xsl:with-param name="f" select="$filter"/>
|
|
111 |
</xsl:call-template>
|
|
112 |
</xsl:element>
|
|
113 |
</xsl:variable>
|
|
114 |
<xsl:choose>
|
|
115 |
<xsl:when test="starts-with(@schema,'3.0')"/> <!-- no DTD needed for 3.0 sysdef -->
|
|
116 |
<xsl:when test="$addbuild">
|
|
117 |
<xsl:call-template name="DTD-bld"/> <!-- insert 2.0.1 DTD w/sysbuild parts-->
|
|
118 |
</xsl:when>
|
|
119 |
<xsl:otherwise>
|
|
120 |
<xsl:call-template name="DTD"/> <!-- insert 2.0.1 DTD -->
|
|
121 |
</xsl:otherwise>
|
|
122 |
</xsl:choose>
|
|
123 |
<xsl:copy>
|
|
124 |
<xsl:copy-of select="@*"/>
|
|
125 |
<xsl:variable name="content"> <!-- save content for potential further processing -->
|
|
126 |
<xsl:apply-templates select="node()">
|
|
127 |
<xsl:with-param name="data" select="exslt:node-set($f)/*"/>
|
|
128 |
</xsl:apply-templates>
|
|
129 |
</xsl:variable>
|
|
130 |
<!-- just output content as is. We could create a template to remove any filtered out items, but so far there's no compelling need -->
|
|
131 |
<xsl:copy-of select="$content"/>
|
|
132 |
|
|
133 |
<xsl:if test="$addbuild">
|
|
134 |
<SystemBuild schema="1.0.0">
|
|
135 |
<configuration name="any" description="text">
|
|
136 |
<xsl:attribute name="filter">
|
|
137 |
<xsl:for-each select="//@filter[not(.=following::*/@filter)]">
|
|
138 |
<xsl:value-of select="."/><xsl:if test="position()!=last()">,</xsl:if>
|
|
139 |
</xsl:for-each>
|
|
140 |
</xsl:attribute>
|
|
141 |
<xsl:for-each select="exslt:node-set($content)/systemModel/layer[descendant::unit]">
|
|
142 |
<!-- only include layers we know have units -->
|
|
143 |
<ref item="{@name}"/>
|
|
144 |
</xsl:for-each>
|
|
145 |
</configuration>
|
|
146 |
</SystemBuild>
|
|
147 |
</xsl:if>
|
|
148 |
</xsl:copy>
|
|
149 |
</xsl:template>
|
|
150 |
|
|
151 |
|
628
|
152 |
<xsl:include href="lib/filter-module.xsl"/>
|
587
|
153 |
|
|
154 |
<xsl:template name="DTD-bld">
|
|
155 |
<xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE SystemDefinition [
|
|
156 |
<!ELEMENT SystemDefinition ( systemModel?, SystemBuild? )>
|
|
157 |
<!ATTLIST SystemDefinition
|
|
158 |
name CDATA #REQUIRED
|
|
159 |
schema CDATA #REQUIRED>
|
|
160 |
<!ELEMENT systemModel (layer+)>
|
|
161 |
<!ELEMENT layer (block* | collection*)*>
|
|
162 |
<!ATTLIST layer
|
|
163 |
name CDATA #REQUIRED
|
|
164 |
long-name CDATA #IMPLIED
|
|
165 |
levels NMTOKENS #IMPLIED
|
|
166 |
span CDATA #IMPLIED>
|
|
167 |
<!ELEMENT block (subblock* | collection*)*>
|
|
168 |
<!ATTLIST block
|
|
169 |
levels NMTOKENS #IMPLIED
|
|
170 |
span CDATA #IMPLIED
|
|
171 |
level NMTOKEN #IMPLIED
|
|
172 |
name CDATA #REQUIRED
|
|
173 |
long-name CDATA #IMPLIED>
|
|
174 |
<!ELEMENT subblock (collection)*>
|
|
175 |
<!ATTLIST subblock
|
|
176 |
name CDATA #REQUIRED
|
|
177 |
long-name CDATA #IMPLIED>
|
|
178 |
<!ELEMENT collection (component)*>
|
|
179 |
<!ATTLIST collection
|
|
180 |
name CDATA #REQUIRED
|
|
181 |
long-name CDATA #IMPLIED
|
|
182 |
level NMTOKEN #IMPLIED>
|
|
183 |
<!ELEMENT component (unit)*>
|
|
184 |
<!ATTLIST component
|
|
185 |
name CDATA #REQUIRED
|
|
186 |
long-name CDATA #IMPLIED
|
|
187 |
deprecated CDATA #IMPLIED
|
|
188 |
introduced CDATA #IMPLIED
|
|
189 |
contract CDATA #IMPLIED
|
|
190 |
plugin (Y|N) "N"
|
|
191 |
filter CDATA #IMPLIED
|
|
192 |
class NMTOKENS #IMPLIED
|
|
193 |
supports CDATA #IMPLIED
|
|
194 |
purpose ( optional | mandatory | development ) "optional">
|
|
195 |
<!ELEMENT unit EMPTY>
|
|
196 |
<!ATTLIST unit
|
|
197 |
mrp CDATA #IMPLIED
|
|
198 |
filter CDATA #IMPLIED
|
|
199 |
bldFile CDATA #IMPLIED
|
|
200 |
root CDATA #IMPLIED
|
|
201 |
version NMTOKEN #IMPLIED
|
|
202 |
prebuilt NMTOKEN #IMPLIED
|
|
203 |
late (Y|N) #IMPLIED
|
|
204 |
priority CDATA #IMPLIED>
|
|
205 |
<!ELEMENT SystemBuild (option* | target+ | targetList+ | list+ | configuration+)*>
|
|
206 |
<!ATTLIST SystemBuild schema CDATA #REQUIRED>
|
|
207 |
<!ELEMENT list (ref+)>
|
|
208 |
<!ATTLIST list
|
|
209 |
name ID #REQUIRED
|
|
210 |
description CDATA #REQUIRED>
|
|
211 |
<!ELEMENT ref EMPTY>
|
|
212 |
<!ATTLIST ref item CDATA #REQUIRED>
|
|
213 |
<!ELEMENT targetList EMPTY>
|
|
214 |
<!ATTLIST targetList
|
|
215 |
name ID #REQUIRED
|
|
216 |
description CDATA #REQUIRED
|
|
217 |
target IDREFS #REQUIRED>
|
|
218 |
<!ELEMENT target EMPTY>
|
|
219 |
<!ATTLIST target
|
|
220 |
name ID #REQUIRED
|
|
221 |
abldTarget CDATA #REQUIRED
|
|
222 |
description CDATA #REQUIRED>
|
|
223 |
<!ELEMENT option EMPTY>
|
|
224 |
<!ATTLIST option
|
|
225 |
name ID #REQUIRED
|
|
226 |
abldOption CDATA #REQUIRED
|
|
227 |
description CDATA #REQUIRED
|
|
228 |
enable (Y | N ) #REQUIRED>
|
|
229 |
<!ELEMENT configuration (listRef+ | ref+ | task+)*>
|
|
230 |
<!ATTLIST configuration
|
|
231 |
name ID #REQUIRED
|
|
232 |
description CDATA #REQUIRED
|
|
233 |
filter CDATA #REQUIRED>
|
|
234 |
<!ELEMENT task (listRef* , (buildLayer | specialInstructions))>
|
|
235 |
<!ELEMENT listRef EMPTY>
|
|
236 |
<!ATTLIST listRef list CDATA #REQUIRED>
|
|
237 |
<!ELEMENT buildLayer EMPTY>
|
|
238 |
<!ATTLIST buildLayer
|
|
239 |
command CDATA #REQUIRED
|
|
240 |
targetList IDREFS #IMPLIED
|
|
241 |
unitParallel (Y | N ) #REQUIRED
|
|
242 |
targetParallel (Y | N ) "N">
|
|
243 |
<!ELEMENT specialInstructions EMPTY>
|
|
244 |
<!ATTLIST specialInstructions
|
|
245 |
name CDATA #REQUIRED
|
|
246 |
cwd CDATA #REQUIRED
|
|
247 |
root CDATA #IMPLIED
|
|
248 |
command CDATA #REQUIRED>
|
|
249 |
]>
|
|
250 |
]]></xsl:text>
|
|
251 |
</xsl:template>
|
|
252 |
|
|
253 |
<xsl:template name="DTD">
|
|
254 |
<xsl:text disable-output-escaping="yes"><![CDATA[<!DOCTYPE SystemDefinition [
|
|
255 |
<!ELEMENT SystemDefinition ( systemModel )>
|
|
256 |
<!ATTLIST SystemDefinition
|
|
257 |
name CDATA #REQUIRED
|
|
258 |
schema CDATA #REQUIRED
|
|
259 |
>
|
|
260 |
<!-- all paths are relative to the environment variable specified by the root attribute, or SOURCEROOT if not. -->
|
|
261 |
|
|
262 |
<!-- System Model Section of DTD -->
|
|
263 |
<!ELEMENT systemModel (layer+)>
|
|
264 |
|
|
265 |
<!ELEMENT layer (block* | collection*)*>
|
|
266 |
<!-- Kernel Services, Base Services, OS Services, Etc -->
|
|
267 |
<!ATTLIST layer
|
|
268 |
name CDATA #REQUIRED
|
|
269 |
long-name CDATA #IMPLIED
|
|
270 |
levels NMTOKENS #IMPLIED
|
|
271 |
span CDATA #IMPLIED
|
|
272 |
>
|
|
273 |
|
|
274 |
<!ELEMENT block (subblock* | collection*)*>
|
|
275 |
<!-- Generic OS services, Comms Services, etc -->
|
|
276 |
<!ATTLIST block
|
|
277 |
levels NMTOKENS #IMPLIED
|
|
278 |
span CDATA #IMPLIED
|
|
279 |
level NMTOKEN #IMPLIED
|
|
280 |
name CDATA #REQUIRED
|
|
281 |
long-name CDATA #IMPLIED
|
|
282 |
>
|
|
283 |
|
|
284 |
<!ELEMENT subblock (collection)*>
|
|
285 |
<!-- Cellular Baseband Services, Networking Services, etc -->
|
|
286 |
<!ATTLIST subblock
|
|
287 |
name CDATA #REQUIRED
|
|
288 |
long-name CDATA #IMPLIED
|
|
289 |
>
|
|
290 |
|
|
291 |
<!ELEMENT collection (component)*>
|
|
292 |
<!-- Screen Driver, Content Handling, etc -->
|
|
293 |
<!ATTLIST collection
|
|
294 |
name CDATA #REQUIRED
|
|
295 |
long-name CDATA #IMPLIED
|
|
296 |
level NMTOKEN #IMPLIED
|
|
297 |
>
|
|
298 |
|
|
299 |
<!ELEMENT component (unit)*>
|
|
300 |
<!-- contains units or is a package or prebuilt -->
|
|
301 |
<!ATTLIST component
|
|
302 |
name CDATA #REQUIRED
|
|
303 |
long-name CDATA #IMPLIED
|
|
304 |
deprecated CDATA #IMPLIED
|
|
305 |
introduced CDATA #IMPLIED
|
|
306 |
contract CDATA #IMPLIED
|
|
307 |
plugin (Y|N) "N"
|
|
308 |
filter CDATA #IMPLIED
|
|
309 |
class NMTOKENS #IMPLIED
|
|
310 |
supports CDATA #IMPLIED
|
|
311 |
purpose ( optional | mandatory | development ) "optional"
|
|
312 |
>
|
|
313 |
|
|
314 |
<!ELEMENT unit EMPTY >
|
|
315 |
<!-- must be buildable (bld.inf) -->
|
|
316 |
<!-- bldFile may someday be removed in favour of mrp -->
|
|
317 |
<!ATTLIST unit
|
|
318 |
mrp CDATA #IMPLIED
|
|
319 |
filter CDATA #IMPLIED
|
|
320 |
bldFile CDATA #IMPLIED
|
|
321 |
root CDATA #IMPLIED
|
|
322 |
version NMTOKEN #IMPLIED
|
|
323 |
prebuilt NMTOKEN #IMPLIED
|
|
324 |
late (Y|N) #IMPLIED
|
|
325 |
priority CDATA #IMPLIED
|
|
326 |
>
|
|
327 |
]>
|
|
328 |
]]></xsl:text>
|
|
329 |
</xsl:template>
|
|
330 |
</xsl:stylesheet> |