sdk-addon-05.xsd revision 4c3b19c11bed6972f2ebf758af4025607b41b11b
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 * Copyright (C) 2011 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16-->
17<xsd:schema
18    targetNamespace="http://schemas.android.com/sdk/android/addon/5"
19    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
20    xmlns:sdk="http://schemas.android.com/sdk/android/addon/5"
21    elementFormDefault="qualified"
22    attributeFormDefault="unqualified"
23    version="1">
24
25    <!-- The repository contains a collection of downloadable items known as
26         "packages". Each package has a type and various attributes and contains
27         a list of file "archives" that can be downloaded for specific OSes.
28
29         An Android Addon repository is a web site that contains an "addon.xml"
30         file that conforms to this XML Schema.
31
32         History:
33         - v1 is used by the SDK Updater in Tools r8. It is split out of the
34           main SDK Repository XML Schema and can only contain <addon> and
35           <extra> packages.
36
37         - v2 is used by the SDK Updater in Tools r12.
38            - <extra> element now has a <project-files> element that contains 1 or
39              or more <path>, each indicating the relative path of a file that this package
40              can contribute to installed projects.
41            - <addon> element now has an optional <layoutlib> that indicates the API
42              and revision of the layout library for this particular add-on, if any.
43
44         - v3 is used by the SDK Manager in Tools r14:
45            - <extra> now has an <old-paths> element, a ;-separated list of old paths that
46              should be detected and migrated to the new <path> for that package.
47
48         - v4 is used by the SDK Manager in Tools r18:
49            - <extra> and <addon> are not in the Repository XSD v6 anymore.
50            - <extra> get a new field <name-display>, which is used by the SDK Manager to
51              customize the name of the extra in the list display. The single <vendor>
52              field becomes <vendor-id> and <vendor-display>, the id being used internally
53              and the display in the UI.
54            - <addon> does the same, where <name> is replaced by <name-id> and <name-display>
55              and <vendor> is replaced by <vendor-id> and <vendor-display>.
56
57         - v5 is used by the SDK Manager in Tools r20:
58            - The <beta-rc> element is no longer supported. It was never implemented anyway.
59            - For <tool> and <platform-tool> packages, the <revision> element becomes a
60              a "full revision" element with <major>, <minor>, <micro> and <preview> sub-elements.
61            - <min-tools-rev> for <extra> becomes a full revision element.
62    -->
63
64    <xsd:element name="sdk-addon" type="sdk:repositoryType" />
65
66    <xsd:complexType name="repositoryType">
67        <xsd:annotation>
68            <xsd:documentation>
69                The repository contains a collection of downloadable packages.
70            </xsd:documentation>
71        </xsd:annotation>
72        <xsd:choice minOccurs="0" maxOccurs="unbounded">
73            <xsd:element name="add-on"          type="sdk:addonType"        />
74            <xsd:element name="extra"           type="sdk:extraType"        />
75            <xsd:element name="license"         type="sdk:licenseType"      />
76        </xsd:choice>
77    </xsd:complexType>
78
79
80    <!-- The definition of an SDK Add-on package. -->
81
82    <xsd:complexType name="addonType">
83        <xsd:annotation>
84            <xsd:documentation>An SDK add-on package.</xsd:documentation>
85        </xsd:annotation>
86        <xsd:all>
87            <!-- The internal name id of the add-on. Must be unique per vendor. -->
88            <xsd:element name="name-id"         type="sdk:idType" />
89            <!-- The displayed name of the add-on. -->
90            <xsd:element name="name-display"    type="xsd:normalizedString" />
91
92            <!-- The internal vendor id of the add-on. Must be unique amongst vendors. -->
93            <xsd:element name="vendor-id"       type="sdk:idType" />
94            <!-- The displayed vendor name of the add-on. -->
95            <xsd:element name="vendor-display"  type="xsd:normalizedString" />
96
97            <!-- The Android API Level for the add-on. An int > 0. -->
98            <xsd:element name="api-level"    type="xsd:positiveInteger"  />
99            <!-- Note: Add-ons do not support 'codenames' (a.k.a. API previews). -->
100            <!-- The revision, an int > 0, incremented each time a new
101                 package is generated. -->
102            <xsd:element name="revision"     type="xsd:positiveInteger" />
103
104            <!-- An add-on can declare 0 or more libraries.
105                 This element is mandatory but it can be empty.
106            -->
107
108            <xsd:element name="libs">
109                <xsd:complexType>
110                    <xsd:sequence minOccurs="0" maxOccurs="unbounded">
111                        <xsd:element name="lib">
112                            <xsd:complexType>
113                                <xsd:all>
114                                    <!-- The name of the library. -->
115                                    <xsd:element name="name" type="xsd:normalizedString" />
116                                    <!-- The optional description of this add-on library. -->
117                                    <xsd:element name="description" type="xsd:string" minOccurs="0" />
118                                </xsd:all>
119                            </xsd:complexType>
120                        </xsd:element>
121                    </xsd:sequence>
122                </xsd:complexType>
123            </xsd:element>
124
125            <!-- optional elements -->
126
127            <!-- The optional license of this package. If present, users will have
128                 to agree to it before downloading. -->
129            <xsd:element name="uses-license" type="sdk:usesLicenseType" minOccurs="0" />
130            <!-- The optional description of this package. -->
131            <xsd:element name="description"  type="xsd:string"      minOccurs="0" />
132            <!-- The optional description URL of this package -->
133            <xsd:element name="desc-url"     type="xsd:token"       minOccurs="0" />
134            <!-- The optional release note for this package. -->
135            <xsd:element name="release-note" type="xsd:string"      minOccurs="0" />
136            <!-- The optional release note URL of this package -->
137            <xsd:element name="release-url"  type="xsd:token"       minOccurs="0" />
138            <!-- A list of file archives for this package. -->
139            <xsd:element name="archives"     type="sdk:archivesType" />
140
141            <!-- An optional element indicating the package is obsolete.
142                 The string content is however currently not defined and ignored. -->
143            <xsd:element name="obsolete"  type="xsd:string" minOccurs="0" />
144
145            <!-- Optional information on the layoutlib packaged in this platform. -->
146            <xsd:element name="layoutlib" type="sdk:layoutlibType"  minOccurs="0" />
147        </xsd:all>
148    </xsd:complexType>
149
150
151    <xsd:simpleType name="idType">
152        <xsd:annotation>
153            <xsd:documentation>
154                An ID string for an addon/extra name-id or vendor-id
155                can only be simple alphanumeric string.
156            </xsd:documentation>
157        </xsd:annotation>
158        <xsd:restriction base="xsd:token">
159            <xsd:pattern value="[a-zA-Z0-9_-]+"/>
160        </xsd:restriction>
161    </xsd:simpleType>
162
163
164    <!-- The definition of a layout library used by an addon. -->
165
166    <xsd:complexType name="layoutlibType" >
167        <xsd:annotation>
168            <xsd:documentation>
169                Version information for a layoutlib included in an addon.
170            .</xsd:documentation>
171        </xsd:annotation>
172        <xsd:all>
173            <!-- The layoutlib API level, an int > 0,
174                 incremented with each new incompatible lib. -->
175            <xsd:element name="api"          type="xsd:positiveInteger" />
176            <!-- The incremental minor revision for that API, e.g. in case of bug fixes.
177                 Optional. An int >= 0, assumed to be 0 if the element is missing. -->
178            <xsd:element name="revision"     type="xsd:nonNegativeInteger" minOccurs="0" />
179        </xsd:all>
180    </xsd:complexType>
181
182
183    <!-- The definition of an SDK extra package. This kind of package is for
184         "free" content. Such packages are installed in SDK/extras/vendor/path.
185    -->
186
187    <xsd:complexType name="extraType" >
188        <xsd:annotation>
189            <xsd:documentation>
190                An SDK extra package. This kind of package is for "free" content.
191                Such packages are installed in SDK/vendor/path.
192            </xsd:documentation>
193        </xsd:annotation>
194        <xsd:all>
195            <!-- The displayed name of the extra. -->
196            <xsd:element name="name-display"    type="xsd:normalizedString" />
197
198            <!-- The internal vendor id of the extra. Must be unique amongst vendors. -->
199            <xsd:element name="vendor-id"       type="sdk:idType" />
200            <!-- The displayed vendor name of the extra. -->
201            <xsd:element name="vendor-display"  type="xsd:normalizedString" />
202
203            <!-- The install path sub-folder name. It must not be empty. -->
204            <xsd:element name="path" type="sdk:segmentType" />
205
206            <!-- A semi-colon separated list of "obsolete" path names which are equivalent
207                 to the current 'path' name. When a package is seen using an old-paths' name,
208                 the package manager will try to upgrade it to the new path. -->
209            <xsd:element name="old-paths" type="sdk:segmentListType"  minOccurs="0" />
210
211            <!-- The revision, an int > 0, incremented each time a new
212                 package is generated. -->
213            <xsd:element name="revision"     type="xsd:positiveInteger" />
214
215            <!-- A list of file archives for this package. -->
216            <xsd:element name="archives"     type="sdk:archivesType" />
217
218            <!--  optional elements -->
219
220            <!-- The optional license of this package. If present, users will have
221                 to agree to it before downloading. -->
222            <xsd:element name="uses-license" type="sdk:usesLicenseType"  minOccurs="0" />
223            <!-- The optional description of this package. -->
224            <xsd:element name="description"  type="xsd:string"           minOccurs="0" />
225            <!-- The optional description URL of this package -->
226            <xsd:element name="desc-url"     type="xsd:token"            minOccurs="0" />
227            <!-- The optional release note for this package. -->
228            <xsd:element name="release-note" type="xsd:string"           minOccurs="0" />
229            <!-- The optional release note URL of this package -->
230            <xsd:element name="release-url"  type="xsd:token"            minOccurs="0" />
231            <!-- The minimal revision of tools required by this package.
232                 Optional. If present, must be a revision element. -->
233            <xsd:element name="min-tools-rev" type="sdk:revisionType"    minOccurs="0" />
234            <!-- The minimal API level required by this package.
235                 Optional. If present, must be an int > 0. -->
236            <xsd:element name="min-api-level" type="xsd:positiveInteger" minOccurs="0" />
237
238            <!-- An optional element indicating the package is obsolete.
239                 The string content is however currently not defined and ignored. -->
240            <xsd:element name="obsolete"      type="xsd:string" minOccurs="0" />
241
242            <!-- A list of project files contributed by this package. Optional. -->
243            <xsd:element name="project-files" type="sdk:projectFilesType" minOccurs="0" />
244        </xsd:all>
245    </xsd:complexType>
246
247
248    <!-- A full revision, with a major.minor.micro and an optional preview number.
249         The major number is mandatory, the other elements are optional.
250     -->
251
252    <xsd:complexType name="revisionType">
253        <xsd:annotation>
254            <xsd:documentation>
255                A full revision, with a major.minor.micro and an
256                optional preview number. The major number is mandatory.
257            </xsd:documentation>
258        </xsd:annotation>
259        <xsd:all>
260            <!-- The major revision, an int > 0, incremented each time a new
261                 package is generated. -->
262            <xsd:element name="major"      type="xsd:positiveInteger" />
263            <!-- The minor revision, an int >= 0, incremented each time a new
264                 minor package is generated. Assumed to be 0 if missing. -->
265            <xsd:element name="minor"     type="xsd:nonNegativeInteger" minOccurs="0" />
266            <!-- The micro revision, an int >= 0, incremented each time a new
267                 buf fix is generated. Assumed to be 0 if missing. -->
268            <xsd:element name="micro"     type="xsd:nonNegativeInteger" minOccurs="0" />
269            <!-- The preview/release candidate revision, an int > 0,
270                 incremented each time a new preview is generated.
271                 Not present for final releases. -->
272            <xsd:element name="preview"   type="xsd:positiveInteger" minOccurs="0" />
273        </xsd:all>
274    </xsd:complexType>
275
276
277    <!-- The definition of a path segment used by the extra element. -->
278
279    <xsd:simpleType name="segmentType">
280        <xsd:annotation>
281            <xsd:documentation>
282                One path segment for the install path of an extra element.
283                It must be a single-segment path. It must not be empty.
284            </xsd:documentation>
285        </xsd:annotation>
286        <xsd:restriction base="xsd:token">
287            <xsd:pattern value="[a-zA-Z0-9_]+"/>
288        </xsd:restriction>
289    </xsd:simpleType>
290
291    <xsd:simpleType name="segmentListType">
292        <xsd:annotation>
293            <xsd:documentation>
294                A semi-colon separated list of a segmentTypes.
295            </xsd:documentation>
296        </xsd:annotation>
297        <xsd:restriction base="xsd:token">
298            <xsd:pattern value="[a-zA-Z0-9_;]+"/>
299        </xsd:restriction>
300    </xsd:simpleType>
301
302
303    <!-- The definition of a license to be referenced by the uses-license element. -->
304
305    <xsd:complexType name="licenseType">
306        <xsd:annotation>
307            <xsd:documentation>
308                A license definition. Such a license must be used later as a reference
309                using a uses-license element in one of the package elements.
310            </xsd:documentation>
311        </xsd:annotation>
312        <xsd:simpleContent>
313            <xsd:extension base="xsd:string">
314                <xsd:attribute name="id"   type="xsd:ID" />
315                <xsd:attribute name="type" type="xsd:token" fixed="text" />
316            </xsd:extension>
317        </xsd:simpleContent>
318    </xsd:complexType>
319
320
321    <!-- Type describing the license used by a package.
322         The license MUST be defined using a license node and referenced
323         using the ref attribute of the license element inside a package.
324     -->
325
326    <xsd:complexType name="usesLicenseType">
327        <xsd:annotation>
328            <xsd:documentation>
329                Describes the license used by a package. The license MUST be defined
330                using a license node and referenced using the ref attribute of the
331                license element inside a package.
332            </xsd:documentation>
333        </xsd:annotation>
334        <xsd:attribute name="ref" type="xsd:IDREF" />
335    </xsd:complexType>
336
337
338    <!-- A collection of files that can be downloaded for a given architecture.
339         The <archives> node is mandatory in the repository elements and the
340         collection must have at least one <archive> declared.
341         Each archive is a zip file that will be unzipped in a location that depends
342         on its package type.
343     -->
344
345    <xsd:complexType name="archivesType">
346        <xsd:annotation>
347            <xsd:documentation>
348                A collection of files that can be downloaded for a given architecture.
349                The &lt;archives&gt; node is mandatory in the repository packages and the
350                collection must have at least one &lt;archive&gt; declared.
351                Each archive is a zip file that will be unzipped in a location that depends
352                on its package type.
353            </xsd:documentation>
354        </xsd:annotation>
355        <xsd:sequence minOccurs="1" maxOccurs="unbounded">
356            <!-- One archive file -->
357            <xsd:element name="archive">
358                <xsd:complexType>
359                    <!-- Properties of the archive file -->
360                    <xsd:all>
361                        <!-- The size in bytes of the archive to download. -->
362                        <xsd:element name="size"     type="xsd:positiveInteger" />
363                        <!-- The checksum of the archive file. -->
364                        <xsd:element name="checksum" type="sdk:checksumType" />
365                        <!-- The URL is an absolute URL if it starts with http://, https://
366                             or ftp://. Otherwise it is relative to the parent directory that
367                             contains this repository.xml -->
368                        <xsd:element name="url"      type="xsd:token" />
369                    </xsd:all>
370
371                    <!-- Attributes that identify the OS and architecture -->
372                    <xsd:attribute name="os" use="required">
373                        <xsd:simpleType>
374                            <xsd:restriction base="xsd:token">
375                                <xsd:enumeration value="any" />
376                                <xsd:enumeration value="linux" />
377                                <xsd:enumeration value="macosx" />
378                                <xsd:enumeration value="windows" />
379                            </xsd:restriction>
380                        </xsd:simpleType>
381                    </xsd:attribute>
382                    <xsd:attribute name="arch" use="optional">
383                        <xsd:simpleType>
384                            <xsd:restriction base="xsd:token">
385                                <xsd:enumeration value="any" />
386                                <xsd:enumeration value="ppc" />
387                                <xsd:enumeration value="x86" />
388                                <xsd:enumeration value="x86_64" />
389                            </xsd:restriction>
390                        </xsd:simpleType>
391                    </xsd:attribute>
392                </xsd:complexType>
393            </xsd:element>
394        </xsd:sequence>
395    </xsd:complexType>
396
397
398    <!-- A collection of file paths available in an &lt;extra&gt; package
399         that can be installed in an Android project.
400         If present, the &lt;project-files&gt; collection must contain at least one path.
401         Each path is relative to the root directory of the package.
402     -->
403
404    <xsd:complexType name="projectFilesType">
405        <xsd:annotation>
406            <xsd:documentation>
407                A collection of file paths available in an &lt;extra&gt; package
408                that can be installed in an Android project.
409                If present, the &lt;project-files&gt; collection must contain at least one path.
410                Each path is relative to the root directory of the package.
411            </xsd:documentation>
412        </xsd:annotation>
413        <xsd:sequence minOccurs="1" maxOccurs="unbounded">
414            <!-- One JAR Path, relative to the root folder of the package. -->
415            <xsd:element name="path" type="xsd:string" />
416        </xsd:sequence>
417    </xsd:complexType>
418
419
420    <!-- The definition of a file checksum -->
421
422    <xsd:simpleType name="sha1Number">
423        <xsd:annotation>
424            <xsd:documentation>A SHA1 checksum.</xsd:documentation>
425        </xsd:annotation>
426        <xsd:restriction base="xsd:string">
427            <xsd:pattern value="([0-9a-fA-F]){40}"/>
428        </xsd:restriction>
429    </xsd:simpleType>
430
431    <xsd:complexType name="checksumType">
432        <xsd:annotation>
433            <xsd:documentation>A file checksum, currently only SHA1.</xsd:documentation>
434        </xsd:annotation>
435        <xsd:simpleContent>
436            <xsd:extension base="sdk:sha1Number">
437                <xsd:attribute name="type" type="xsd:token" fixed="sha1" />
438            </xsd:extension>
439        </xsd:simpleContent>
440    </xsd:complexType>
441
442</xsd:schema>
443