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