sdk-addon-04.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/4"
19    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
20    xmlns:sdk="http://schemas.android.com/sdk/android/addon/4"
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
58    <xsd:element name="sdk-addon" type="sdk:repositoryType" />
59
60    <xsd:complexType name="repositoryType">
61        <xsd:annotation>
62            <xsd:documentation>
63                The repository contains a collection of downloadable packages.
64            </xsd:documentation>
65        </xsd:annotation>
66        <xsd:choice minOccurs="0" maxOccurs="unbounded">
67            <xsd:element name="add-on"  type="sdk:addonType"        />
68            <xsd:element name="extra"   type="sdk:extraType"        />
69            <xsd:element name="license" type="sdk:licenseType"      />
70        </xsd:choice>
71    </xsd:complexType>
72
73    <!-- The definition of an SDK Add-on package. -->
74
75    <xsd:complexType name="addonType">
76        <xsd:annotation>
77            <xsd:documentation>An SDK add-on package.</xsd:documentation>
78        </xsd:annotation>
79        <xsd:all>
80            <!-- The internal name id of the add-on. Must be unique per vendor. -->
81            <xsd:element name="name-id"         type="sdk:idType" />
82            <!-- The displayed name of the add-on. -->
83            <xsd:element name="name-display"    type="xsd:normalizedString" />
84
85            <!-- The internal vendor id of the add-on. Must be unique amongst vendors. -->
86            <xsd:element name="vendor-id"       type="sdk:idType" />
87            <!-- The displayed vendor name of the add-on. -->
88            <xsd:element name="vendor-display"  type="xsd:normalizedString" />
89
90            <!-- The Android API Level for the add-on. An int > 0. -->
91            <xsd:element name="api-level"    type="xsd:positiveInteger"  />
92            <!-- Note: Add-ons do not support 'codenames' (a.k.a. API previews). -->
93            <!-- The revision, an int > 0, incremented each time a new
94                 package is generated. -->
95            <xsd:element name="revision"     type="xsd:positiveInteger" />
96
97            <!-- An add-on can declare 0 or more libraries.
98                 This element is mandatory but it can be empty.
99            -->
100
101            <xsd:element name="libs">
102                <xsd:complexType>
103                    <xsd:sequence minOccurs="0" maxOccurs="unbounded">
104                        <xsd:element name="lib">
105                            <xsd:complexType>
106                                <xsd:all>
107                                    <!-- The name of the library. -->
108                                    <xsd:element name="name" type="xsd:normalizedString" />
109                                    <!-- The optional description of this add-on library. -->
110                                    <xsd:element name="description" type="xsd:string" minOccurs="0" />
111                                </xsd:all>
112                            </xsd:complexType>
113                        </xsd:element>
114                    </xsd:sequence>
115                </xsd:complexType>
116            </xsd:element>
117
118            <!-- optional elements -->
119
120            <!-- The optional license of this package. If present, users will have
121                 to agree to it before downloading. -->
122            <xsd:element name="uses-license" type="sdk:usesLicenseType" minOccurs="0" />
123            <!-- The optional description of this package. -->
124            <xsd:element name="description"  type="xsd:string"      minOccurs="0" />
125            <!-- The optional description URL of this package -->
126            <xsd:element name="desc-url"     type="xsd:token"       minOccurs="0" />
127            <!-- The optional release note for this package. -->
128            <xsd:element name="release-note" type="xsd:string"      minOccurs="0" />
129            <!-- The optional release note URL of this package -->
130            <xsd:element name="release-url"  type="xsd:token"       minOccurs="0" />
131            <!-- A list of file archives for this package. -->
132            <xsd:element name="archives"     type="sdk:archivesType" />
133
134            <!-- An optional element indicating the package is obsolete.
135                 The string content is however currently not defined and ignored. -->
136            <xsd:element name="obsolete"  type="xsd:string" minOccurs="0" />
137
138            <!-- An optional element indicating the package is a beta/preview.
139                 When present, it indicates the release-candidate number.
140                 When the element is absent, it indicates this is a released package.
141                 DEPRECATED. TODO remove in sdk-addon-5. -->
142            <xsd:element name="beta-rc"   type="xsd:positiveInteger" minOccurs="0" />
143
144            <!-- Optional information on the layoutlib packaged in this platform. -->
145            <xsd:element name="layoutlib" type="sdk:layoutlibType"  minOccurs="0" />
146        </xsd:all>
147    </xsd:complexType>
148
149
150    <xsd:simpleType name="idType">
151        <xsd:annotation>
152            <xsd:documentation>
153                An ID string for an addon/extra name-id or vendor-id
154                can only be simple alphanumeric string.
155            </xsd:documentation>
156        </xsd:annotation>
157        <xsd:restriction base="xsd:token">
158            <xsd:pattern value="[a-zA-Z0-9_-]+"/>
159        </xsd:restriction>
160    </xsd:simpleType>
161
162
163    <!-- The definition of a layout library used by an addon. -->
164
165    <xsd:complexType name="layoutlibType" >
166        <xsd:annotation>
167            <xsd:documentation>
168                Version information for a layoutlib included in an addon.
169            .</xsd:documentation>
170        </xsd:annotation>
171        <xsd:all>
172            <!-- The layoutlib API level, an int > 0,
173                 incremented with each new incompatible lib. -->
174            <xsd:element name="api"          type="xsd:positiveInteger" />
175            <!-- The incremental minor revision for that API, e.g. in case of bug fixes.
176                 Optional. An int >= 0, assumed to be 0 if the element is missing. -->
177            <xsd:element name="revision"     type="xsd:nonNegativeInteger" minOccurs="0" />
178        </xsd:all>
179    </xsd:complexType>
180
181
182    <!-- The definition of an SDK extra package. This kind of package is for
183         "free" content. Such packages are installed in SDK/extras/vendor/path.
184    -->
185
186    <xsd:complexType name="extraType" >
187        <xsd:annotation>
188            <xsd:documentation>
189                An SDK extra package. This kind of package is for "free" content.
190                Such packages are installed in SDK/vendor/path.
191            </xsd:documentation>
192        </xsd:annotation>
193        <xsd:all>
194            <!-- The displayed name of the extra. -->
195            <xsd:element name="name-display"    type="xsd:normalizedString" />
196
197            <!-- The internal vendor id of the extra. Must be unique amongst vendors. -->
198            <xsd:element name="vendor-id"       type="sdk:idType" />
199            <!-- The displayed vendor name of the extra. -->
200            <xsd:element name="vendor-display"  type="xsd:normalizedString" />
201
202            <!-- The install path sub-folder name. It must not be empty. -->
203            <xsd:element name="path" type="sdk:segmentType" />
204
205            <!-- A semi-colon separated list of "obsolete" path names which are equivalent
206                 to the current 'path' name. When a package is seen using an old-paths' name,
207                 the package manager will try to upgrade it to the new path. -->
208            <xsd:element name="old-paths" type="sdk:segmentListType"  minOccurs="0" />
209
210            <!-- The revision, an int > 0, incremented each time a new
211                 package is generated. -->
212            <xsd:element name="revision"     type="xsd:positiveInteger" />
213
214            <!-- A list of file archives for this package. -->
215            <xsd:element name="archives"     type="sdk:archivesType" />
216
217            <!--  optional elements -->
218
219            <!-- The optional license of this package. If present, users will have
220                 to agree to it before downloading. -->
221            <xsd:element name="uses-license" type="sdk:usesLicenseType"  minOccurs="0" />
222            <!-- The optional description of this package. -->
223            <xsd:element name="description"  type="xsd:string"           minOccurs="0" />
224            <!-- The optional description URL of this package -->
225            <xsd:element name="desc-url"     type="xsd:token"            minOccurs="0" />
226            <!-- The optional release note for this package. -->
227            <xsd:element name="release-note" type="xsd:string"           minOccurs="0" />
228            <!-- The optional release note URL of this package -->
229            <xsd:element name="release-url"  type="xsd:token"            minOccurs="0" />
230            <!-- The minimal revision of tools required by this package.
231                 Optional. If present, must be an int > 0. -->
232            <xsd:element name="min-tools-rev" type="xsd:positiveInteger" minOccurs="0" />
233            <!-- The minimal API level required by this package.
234                 Optional. If present, must be an int > 0. -->
235            <xsd:element name="min-api-level" type="xsd:positiveInteger" minOccurs="0" />
236
237            <!-- An optional element indicating the package is obsolete.
238                 The string content is however currently not defined and ignored. -->
239            <xsd:element name="obsolete"      type="xsd:string" minOccurs="0" />
240
241            <!-- An optional element indicating the package is a beta/preview.
242                 When present, it indicates the release-candidate number.
243                 When the element is absent, it indicates this is a released package. -->
244            <xsd:element name="beta-rc"       type="xsd:positiveInteger" minOccurs="0" />
245
246            <!-- A list of project files contributed by this package. Optional. -->
247            <xsd:element name="project-files" type="sdk:projectFilesType" minOccurs="0" />
248        </xsd:all>
249    </xsd:complexType>
250
251
252    <!-- The definition of a path segment used by the extra element. -->
253
254    <xsd:simpleType name="segmentType">
255        <xsd:annotation>
256            <xsd:documentation>
257                One path segment for the install path of an extra element.
258                It must be a single-segment path. It must not be empty.
259            </xsd:documentation>
260        </xsd:annotation>
261        <xsd:restriction base="xsd:token">
262            <xsd:pattern value="[a-zA-Z0-9_]+"/>
263        </xsd:restriction>
264    </xsd:simpleType>
265
266    <xsd:simpleType name="segmentListType">
267        <xsd:annotation>
268            <xsd:documentation>
269                A semi-colon separated list of a segmentTypes.
270            </xsd:documentation>
271        </xsd:annotation>
272        <xsd:restriction base="xsd:token">
273            <xsd:pattern value="[a-zA-Z0-9_;]+"/>
274        </xsd:restriction>
275    </xsd:simpleType>
276
277
278    <!-- The definition of a license to be referenced by the uses-license element. -->
279
280    <xsd:complexType name="licenseType">
281        <xsd:annotation>
282            <xsd:documentation>
283                A license definition. Such a license must be used later as a reference
284                using a uses-license element in one of the package elements.
285            </xsd:documentation>
286        </xsd:annotation>
287        <xsd:simpleContent>
288            <xsd:extension base="xsd:string">
289                <xsd:attribute name="id"   type="xsd:ID" />
290                <xsd:attribute name="type" type="xsd:token" fixed="text" />
291            </xsd:extension>
292        </xsd:simpleContent>
293    </xsd:complexType>
294
295
296    <!-- Type describing the license used by a package.
297         The license MUST be defined using a license node and referenced
298         using the ref attribute of the license element inside a package.
299     -->
300
301    <xsd:complexType name="usesLicenseType">
302        <xsd:annotation>
303            <xsd:documentation>
304                Describes the license used by a package. The license MUST be defined
305                using a license node and referenced using the ref attribute of the
306                license element inside a package.
307            </xsd:documentation>
308        </xsd:annotation>
309        <xsd:attribute name="ref" type="xsd:IDREF" />
310    </xsd:complexType>
311
312
313    <!-- A collection of files that can be downloaded for a given architecture.
314         The <archives> node is mandatory in the repository elements and the
315         collection must have at least one <archive> declared.
316         Each archive is a zip file that will be unzipped in a location that depends
317         on its package type.
318     -->
319
320    <xsd:complexType name="archivesType">
321        <xsd:annotation>
322            <xsd:documentation>
323                A collection of files that can be downloaded for a given architecture.
324                The &lt;archives&gt; node is mandatory in the repository packages and the
325                collection must have at least one &lt;archive&gt; declared.
326                Each archive is a zip file that will be unzipped in a location that depends
327                on its package type.
328            </xsd:documentation>
329        </xsd:annotation>
330        <xsd:sequence minOccurs="1" maxOccurs="unbounded">
331            <!-- One archive file -->
332            <xsd:element name="archive">
333                <xsd:complexType>
334                    <!-- Properties of the archive file -->
335                    <xsd:all>
336                        <!-- The size in bytes of the archive to download. -->
337                        <xsd:element name="size"     type="xsd:positiveInteger" />
338                        <!-- The checksum of the archive file. -->
339                        <xsd:element name="checksum" type="sdk:checksumType" />
340                        <!-- The URL is an absolute URL if it starts with http://, https://
341                             or ftp://. Otherwise it is relative to the parent directory that
342                             contains this repository.xml -->
343                        <xsd:element name="url"      type="xsd:token" />
344                    </xsd:all>
345
346                    <!-- Attributes that identify the OS and architecture -->
347                    <xsd:attribute name="os" use="required">
348                        <xsd:simpleType>
349                            <xsd:restriction base="xsd:token">
350                                <xsd:enumeration value="any" />
351                                <xsd:enumeration value="linux" />
352                                <xsd:enumeration value="macosx" />
353                                <xsd:enumeration value="windows" />
354                            </xsd:restriction>
355                        </xsd:simpleType>
356                    </xsd:attribute>
357                    <xsd:attribute name="arch" use="optional">
358                        <xsd:simpleType>
359                            <xsd:restriction base="xsd:token">
360                                <xsd:enumeration value="any" />
361                                <xsd:enumeration value="ppc" />
362                                <xsd:enumeration value="x86" />
363                                <xsd:enumeration value="x86_64" />
364                            </xsd:restriction>
365                        </xsd:simpleType>
366                    </xsd:attribute>
367                </xsd:complexType>
368            </xsd:element>
369        </xsd:sequence>
370    </xsd:complexType>
371
372
373    <!-- A collection of file paths available in an &lt;extra&gt; package
374         that can be installed in an Android project.
375         If present, the &lt;project-files&gt; collection must contain at least one path.
376         Each path is relative to the root directory of the package.
377     -->
378
379    <xsd:complexType name="projectFilesType">
380        <xsd:annotation>
381            <xsd:documentation>
382                A collection of file paths available in an &lt;extra&gt; package
383                that can be installed in an Android project.
384                If present, the &lt;project-files&gt; collection must contain at least one path.
385                Each path is relative to the root directory of the package.
386            </xsd:documentation>
387        </xsd:annotation>
388        <xsd:sequence minOccurs="1" maxOccurs="unbounded">
389            <!-- One JAR Path, relative to the root folder of the package. -->
390            <xsd:element name="path" type="xsd:string" />
391        </xsd:sequence>
392    </xsd:complexType>
393
394
395    <!-- The definition of a file checksum -->
396
397    <xsd:simpleType name="sha1Number">
398        <xsd:annotation>
399            <xsd:documentation>A SHA1 checksum.</xsd:documentation>
400        </xsd:annotation>
401        <xsd:restriction base="xsd:string">
402            <xsd:pattern value="([0-9a-fA-F]){40}"/>
403        </xsd:restriction>
404    </xsd:simpleType>
405
406    <xsd:complexType name="checksumType">
407        <xsd:annotation>
408            <xsd:documentation>A file checksum, currently only SHA1.</xsd:documentation>
409        </xsd:annotation>
410        <xsd:simpleContent>
411            <xsd:extension base="sdk:sha1Number">
412                <xsd:attribute name="type" type="xsd:token" fixed="sha1" />
413            </xsd:extension>
414        </xsd:simpleContent>
415    </xsd:complexType>
416
417</xsd:schema>
418