xref: /aosp_15_r20/prebuilts/devtools/repository/sdk-addon-01.xsd (revision 4bfccde5c7e9ea06f821db40ef0af54f6695c320)
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 * Copyright (C) 2010 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/1"
19    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
20    xmlns:sdk="http://schemas.android.com/sdk/android/addon/1"
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
38    <xsd:element name="sdk-addon" type="sdk:repositoryType" />
39
40    <xsd:complexType name="repositoryType">
41        <xsd:annotation>
42            <xsd:documentation>
43                The repository contains a collection of downloadable packages.
44            </xsd:documentation>
45        </xsd:annotation>
46        <xsd:choice minOccurs="0" maxOccurs="unbounded">
47            <xsd:element name="add-on"          type="sdk:addonType"        />
48            <xsd:element name="extra"           type="sdk:extraType"        />
49            <xsd:element name="license"         type="sdk:licenseType"      />
50        </xsd:choice>
51    </xsd:complexType>
52
53    <!-- The definition of an SDK Add-on package. -->
54
55    <xsd:complexType name="addonType">
56        <xsd:annotation>
57            <xsd:documentation>An SDK add-on package.</xsd:documentation>
58        </xsd:annotation>
59        <xsd:all>
60            <!-- The name of the add-on. -->
61            <xsd:element name="name"      type="xsd:normalizedString" />
62            <!-- The vendor of the add-on. -->
63            <xsd:element name="vendor"    type="xsd:normalizedString" />
64            <!-- The Android API Level for the add-on. An int > 0. -->
65            <xsd:element name="api-level" type="xsd:positiveInteger"  />
66            <!-- Note: Add-ons do not support 'codename' (a.k.a. API previews). -->
67
68            <!-- The revision, an int > 0, incremented each time a new
69                 package is generated. -->
70            <xsd:element name="revision"     type="xsd:positiveInteger" />
71            <!-- The optional license of this package. If present, users will have
72                 to agree to it before downloading. -->
73            <xsd:element name="uses-license" type="sdk:usesLicenseType" minOccurs="0" />
74            <!-- The optional description of this package. -->
75            <xsd:element name="description"  type="xsd:string"      minOccurs="0" />
76            <!-- The optional description URL of this package -->
77            <xsd:element name="desc-url"     type="xsd:token"       minOccurs="0" />
78            <!-- The optional release note for this package. -->
79            <xsd:element name="release-note" type="xsd:string"      minOccurs="0" />
80            <!-- The optional release note URL of this package -->
81            <xsd:element name="release-url"  type="xsd:token"       minOccurs="0" />
82            <!-- A list of file archives for this package. -->
83            <xsd:element name="archives"     type="sdk:archivesType" />
84
85            <!-- An optional element indicating the package is obsolete.
86                 The string content is however currently not defined and ignored. -->
87            <xsd:element name="obsolete"  type="xsd:string" minOccurs="0" />
88
89            <!-- An add-on can declare 0 or more libraries. -->
90
91            <xsd:element name="libs">
92                <xsd:complexType>
93                    <xsd:sequence minOccurs="0" maxOccurs="unbounded">
94                        <xsd:element name="lib">
95                            <xsd:complexType>
96                                <xsd:all>
97                                    <!-- The name of the library. -->
98                                    <xsd:element name="name" type="xsd:normalizedString" />
99                                    <!-- The optional description of this add-on library. -->
100                                    <xsd:element name="description" type="xsd:string" minOccurs="0" />
101                                </xsd:all>
102                            </xsd:complexType>
103                        </xsd:element>
104                    </xsd:sequence>
105                </xsd:complexType>
106            </xsd:element>
107        </xsd:all>
108    </xsd:complexType>
109
110
111    <!-- The definition of an SDK extra package. This kind of package is for
112         "free" content. Such packages are installed in SDK/vendor/path.
113    -->
114
115    <xsd:complexType name="extraType" >
116        <xsd:annotation>
117            <xsd:documentation>
118                An SDK extra package. This kind of package is for "free" content.
119                Such packages are installed in SDK/vendor/path.
120            </xsd:documentation>
121        </xsd:annotation>
122        <xsd:all>
123
124            <!-- The install path top folder name. It must not be empty.
125                 The segments "add-ons", "docs", "platforms", "platform-tools", "temp"
126                 and "tools" are reserved and cannot be used.
127            -->
128            <xsd:element name="vendor" type="sdk:segmentType" />
129
130            <!-- The install path sub-folder name. It must not be empty. -->
131            <xsd:element name="path" type="sdk:segmentType" />
132
133            <!-- The revision, an int > 0, incremented each time a new
134                 package is generated. -->
135            <xsd:element name="revision"     type="xsd:positiveInteger" />
136            <!-- The optional license of this package. If present, users will have
137                 to agree to it before downloading. -->
138            <xsd:element name="uses-license" type="sdk:usesLicenseType" minOccurs="0" />
139            <!-- The optional description of this package. -->
140            <xsd:element name="description"  type="xsd:string"      minOccurs="0" />
141            <!-- The optional description URL of this package -->
142            <xsd:element name="desc-url"     type="xsd:token"       minOccurs="0" />
143            <!-- The optional release note for this package. -->
144            <xsd:element name="release-note" type="xsd:string"      minOccurs="0" />
145            <!-- The optional release note URL of this package -->
146            <xsd:element name="release-url"  type="xsd:token"       minOccurs="0" />
147            <!-- A list of file archives for this package. -->
148            <xsd:element name="archives"     type="sdk:archivesType" />
149            <!-- The minimal revision of tools required by this package.
150                 Optional. If present, must be an int > 0. -->
151            <xsd:element name="min-tools-rev" type="xsd:positiveInteger" minOccurs="0" />
152            <!-- The minimal API level required by this package.
153                 Optional. If present, must be an int > 0. -->
154            <xsd:element name="min-api-level" type="xsd:positiveInteger" minOccurs="0" />
155
156            <!-- An optional element indicating the package is obsolete.
157                 The string content is however currently not defined and ignored. -->
158            <xsd:element name="obsolete"  type="xsd:string" minOccurs="0" />
159        </xsd:all>
160    </xsd:complexType>
161
162
163    <!-- The definition of a path segment used by the extra element. -->
164
165    <xsd:simpleType name="segmentType">
166        <xsd:annotation>
167            <xsd:documentation>
168                One path segment for the install path of an extra element.
169                It must be a single-segment path. It must not be empty.
170            </xsd:documentation>
171        </xsd:annotation>
172        <xsd:restriction base="xsd:token">
173            <xsd:pattern value="[a-zA-Z0-9_]+"/>
174        </xsd:restriction>
175    </xsd:simpleType>
176
177
178    <!-- The definition of a license to be referenced by the uses-license element. -->
179
180    <xsd:complexType name="licenseType">
181        <xsd:annotation>
182            <xsd:documentation>
183                A license definition. Such a license must be used later as a reference
184                using a uses-license element in one of the package elements.
185            </xsd:documentation>
186        </xsd:annotation>
187        <xsd:simpleContent>
188            <xsd:extension base="xsd:string">
189                <xsd:attribute name="id"   type="xsd:ID" />
190                <xsd:attribute name="type" type="xsd:token" fixed="text" />
191            </xsd:extension>
192        </xsd:simpleContent>
193    </xsd:complexType>
194
195
196    <!-- Type describing the license used by a package.
197         The license MUST be defined using a license node and referenced
198         using the ref attribute of the license element inside a package.
199     -->
200
201    <xsd:complexType name="usesLicenseType">
202        <xsd:annotation>
203            <xsd:documentation>
204                Describes the license used by a package. The license MUST be defined
205                using a license node and referenced using the ref attribute of the
206                license element inside a package.
207            </xsd:documentation>
208        </xsd:annotation>
209        <xsd:attribute name="ref" type="xsd:IDREF" />
210    </xsd:complexType>
211
212
213    <!-- A collection of files that can be downloaded for a given architecture.
214         The <archives> node is mandatory in the repository elements and the
215         collection must have at least one <archive> declared.
216         Each archive is a zip file that will be unzipped in a location that depends
217         on its package type.
218     -->
219
220    <xsd:complexType name="archivesType">
221        <xsd:annotation>
222            <xsd:documentation>
223                A collection of files that can be downloaded for a given architecture.
224                The &lt;archives&gt; node is mandatory in the repository packages and the
225                collection must have at least one &lt;archive&gt; declared.
226                Each archive is a zip file that will be unzipped in a location that depends
227                on its package type.
228            </xsd:documentation>
229        </xsd:annotation>
230        <xsd:sequence minOccurs="1" maxOccurs="unbounded">
231            <!-- One archive file -->
232            <xsd:element name="archive">
233                <xsd:complexType>
234                    <!-- Properties of the archive file -->
235                    <xsd:all>
236                        <!-- The size in bytes of the archive to download. -->
237                        <xsd:element name="size"     type="xsd:positiveInteger" />
238                        <!-- The checksum of the archive file. -->
239                        <xsd:element name="checksum" type="sdk:checksumType" />
240                        <!-- The URL is an absolute URL if it starts with http://, https://
241                             or ftp://. Otherwise it is relative to the parent directory that
242                             contains this repository.xml -->
243                        <xsd:element name="url"      type="xsd:token" />
244                    </xsd:all>
245
246                    <!-- Attributes that identify the OS and architecture -->
247                    <xsd:attribute name="os" use="required">
248                        <xsd:simpleType>
249                            <xsd:restriction base="xsd:token">
250                                <xsd:enumeration value="any" />
251                                <xsd:enumeration value="linux" />
252                                <xsd:enumeration value="macosx" />
253                                <xsd:enumeration value="windows" />
254                            </xsd:restriction>
255                        </xsd:simpleType>
256                    </xsd:attribute>
257                    <xsd:attribute name="arch" use="optional">
258                        <xsd:simpleType>
259                            <xsd:restriction base="xsd:token">
260                                <xsd:enumeration value="any" />
261                                <xsd:enumeration value="ppc" />
262                                <xsd:enumeration value="x86" />
263                                <xsd:enumeration value="x86_64" />
264                            </xsd:restriction>
265                        </xsd:simpleType>
266                    </xsd:attribute>
267                </xsd:complexType>
268            </xsd:element>
269        </xsd:sequence>
270    </xsd:complexType>
271
272
273    <!-- The definition of a file checksum -->
274
275    <xsd:simpleType name="sha1Number">
276        <xsd:annotation>
277            <xsd:documentation>A SHA1 checksum.</xsd:documentation>
278        </xsd:annotation>
279        <xsd:restriction base="xsd:string">
280            <xsd:pattern value="([0-9a-fA-F]){40}"/>
281        </xsd:restriction>
282    </xsd:simpleType>
283
284    <xsd:complexType name="checksumType">
285        <xsd:annotation>
286            <xsd:documentation>A file checksum, currently only SHA1.</xsd:documentation>
287        </xsd:annotation>
288        <xsd:simpleContent>
289            <xsd:extension base="sdk:sha1Number">
290                <xsd:attribute name="type" type="xsd:token" fixed="sha1" />
291            </xsd:extension>
292        </xsd:simpleContent>
293    </xsd:complexType>
294
295</xsd:schema>
296