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