Merge change 1501 into donut

* changes:
  ADT #1844909: SDK manager, define XML schemas & sample XMLs
This commit is contained in:
Android (Google) Code Review
2009-05-14 12:56:35 -07:00
5 changed files with 514 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Eclipse Public License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.eclipse.org/org/documents/epl-v10.php
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.sdkmanager.repository;
import java.io.InputStream;
/**
* Constants for the sdk-repository XML Schema
*/
public class SdkRepositoryConstants {
public static final String NS_SDK_REPOSITORY =
"http://schemas.android.com/sdk/android/repository/1";
public static InputStream getXsdStream() {
return SdkRepositoryConstants.class.getResourceAsStream("sdk-repository.xsd");
}
}

View File

@@ -0,0 +1,181 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<xsd:schema
targetNamespace="http://schemas.android.com/sdk/android/repository/1"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sdk="http://schemas.android.com/sdk/android/repository/1"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
version="1">
<!-- The definition of a file checksum -->
<xsd:simpleType name="sha1Number">
<xsd:annotation>
<xsd:documentation>A SHA1 checksum.</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:pattern value="([0-9a-fA-F]){40}"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="checksumType">
<xsd:annotation>
<xsd:documentation>A file checksum, currently only SHA1.</xsd:documentation>
</xsd:annotation>
<xsd:simpleContent>
<xsd:extension base="sdk:sha1Number">
<xsd:attribute name="type" type="xsd:token" fixed="sha1" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<!-- The repository contains a collection of downloadable items -->
<xsd:element name="sdk-repository">
<xsd:annotation>
<xsd:documentation>
The repository contains collections of downloadable items.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<!-- The definition of an SDK platform item -->
<xsd:element name="platform">
<xsd:complexType>
<xsd:all>
<xsd:element name="version" type="xsd:normalizedString" />
<xsd:element name="api-level" type="xsd:positiveInteger" />
<xsd:element name="revision" type="xsd:positiveInteger" />
<xsd:element name="description" type="xsd:string" minOccurs="0" />
<xsd:element name="desc-url" type="xsd:token" minOccurs="0" />
<xsd:element name="archives" type="sdk:archivesType" />
</xsd:all>
</xsd:complexType>
</xsd:element>
<!-- The definition of an SDK Add-on item -->
<xsd:element name="add-on">
<xsd:complexType>
<xsd:all>
<xsd:element name="name" type="xsd:normalizedString" />
<xsd:element name="vendor" type="xsd:normalizedString" />
<xsd:element name="api-level" type="xsd:positiveInteger" />
<xsd:element name="revision" type="xsd:positiveInteger" />
<xsd:element name="description" type="xsd:string" minOccurs="0" />
<xsd:element name="desc-url" type="xsd:token" minOccurs="0" />
<xsd:element name="archives" type="sdk:archivesType" />
<xsd:element name="libs">
<xsd:complexType>
<xsd:sequence maxOccurs="unbounded">
<xsd:element name="lib">
<xsd:complexType>
<xsd:all>
<xsd:element name="name" type="xsd:normalizedString" />
<xsd:element name="description" type="xsd:string" minOccurs="0" />
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
<!-- The definition of an SDK tool item -->
<xsd:element name="tool">
<xsd:complexType>
<xsd:all>
<xsd:element name="revision" type="xsd:positiveInteger" />
<xsd:element name="description" type="xsd:string" minOccurs="0" />
<xsd:element name="desc-url" type="xsd:token" minOccurs="0" />
<xsd:element name="archives" type="sdk:archivesType" />
</xsd:all>
</xsd:complexType>
</xsd:element>
<!-- The definition of an SDK doc item -->
<xsd:element name="doc">
<xsd:complexType>
<xsd:all>
<xsd:element name="api-level" type="xsd:positiveInteger" />
<xsd:element name="revision" type="xsd:positiveInteger" />
<xsd:element name="description" type="xsd:string" minOccurs="0" />
<xsd:element name="desc-url" type="xsd:token" minOccurs="0" />
<xsd:element name="archives" type="sdk:archivesType" />
</xsd:all>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
<!-- A collection of files that can be downloaded for a given architectures -->
<xsd:complexType name="archivesType">
<xsd:annotation>
<xsd:documentation>A collection of architecture-dependent archives.</xsd:documentation>
</xsd:annotation>
<xsd:sequence maxOccurs="unbounded">
<!-- One archive file -->
<xsd:element name="archive">
<xsd:complexType>
<!-- Properties of the file -->
<xsd:all>
<xsd:element name="size" type="xsd:positiveInteger" />
<xsd:element name="checksum" type="sdk:checksumType" />
<xsd:element name="url" type="xsd:token" />
</xsd:all>
<!-- Attributes that identify the architecture -->
<xsd:attribute name="os" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:token">
<xsd:enumeration value="any" />
<xsd:enumeration value="linux" />
<xsd:enumeration value="macosx" />
<xsd:enumeration value="windows" />
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="arch" use="optional">
<xsd:simpleType>
<xsd:restriction base="xsd:token">
<xsd:enumeration value="any" />
<xsd:enumeration value="ppc" />
<xsd:enumeration value="x86" />
<xsd:enumeration value="x86_64" />
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>