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