xref: /aosp_15_r20/prebuilts/devtools/repository/sdk-repository-04.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/repository/4"
19    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
20    xmlns:sdk="http://schemas.android.com/sdk/android/repository/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 SDK repository is a web site that contains a "repository.xml"
30         file that conforms to this XML Schema.
31
32         History:
33         - v1 is used by the SDK Updater in Tools r3 and r4.
34
35         - v2 is used by the SDK Updater in Tools r5:
36            - It introduces a new <sample> repository type. Previously samples
37              were included in the <platform> packages. Instead this package is used
38              and and the samples are installed in $SDK/samples.
39            - All repository types have a new <obsolete> node. It works as a marker
40              to indicate the package is obsolete and should not be selected by default.
41              The UI also hides these out by default.
42
43         - v3 is used by the SDK Updater in Tools r8:
44            - It introduces a new <platform-tool> repository type. Previously platform-specific
45              tools were included in the <platform> packages. Instead this package is used
46              and platform-specific tools are installed in $SDK/platform-tools
47            - There's a new element <min-platform-tools-rev> in <tool>. The tool package now
48              requires that at least some minimal version of <platform-tool> be installed.
49            - It removes the <addon> repository type, which is now in its own XML Schema.
50
51         - v4 is used by the SDK Updater in Tools r12:
52            - <extra> element now has a <project-files> element that contains 1 or
53              or more <path>, each indicating the relative path of a file that this package
54              can contribute to installed projects.
55            - <platform> element now has a mandatory <layoutlib> that indicates the API
56              and revision of that layout library for this particular platform.
57    -->
58
59    <xsd:element name="sdk-repository" type="sdk:repositoryType" />
60
61    <xsd:complexType name="repositoryType">
62        <xsd:annotation>
63            <xsd:documentation>
64                The repository contains a collection of downloadable packages.
65            </xsd:documentation>
66        </xsd:annotation>
67        <xsd:choice minOccurs="0" maxOccurs="unbounded">
68            <xsd:element name="platform"        type="sdk:platformType"     />
69            <xsd:element name="tool"            type="sdk:toolType"         />
70            <xsd:element name="platform-tool"   type="sdk:platformToolType" />
71            <xsd:element name="doc"             type="sdk:docType"          />
72            <xsd:element name="sample"          type="sdk:sampleType"       />
73            <xsd:element name="extra"           type="sdk:extraType"        />
74            <xsd:element name="license"         type="sdk:licenseType"      />
75        </xsd:choice>
76    </xsd:complexType>
77
78    <!-- The definition of an SDK platform package. -->
79
80    <xsd:complexType name="platformType">
81        <xsd:annotation>
82            <xsd:documentation>An SDK platform package.</xsd:documentation>
83        </xsd:annotation>
84        <xsd:all>
85            <!-- The Android platform version. It is string such as "1.0". -->
86            <xsd:element name="version"   type="xsd:normalizedString" />
87            <!-- The Android API Level for the platform. An int > 0. -->
88            <xsd:element name="api-level" type="xsd:positiveInteger"  />
89            <!-- The optional codename for this platform, if it's a preview. -->
90            <xsd:element name="codename"  type="xsd:string" minOccurs="0" />
91            <!-- The revision, an int > 0, incremented each time a new
92                 package is generated. -->
93            <xsd:element name="revision"  type="xsd:positiveInteger" />
94
95            <!-- Information on the layoutlib packaged in this platform. -->
96            <xsd:element name="layoutlib" type="sdk:layoutlibType" />
97
98            <!-- optional elements -->
99
100            <!-- The optional license of this package. If present, users will have
101                 to agree to it before downloading. -->
102            <xsd:element name="uses-license"  type="sdk:usesLicenseType" minOccurs="0" />
103            <!-- The optional description of this package. -->
104            <xsd:element name="description"   type="xsd:string"      minOccurs="0" />
105            <!-- The optional description URL of this package -->
106            <xsd:element name="desc-url"      type="xsd:token"       minOccurs="0" />
107            <!-- The optional release note for this package. -->
108            <xsd:element name="release-note"  type="xsd:string"      minOccurs="0" />
109            <!-- The optional release note URL of this package -->
110            <xsd:element name="release-url"   type="xsd:token"       minOccurs="0" />
111            <!-- A list of file archives for this package. -->
112            <xsd:element name="archives"      type="sdk:archivesType" />
113            <!-- The minimal revision of tools required by this package.
114                 Optional. If present, must be an int > 0. -->
115            <xsd:element name="min-tools-rev" type="xsd:positiveInteger" minOccurs="0" />
116
117            <!-- An optional element indicating the package is obsolete.
118                 The string content is however currently not defined and ignored. -->
119            <xsd:element name="obsolete"      type="xsd:string" minOccurs="0" />
120        </xsd:all>
121    </xsd:complexType>
122
123
124    <!-- The definition of a layout library used by a platform. -->
125
126    <xsd:complexType name="layoutlibType" >
127        <xsd:annotation>
128            <xsd:documentation>
129                Version information for a layoutlib included in a platform.
130            </xsd:documentation>
131        </xsd:annotation>
132        <xsd:all>
133            <!-- The layoutlib API level, an int > 0,
134                 incremented with each new incompatible lib. -->
135            <xsd:element name="api"          type="xsd:positiveInteger" />
136            <!-- The incremental minor revision for that API, e.g. in case of bug fixes.
137                 Optional. An int >= 0, assumed to be 0 if the element is missing. -->
138            <xsd:element name="revision"     type="xsd:nonNegativeInteger" minOccurs="0" />
139        </xsd:all>
140    </xsd:complexType>
141
142
143    <!-- The definition of an SDK tool package. -->
144
145    <xsd:complexType name="toolType" >
146        <xsd:annotation>
147            <xsd:documentation>An SDK tool package.</xsd:documentation>
148        </xsd:annotation>
149        <xsd:all>
150            <!-- The revision, an int > 0, incremented each time a new
151                 package is generated. -->
152            <xsd:element name="revision"     type="xsd:positiveInteger" />
153            <!-- The optional license of this package. If present, users will have
154                 to agree to it before downloading. -->
155            <xsd:element name="uses-license" type="sdk:usesLicenseType" minOccurs="0" />
156            <!-- The optional description of this package. -->
157            <xsd:element name="description"  type="xsd:string"      minOccurs="0" />
158            <!-- The optional description URL of this package -->
159            <xsd:element name="desc-url"     type="xsd:token"       minOccurs="0" />
160            <!-- The optional release note for this package. -->
161            <xsd:element name="release-note" type="xsd:string"      minOccurs="0" />
162            <!-- The optional release note URL of this package -->
163            <xsd:element name="release-url"  type="xsd:token"       minOccurs="0" />
164            <!-- A list of file archives for this package. -->
165            <xsd:element name="archives"     type="sdk:archivesType" />
166            <!-- An optional element indicating the package is obsolete.
167                 The string content is however currently not defined and ignored. -->
168            <xsd:element name="obsolete"  type="xsd:string" minOccurs="0" />
169
170            <!-- The minimal revision of platform-tools required by this package.
171                 Mandatory. Must be an int > 0. -->
172            <xsd:element name="min-platform-tools-rev" type="xsd:positiveInteger" />
173        </xsd:all>
174    </xsd:complexType>
175
176
177    <!-- The definition of an SDK platform-tool package. -->
178
179    <xsd:complexType name="platformToolType" >
180        <xsd:annotation>
181            <xsd:documentation>An SDK platform-tool package.</xsd:documentation>
182        </xsd:annotation>
183        <xsd:all>
184            <!-- The revision, an int > 0, incremented each time a new
185                 package is generated. -->
186            <xsd:element name="revision"     type="xsd:positiveInteger" />
187            <!-- The optional license of this package. If present, users will have
188                 to agree to it before downloading. -->
189            <xsd:element name="uses-license" type="sdk:usesLicenseType" minOccurs="0" />
190            <!-- The optional description of this package. -->
191            <xsd:element name="description"  type="xsd:string"      minOccurs="0" />
192            <!-- The optional description URL of this package -->
193            <xsd:element name="desc-url"     type="xsd:token"       minOccurs="0" />
194            <!-- The optional release note for this package. -->
195            <xsd:element name="release-note" type="xsd:string"      minOccurs="0" />
196            <!-- The optional release note URL of this package -->
197            <xsd:element name="release-url"  type="xsd:token"       minOccurs="0" />
198            <!-- A list of file archives for this package. -->
199            <xsd:element name="archives"     type="sdk:archivesType" />
200
201            <!-- An optional element indicating the package is obsolete.
202                 The string content is however currently not defined and ignored. -->
203            <xsd:element name="obsolete"  type="xsd:string" minOccurs="0" />
204        </xsd:all>
205    </xsd:complexType>
206
207
208    <!-- The definition of an SDK doc package. -->
209
210    <xsd:complexType name="docType" >
211        <xsd:annotation>
212            <xsd:documentation>An SDK doc package.</xsd:documentation>
213        </xsd:annotation>
214        <xsd:all>
215            <!-- The Android API Level for the documentation. An int > 0. -->
216            <xsd:element name="api-level" type="xsd:positiveInteger"  />
217            <!-- The optional codename for this doc, if it's a preview. -->
218            <xsd:element name="codename"  type="xsd:string" minOccurs="0" />
219
220            <!-- The revision, an int > 0, incremented each time a new
221                 package is generated. -->
222            <xsd:element name="revision"     type="xsd:positiveInteger" />
223            <!-- The optional license of this package. If present, users will have
224                 to agree to it before downloading. -->
225            <xsd:element name="uses-license" type="sdk:usesLicenseType" minOccurs="0" />
226            <!-- The optional description of this package. -->
227            <xsd:element name="description"  type="xsd:string"      minOccurs="0" />
228            <!-- The optional description URL of this package -->
229            <xsd:element name="desc-url"     type="xsd:token"       minOccurs="0" />
230            <!-- The optional release note for this package. -->
231            <xsd:element name="release-note" type="xsd:string"      minOccurs="0" />
232            <!-- The optional release note URL of this package -->
233            <xsd:element name="release-url"  type="xsd:token"       minOccurs="0" />
234            <!-- A list of file archives for this package. -->
235            <xsd:element name="archives"     type="sdk:archivesType" />
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        </xsd:all>
241    </xsd:complexType>
242
243
244    <!-- The definition of an SDK sample package. -->
245
246    <xsd:complexType name="sampleType" >
247        <xsd:annotation>
248            <xsd:documentation>An SDK sample package.</xsd:documentation>
249        </xsd:annotation>
250        <xsd:all>
251            <!-- The Android API Level for the documentation. An int > 0. -->
252            <xsd:element name="api-level" type="xsd:positiveInteger"  />
253            <!-- The optional codename for this doc, if it's a preview. -->
254            <xsd:element name="codename"  type="xsd:string" minOccurs="0" />
255
256            <!-- The revision, an int > 0, incremented each time a new
257                 package is generated. -->
258            <xsd:element name="revision"     type="xsd:positiveInteger" />
259            <!-- The optional license of this package. If present, users will have
260                 to agree to it before downloading. -->
261            <xsd:element name="uses-license" type="sdk:usesLicenseType" minOccurs="0" />
262            <!-- The optional description of this package. -->
263            <xsd:element name="description"  type="xsd:string"      minOccurs="0" />
264            <!-- The optional description URL of this package -->
265            <xsd:element name="desc-url"     type="xsd:token"       minOccurs="0" />
266            <!-- The optional release note for this package. -->
267            <xsd:element name="release-note" type="xsd:string"      minOccurs="0" />
268            <!-- The optional release note URL of this package -->
269            <xsd:element name="release-url"  type="xsd:token"       minOccurs="0" />
270            <!-- A list of file archives for this package. -->
271            <xsd:element name="archives"     type="sdk:archivesType" />
272            <!-- The minimal revision of tools required by this package.
273                 Optional. If present, must be an int > 0. -->
274            <xsd:element name="min-tools-rev" type="xsd:positiveInteger" minOccurs="0" />
275
276            <!-- An optional element indicating the package is obsolete.
277                 The string content is however currently not defined and ignored. -->
278            <xsd:element name="obsolete"  type="xsd:string" minOccurs="0" />
279        </xsd:all>
280    </xsd:complexType>
281
282
283    <!-- The definition of an SDK extra package. This kind of package is for
284         "free" content. Such packages are installed in SDK/vendor/path.
285
286         Important implementation detail: this element is duplicated in the
287         sdk-addon-N.xsd schema and must be kept in sync there. This is
288         simpler than trying to use some kind of of include or to request
289         that clients use a third XML schema for common parts.
290    -->
291
292    <xsd:complexType name="extraType" >
293        <xsd:annotation>
294            <xsd:documentation>
295                An SDK extra package. This kind of package is for "free" content.
296                Such packages are installed in SDK/vendor/path.
297            </xsd:documentation>
298        </xsd:annotation>
299        <xsd:all>
300
301            <!-- The install path top folder name.
302                 The segments "add-ons", "docs", "platforms", "platform-tools", "temp"
303                 and "tools" are reserved and cannot be used.
304            -->
305            <xsd:element name="vendor" type="sdk:segmentType" />
306
307            <!-- The install path sub-folder name. -->
308            <xsd:element name="path" type="sdk:segmentType" />
309
310            <!-- The revision, an int > 0, incremented each time a new
311                 package is generated. -->
312            <xsd:element name="revision"     type="xsd:positiveInteger" />
313
314            <!-- A list of file archives for this package. -->
315            <xsd:element name="archives"     type="sdk:archivesType" />
316
317            <!--  optional elements -->
318
319            <!-- The optional license of this package. If present, users will have
320                 to agree to it before downloading. -->
321            <xsd:element name="uses-license" type="sdk:usesLicenseType"  minOccurs="0" />
322            <!-- The optional description of this package. -->
323            <xsd:element name="description"  type="xsd:string"           minOccurs="0" />
324            <!-- The optional description URL of this package -->
325            <xsd:element name="desc-url"     type="xsd:token"            minOccurs="0" />
326            <!-- The optional release note for this package. -->
327            <xsd:element name="release-note" type="xsd:string"           minOccurs="0" />
328            <!-- The optional release note URL of this package -->
329            <xsd:element name="release-url"  type="xsd:token"            minOccurs="0" />
330            <!-- The minimal revision of tools required by this package.
331                 Optional. If present, must be an int > 0. -->
332            <xsd:element name="min-tools-rev" type="xsd:positiveInteger" minOccurs="0" />
333            <!-- The minimal API level required by this package.
334                 Optional. If present, must be an int > 0. -->
335            <xsd:element name="min-api-level" type="xsd:positiveInteger" minOccurs="0" />
336            <!-- An optional element indicating the package is obsolete.
337                 The string content is however currently not defined and ignored. -->
338            <xsd:element name="obsolete"      type="xsd:string"          minOccurs="0" />
339
340            <!-- A list of project files contributed by this package. Optional. -->
341            <xsd:element name="project-files" type="sdk:projectFilesType" minOccurs="0" />
342        </xsd:all>
343    </xsd:complexType>
344
345
346    <!-- The definition of a path segment used by the extra element. -->
347
348    <xsd:simpleType name="segmentType">
349        <xsd:annotation>
350            <xsd:documentation>
351                One path segment for the install path of an extra element.
352                It must be a single-segment path.
353            </xsd:documentation>
354        </xsd:annotation>
355        <xsd:restriction base="xsd:token">
356            <xsd:pattern value="[a-zA-Z0-9_]+"/>
357        </xsd:restriction>
358    </xsd:simpleType>
359
360
361    <!-- The definition of a license to be referenced by the uses-license element. -->
362
363    <xsd:complexType name="licenseType">
364        <xsd:annotation>
365            <xsd:documentation>
366                A license definition. Such a license must be used later as a reference
367                using a uses-license element in one of the package elements.
368            </xsd:documentation>
369        </xsd:annotation>
370        <xsd:simpleContent>
371            <xsd:extension base="xsd:string">
372                <xsd:attribute name="id"   type="xsd:ID" />
373                <xsd:attribute name="type" type="xsd:token" fixed="text" />
374            </xsd:extension>
375        </xsd:simpleContent>
376    </xsd:complexType>
377
378
379    <!-- Type describing the license used by a package.
380         The license MUST be defined using a license node and referenced
381         using the ref attribute of the license element inside a package.
382     -->
383
384    <xsd:complexType name="usesLicenseType">
385        <xsd:annotation>
386            <xsd:documentation>
387                Describes the license used by a package. The license MUST be defined
388                using a license node and referenced using the ref attribute of the
389                license element inside a package.
390            </xsd:documentation>
391        </xsd:annotation>
392        <xsd:attribute name="ref" type="xsd:IDREF" />
393    </xsd:complexType>
394
395
396    <!-- A collection of files that can be downloaded for a given architecture.
397         The <archives> node is mandatory in the repository elements and the
398         collection must have at least one <archive> declared.
399         Each archive is a zip file that will be unzipped in a location that depends
400         on its package type.
401     -->
402
403    <xsd:complexType name="archivesType">
404        <xsd:annotation>
405            <xsd:documentation>
406                A collection of files that can be downloaded for a given architecture.
407                The &lt;archives&gt; node is mandatory in the repository packages and the
408                collection must have at least one &lt;archive&gt; declared.
409                Each archive is a zip file that will be unzipped in a location that depends
410                on its package type.
411            </xsd:documentation>
412        </xsd:annotation>
413        <xsd:sequence minOccurs="1" maxOccurs="unbounded">
414            <!-- One archive file -->
415            <xsd:element name="archive">
416                <xsd:complexType>
417                    <!-- Properties of the archive file -->
418                    <xsd:all>
419                        <!-- The size in bytes of the archive to download. -->
420                        <xsd:element name="size"     type="xsd:positiveInteger" />
421                        <!-- The checksum of the archive file. -->
422                        <xsd:element name="checksum" type="sdk:checksumType" />
423                        <!-- The URL is an absolute URL if it starts with http://, https://
424                             or ftp://. Otherwise it is relative to the parent directory that
425                             contains this repository.xml -->
426                        <xsd:element name="url"      type="xsd:token" />
427                    </xsd:all>
428
429                    <!-- Attributes that identify the OS and architecture -->
430                    <xsd:attribute name="os" use="required">
431                        <xsd:simpleType>
432                            <xsd:restriction base="xsd:token">
433                                <xsd:enumeration value="any" />
434                                <xsd:enumeration value="linux" />
435                                <xsd:enumeration value="macosx" />
436                                <xsd:enumeration value="windows" />
437                            </xsd:restriction>
438                        </xsd:simpleType>
439                    </xsd:attribute>
440                    <xsd:attribute name="arch" use="optional">
441                        <xsd:simpleType>
442                            <xsd:restriction base="xsd:token">
443                                <xsd:enumeration value="any" />
444                                <xsd:enumeration value="ppc" />
445                                <xsd:enumeration value="x86" />
446                                <xsd:enumeration value="x86_64" />
447                            </xsd:restriction>
448                        </xsd:simpleType>
449                    </xsd:attribute>
450                </xsd:complexType>
451            </xsd:element>
452        </xsd:sequence>
453    </xsd:complexType>
454
455
456    <!-- A collection of file paths available in an &lt;extra&gt; package
457         that can be installed in an Android project.
458         If present, the &lt;project-files&gt; collection must contain at least one path.
459         Each path is relative to the root directory of the package.
460     -->
461
462    <xsd:complexType name="projectFilesType">
463        <xsd:annotation>
464            <xsd:documentation>
465                A collection of file paths available in an &lt;extra&gt; package
466                that can be installed in an Android project.
467                If present, the &lt;project-files&gt; collection must contain at least one path.
468                Each path is relative to the root directory of the package.
469            </xsd:documentation>
470        </xsd:annotation>
471        <xsd:sequence minOccurs="1" maxOccurs="unbounded">
472            <!-- One JAR Path, relative to the root folder of the package. -->
473            <xsd:element name="path" type="xsd:string" />
474        </xsd:sequence>
475    </xsd:complexType>
476
477
478    <!-- The definition of a file checksum -->
479
480    <xsd:simpleType name="sha1Number">
481        <xsd:annotation>
482            <xsd:documentation>A SHA1 checksum.</xsd:documentation>
483        </xsd:annotation>
484        <xsd:restriction base="xsd:string">
485            <xsd:pattern value="([0-9a-fA-F]){40}"/>
486        </xsd:restriction>
487    </xsd:simpleType>
488
489    <xsd:complexType name="checksumType">
490        <xsd:annotation>
491            <xsd:documentation>A file checksum, currently only SHA1.</xsd:documentation>
492        </xsd:annotation>
493        <xsd:simpleContent>
494            <xsd:extension base="sdk:sha1Number">
495                <xsd:attribute name="type" type="xsd:token" fixed="sha1" />
496            </xsd:extension>
497        </xsd:simpleContent>
498    </xsd:complexType>
499
500</xsd:schema>
501