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