am f4c63fae: SDK Manager support for future schemas.
Merge commit 'f4c63fae0c6d0654ab49e05b3292e218f82f97d8' into eclair * commit 'f4c63fae0c6d0654ab49e05b3292e218f82f97d8': SDK Manager support for future schemas.
This commit is contained in:
@@ -322,7 +322,7 @@ public class RepoSource implements IDescription {
|
||||
|
||||
String lastError = null;
|
||||
String extraError = null;
|
||||
for (int version = SdkRepository.XSD_LATEST_VERSION; version >= 1; version--) {
|
||||
for (int version = SdkRepository.NS_LATEST_VERSION; version >= 1; version--) {
|
||||
try {
|
||||
Validator validator = getValidator(version);
|
||||
|
||||
|
||||
@@ -26,30 +26,24 @@ public class SdkRepository {
|
||||
|
||||
/** The URL of the official Google sdk-repository site. */
|
||||
public static final String URL_GOOGLE_SDK_REPO_SITE =
|
||||
"https://dl-ssl.google.com/android/repository/"; //$NON-NLS-1$
|
||||
"https://dl-ssl.google.com/android/repository/"; //$NON-NLS-1$
|
||||
|
||||
public static final String URL_DEFAULT_XML_FILE = "repository.xml"; //$NON-NLS-1$
|
||||
|
||||
/** The XML namespace of the sdk-repository XML version 1.
|
||||
* @deprecated
|
||||
*/
|
||||
public static final String NS_SDK_REPOSITORY_1 = getSchemaUri(1);
|
||||
|
||||
/** The XML namespace of the sdk-repository XML version 2.
|
||||
* @deprecated
|
||||
*/
|
||||
public static final String NS_SDK_REPOSITORY_2 = getSchemaUri(2);
|
||||
|
||||
/** The XML namespace of the latest sdk-repository XML. */
|
||||
public static final String NS_SDK_REPOSITORY = NS_SDK_REPOSITORY_2;
|
||||
/** The base of our XML namespace. */
|
||||
private static final String NS_SDK_REPOSITORY_BASE =
|
||||
"http://schemas.android.com/sdk/android/repository/"; //$NON-NLS-1$
|
||||
|
||||
/** The pattern of our XML namespace. */
|
||||
public static final String NS_SDK_REPOSITORY_PATTERN =
|
||||
"http://schemas.android.com/sdk/android/repository/[1-9][0-9]*"; //$NON-NLS-1$
|
||||
NS_SDK_REPOSITORY_BASE + "[1-9][0-9]*"; //$NON-NLS-1$
|
||||
|
||||
/** The latest version of the sdk-repository XML Schema, currently 2.
|
||||
/** The latest version of the sdk-repository XML Schema.
|
||||
* Valid version numbers are between 1 and this number, included. */
|
||||
public static final int XSD_LATEST_VERSION = 2;
|
||||
public static final int NS_LATEST_VERSION = 1;
|
||||
|
||||
/** The XML namespace of the latest sdk-repository XML. */
|
||||
public static final String NS_SDK_REPOSITORY = getSchemaUri(NS_LATEST_VERSION);
|
||||
|
||||
/** The root sdk-repository element */
|
||||
public static final String NODE_SDK_REPOSITORY = "sdk-repository"; //$NON-NLS-1$
|
||||
@@ -135,8 +129,7 @@ public class SdkRepository {
|
||||
/**
|
||||
* Returns a stream to the requested repository XML Schema.
|
||||
*
|
||||
* @param version 1 for {@link #NS_SDK_REPOSITORY_1}, 2 for {@link #NS_SDK_REPOSITORY_2}.
|
||||
* You can use {@link #XSD_LATEST_VERSION} to always get the latest version.
|
||||
* @param version Between 1 and {@link #NS_LATEST_VERSION}, included.
|
||||
* @return An {@link InputStream} object for the local XSD file or
|
||||
* null if there is no schema for the requested version.
|
||||
*/
|
||||
@@ -147,11 +140,10 @@ public class SdkRepository {
|
||||
|
||||
/**
|
||||
* Returns the URI of the SDK Repository schema for the given version number.
|
||||
* @param version Between 1 and {@link #XSD_LATEST_VERSION} included.
|
||||
* @param version Between 1 and {@link #NS_LATEST_VERSION} included.
|
||||
*/
|
||||
public static String getSchemaUri(int version) {
|
||||
return String.format("http://schemas.android.com/sdk/android/repository/%d", //$NON-NLS-1$
|
||||
version); //
|
||||
return String.format(NS_SDK_REPOSITORY_BASE + "%d", version); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,421 +0,0 @@
|
||||
<?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/2"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:sdk="http://schemas.android.com/sdk/android/repository/2"
|
||||
elementFormDefault="qualified"
|
||||
attributeFormDefault="unqualified"
|
||||
version="1">
|
||||
|
||||
<!-- The repository contains a collection of downloadable items known as
|
||||
"packages". Each package has a type and various attributes and contains
|
||||
a list of file "archives" that can be downloaded for specific OSes.
|
||||
|
||||
An Android SDK repository is a web site that contains a "repository.xml"
|
||||
file that conforms to this XML Schema.
|
||||
-->
|
||||
|
||||
<xsd:element name="sdk-repository">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
The repository contains collections of downloadable packages.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
|
||||
<xsd:complexType>
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
|
||||
<!-- The definition of an SDK platform package. -->
|
||||
|
||||
<xsd:element name="platform">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>An SDK platform package.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:all>
|
||||
<!-- The Android platform version. It is string such as "1.0". -->
|
||||
<xsd:element name="version" type="xsd:normalizedString" />
|
||||
<!-- The Android API Level for the platform. An int > 0. -->
|
||||
<xsd:element name="api-level" type="xsd:positiveInteger" />
|
||||
<!-- The optional codename for this platform, if it's a preview. -->
|
||||
<xsd:element name="codename" type="xsd:string" minOccurs="0" />
|
||||
|
||||
<!-- The revision, an int > 0, incremented each time a new
|
||||
package is generated. -->
|
||||
<xsd:element name="revision" type="xsd:positiveInteger" />
|
||||
<!-- The optional license of this package. If present, users will have
|
||||
to agree to it before downloading. -->
|
||||
<xsd:element name="uses-license" type="sdk:licenseType" minOccurs="0" />
|
||||
<!-- The optional description of this package. -->
|
||||
<xsd:element name="description" type="xsd:string" minOccurs="0" />
|
||||
<!-- The optional description URL of this package -->
|
||||
<xsd:element name="desc-url" type="xsd:token" minOccurs="0" />
|
||||
<!-- The optional release note for this package. -->
|
||||
<xsd:element name="release-note" type="xsd:string" minOccurs="0" />
|
||||
<!-- The optional release note URL of this package -->
|
||||
<xsd:element name="release-url" type="xsd:token" minOccurs="0" />
|
||||
<!-- A list of file archives for this package. -->
|
||||
<xsd:element name="archives" type="sdk:archivesType" />
|
||||
<!-- The minimal revision of tools required by this package.
|
||||
Optional. If present, must be an int > 0. -->
|
||||
<xsd:element name="min-tools-rev" type="xsd:positiveInteger" minOccurs="0" />
|
||||
</xsd:all>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
|
||||
<!-- The definition of an SDK Add-on package. -->
|
||||
|
||||
<xsd:element name="add-on">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>An SDK add-on package.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:all>
|
||||
<!-- The name of the add-on. -->
|
||||
<xsd:element name="name" type="xsd:normalizedString" />
|
||||
<!-- The vendor of the add-on. -->
|
||||
<xsd:element name="vendor" type="xsd:normalizedString" />
|
||||
<!-- The Android API Level for the add-on. An int > 0. -->
|
||||
<xsd:element name="api-level" type="xsd:positiveInteger" />
|
||||
<!-- The optional codename for this add-on, if it's a preview. -->
|
||||
<xsd:element name="codename" type="xsd:string" minOccurs="0" />
|
||||
|
||||
<!-- The revision, an int > 0, incremented each time a new
|
||||
package is generated. -->
|
||||
<xsd:element name="revision" type="xsd:positiveInteger" />
|
||||
<!-- The optional license of this package. If present, users will have
|
||||
to agree to it before downloading. -->
|
||||
<xsd:element name="uses-license" type="sdk:licenseType" minOccurs="0" />
|
||||
<!-- The optional description of this package. -->
|
||||
<xsd:element name="description" type="xsd:string" minOccurs="0" />
|
||||
<!-- The optional description URL of this package -->
|
||||
<xsd:element name="desc-url" type="xsd:token" minOccurs="0" />
|
||||
<!-- The optional release note for this package. -->
|
||||
<xsd:element name="release-note" type="xsd:string" minOccurs="0" />
|
||||
<!-- The optional release note URL of this package -->
|
||||
<xsd:element name="release-url" type="xsd:token" minOccurs="0" />
|
||||
<!-- A list of file archives for this package. -->
|
||||
<xsd:element name="archives" type="sdk:archivesType" />
|
||||
|
||||
<!-- An add-on can declare 0 or more libraries. -->
|
||||
|
||||
<xsd:element name="libs">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="lib">
|
||||
<xsd:complexType>
|
||||
<xsd:all>
|
||||
<!-- The name of the library. -->
|
||||
<xsd:element name="name" type="xsd:normalizedString" />
|
||||
<!-- The optional description of this add-on library. -->
|
||||
<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 package. -->
|
||||
|
||||
<xsd:element name="tool">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>An SDK tool package.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:all>
|
||||
<!-- The revision, an int > 0, incremented each time a new
|
||||
package is generated. -->
|
||||
<xsd:element name="revision" type="xsd:positiveInteger" />
|
||||
<!-- The optional license of this package. If present, users will have
|
||||
to agree to it before downloading. -->
|
||||
<xsd:element name="uses-license" type="sdk:licenseType" minOccurs="0" />
|
||||
<!-- The optional description of this package. -->
|
||||
<xsd:element name="description" type="xsd:string" minOccurs="0" />
|
||||
<!-- The optional description URL of this package -->
|
||||
<xsd:element name="desc-url" type="xsd:token" minOccurs="0" />
|
||||
<!-- The optional release note for this package. -->
|
||||
<xsd:element name="release-note" type="xsd:string" minOccurs="0" />
|
||||
<!-- The optional release note URL of this package -->
|
||||
<xsd:element name="release-url" type="xsd:token" minOccurs="0" />
|
||||
<!-- A list of file archives for this package. -->
|
||||
<xsd:element name="archives" type="sdk:archivesType" />
|
||||
</xsd:all>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
|
||||
<!-- The definition of an SDK doc package. -->
|
||||
|
||||
<xsd:element name="doc">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>An SDK doc package.</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:all>
|
||||
<!-- The Android API Level for the documentation. An int > 0. -->
|
||||
<xsd:element name="api-level" type="xsd:positiveInteger" />
|
||||
<!-- The optional codename for this doc, if it's a preview. -->
|
||||
<xsd:element name="codename" type="xsd:string" minOccurs="0" />
|
||||
|
||||
<!-- The revision, an int > 0, incremented each time a new
|
||||
package is generated. -->
|
||||
<xsd:element name="revision" type="xsd:positiveInteger" />
|
||||
<!-- The optional license of this package. If present, users will have
|
||||
to agree to it before downloading. -->
|
||||
<xsd:element name="uses-license" type="sdk:licenseType" minOccurs="0" />
|
||||
<!-- The optional description of this package. -->
|
||||
<xsd:element name="description" type="xsd:string" minOccurs="0" />
|
||||
<!-- The optional description URL of this package -->
|
||||
<xsd:element name="desc-url" type="xsd:token" minOccurs="0" />
|
||||
<!-- The optional release note for this package. -->
|
||||
<xsd:element name="release-note" type="xsd:string" minOccurs="0" />
|
||||
<!-- The optional release note URL of this package -->
|
||||
<xsd:element name="release-url" type="xsd:token" minOccurs="0" />
|
||||
<!-- A list of file archives for this package. -->
|
||||
<xsd:element name="archives" type="sdk:archivesType" />
|
||||
</xsd:all>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
|
||||
<!-- The definition of an SDK extra package. This kind of package is for
|
||||
"free" content and specifies in which fixed root directory it must be
|
||||
installed.
|
||||
-->
|
||||
|
||||
<xsd:element name="extra">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
An SDK extra package. This kind of package is for "free"
|
||||
content and specifies in which fixed root directory it must be
|
||||
installed.
|
||||
The paths "add-ons", "platforms", "tools" and "docs" are
|
||||
reserved and cannot be used.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:all>
|
||||
<!-- The install folder name. It must be a single-segment path.
|
||||
The paths "add-ons", "platforms", "tools" and "docs" are
|
||||
reserved and cannot be used.
|
||||
-->
|
||||
<xsd:element name="path">
|
||||
<xsd:simpleType>
|
||||
<xsd:restriction base="xsd:token">
|
||||
<xsd:pattern value="[^/\\]+"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:element>
|
||||
|
||||
<!-- The revision, an int > 0, incremented each time a new
|
||||
package is generated. -->
|
||||
<xsd:element name="revision" type="xsd:positiveInteger" />
|
||||
<!-- The optional license of this package. If present, users will have
|
||||
to agree to it before downloading. -->
|
||||
<xsd:element name="uses-license" type="sdk:licenseType" minOccurs="0" />
|
||||
<!-- The optional description of this package. -->
|
||||
<xsd:element name="description" type="xsd:string" minOccurs="0" />
|
||||
<!-- The optional description URL of this package -->
|
||||
<xsd:element name="desc-url" type="xsd:token" minOccurs="0" />
|
||||
<!-- The optional release note for this package. -->
|
||||
<xsd:element name="release-note" type="xsd:string" minOccurs="0" />
|
||||
<!-- The optional release note URL of this package -->
|
||||
<xsd:element name="release-url" type="xsd:token" minOccurs="0" />
|
||||
<!-- A list of file archives for this package. -->
|
||||
<xsd:element name="archives" type="sdk:archivesType" />
|
||||
<!-- The minimal revision of tools required by this package.
|
||||
Optional. If present, must be an int > 0. -->
|
||||
<xsd:element name="min-tools-rev" type="xsd:positiveInteger" minOccurs="0" />
|
||||
</xsd:all>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
|
||||
<!-- The definition of a sample package.
|
||||
-->
|
||||
|
||||
<xsd:element name="sample">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
An SDK sample package.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:all>
|
||||
<!-- STOPSHIP! TODO how do we link to the addon *or* platform?
|
||||
e.g. api-level + codename + optional addon name+vendor?
|
||||
api-level is mandatory, codename is optional;
|
||||
if addon name+vendor is set, it's for that addon, otherwise
|
||||
it's for a platform.
|
||||
-->
|
||||
<!-- The Android API Level for the documentation. An int > 0. -->
|
||||
<xsd:element name="api-level" type="xsd:positiveInteger" />
|
||||
<!-- The optional codename for this doc, if it's a preview. -->
|
||||
<xsd:element name="codename" type="xsd:string" minOccurs="0" />
|
||||
|
||||
<!-- The revision, an int > 0, incremented each time a new
|
||||
package is generated. -->
|
||||
<xsd:element name="revision" type="xsd:positiveInteger" />
|
||||
<!-- The optional license of this package. If present, users will have
|
||||
to agree to it before downloading. -->
|
||||
<xsd:element name="uses-license" type="sdk:licenseType" minOccurs="0" />
|
||||
<!-- The optional description of this package. -->
|
||||
<xsd:element name="description" type="xsd:string" minOccurs="0" />
|
||||
<!-- The optional description URL of this package -->
|
||||
<xsd:element name="desc-url" type="xsd:token" minOccurs="0" />
|
||||
<!-- The optional release note for this package. -->
|
||||
<xsd:element name="release-note" type="xsd:string" minOccurs="0" />
|
||||
<!-- The optional release note URL of this package -->
|
||||
<xsd:element name="release-url" type="xsd:token" minOccurs="0" />
|
||||
<!-- A list of file archives for this package. -->
|
||||
<xsd:element name="archives" type="sdk:archivesType" />
|
||||
</xsd:all>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
|
||||
<!-- The definition of a license to be referenced by the uses-license element. -->
|
||||
|
||||
<xsd:element name="license">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A license definition. Such a license must be used later as a reference
|
||||
using a uses-license element in one of the package elements.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:complexType>
|
||||
<xsd:simpleContent>
|
||||
<xsd:extension base="xsd:string">
|
||||
<xsd:attribute name="id" type="xsd:ID" />
|
||||
<xsd:attribute name="type" type="xsd:token" fixed="text" />
|
||||
</xsd:extension>
|
||||
</xsd:simpleContent>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
|
||||
|
||||
<!-- Type describing the license used by a package.
|
||||
The license MUST be defined using a license node and referenced
|
||||
using the ref attribute of the license element inside a package.
|
||||
-->
|
||||
|
||||
<xsd:complexType name="licenseType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Describes the license used by a package. The license MUST be defined
|
||||
using a license node and referenced using the ref attribute of the
|
||||
license element inside a package.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="ref" type="xsd:IDREF" />
|
||||
</xsd:complexType>
|
||||
|
||||
|
||||
<!-- A collection of files that can be downloaded for a given architecture.
|
||||
The <archives> node is mandatory in the repository elements and the
|
||||
collection must have at least one <archive> declared.
|
||||
Each archive is a zip file that will be unzipped in a location that depends
|
||||
on its package type.
|
||||
-->
|
||||
|
||||
<xsd:complexType name="archivesType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
A collection of files that can be downloaded for a given architecture.
|
||||
The <archives> node is mandatory in the repository packages and the
|
||||
collection must have at least one <archive> declared.
|
||||
Each archive is a zip file that will be unzipped in a location that depends
|
||||
on its package type.
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:sequence minOccurs="1" maxOccurs="unbounded">
|
||||
<!-- One archive file -->
|
||||
<xsd:element name="archive">
|
||||
<xsd:complexType>
|
||||
<!-- Properties of the archive file -->
|
||||
<xsd:all>
|
||||
<!-- The size in bytes of the archive to download. -->
|
||||
<xsd:element name="size" type="xsd:positiveInteger" />
|
||||
<!-- The checksum of the archive file. -->
|
||||
<xsd:element name="checksum" type="sdk:checksumType" />
|
||||
<!-- The URL is an absolute URL if it starts with http://, https://
|
||||
or ftp://. Otherwise it is relative to the parent directory that
|
||||
contains this repository.xml -->
|
||||
<xsd:element name="url" type="xsd:token" />
|
||||
</xsd:all>
|
||||
|
||||
<!-- Attributes that identify the OS and 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>
|
||||
|
||||
|
||||
<!-- 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>
|
||||
|
||||
|
||||
</xsd:schema>
|
||||
@@ -146,37 +146,6 @@ public class SdkRepositoryTest extends TestCase {
|
||||
handler.verify();
|
||||
}
|
||||
|
||||
/** Validate a valid sample using namespace version 2 using an InputStream */
|
||||
public void testValidateLocalRepositoryFile2() throws Exception {
|
||||
InputStream xmlStream = this.getClass().getResourceAsStream(
|
||||
"/com/android/sdklib/testdata/repository_sample_2.xml");
|
||||
Source source = new StreamSource(xmlStream);
|
||||
|
||||
CaptureErrorHandler handler = new CaptureErrorHandler();
|
||||
Validator validator = getValidator(2, handler);
|
||||
validator.validate(source);
|
||||
handler.verify();
|
||||
}
|
||||
|
||||
/** Test that validating a v2 file using the v1 schema fails. */
|
||||
public void testValidateFile2UsingNs1() throws Exception {
|
||||
InputStream xmlStream = this.getClass().getResourceAsStream(
|
||||
"/com/android/sdklib/testdata/repository_sample_2.xml");
|
||||
Source source = new StreamSource(xmlStream);
|
||||
|
||||
Validator validator = getValidator(1, null); // validate v2 against v1... fail!
|
||||
|
||||
try {
|
||||
validator.validate(source);
|
||||
} catch (SAXParseException e) {
|
||||
// We expect to get this specific exception message
|
||||
assertRegex("cvc-elt.1: Cannot find the declaration of element 'sdk:sdk-repository'.*", e.getMessage());
|
||||
return;
|
||||
}
|
||||
// We shouldn't get here
|
||||
fail();
|
||||
}
|
||||
|
||||
/** A document should at least have a root to be valid */
|
||||
public void testEmptyXml() throws Exception {
|
||||
String document = "<?xml version=\"1.0\"?>";
|
||||
@@ -184,7 +153,7 @@ public class SdkRepositoryTest extends TestCase {
|
||||
Source source = new StreamSource(new StringReader(document));
|
||||
|
||||
CaptureErrorHandler handler = new CaptureErrorHandler();
|
||||
Validator validator = getValidator(SdkRepository.XSD_LATEST_VERSION, handler);
|
||||
Validator validator = getValidator(SdkRepository.NS_LATEST_VERSION, handler);
|
||||
|
||||
try {
|
||||
validator.validate(source);
|
||||
@@ -200,7 +169,7 @@ public class SdkRepositoryTest extends TestCase {
|
||||
|
||||
private static String OPEN_TAG =
|
||||
"<r:sdk-repository xmlns:r=\"http://schemas.android.com/sdk/android/repository/" +
|
||||
Integer.toString(SdkRepository.XSD_LATEST_VERSION) +
|
||||
Integer.toString(SdkRepository.NS_LATEST_VERSION) +
|
||||
"\">";
|
||||
|
||||
private static String CLOSE_TAG = "</r:sdk-repository>";
|
||||
@@ -214,7 +183,7 @@ public class SdkRepositoryTest extends TestCase {
|
||||
Source source = new StreamSource(new StringReader(document));
|
||||
|
||||
CaptureErrorHandler handler = new CaptureErrorHandler();
|
||||
Validator validator = getValidator(SdkRepository.XSD_LATEST_VERSION, handler);
|
||||
Validator validator = getValidator(SdkRepository.NS_LATEST_VERSION, handler);
|
||||
validator.validate(source);
|
||||
handler.verify();
|
||||
}
|
||||
@@ -229,7 +198,7 @@ public class SdkRepositoryTest extends TestCase {
|
||||
Source source = new StreamSource(new StringReader(document));
|
||||
|
||||
// don't capture the validator errors, we want it to fail and catch the exception
|
||||
Validator validator = getValidator(SdkRepository.XSD_LATEST_VERSION, null);
|
||||
Validator validator = getValidator(SdkRepository.NS_LATEST_VERSION, null);
|
||||
try {
|
||||
validator.validate(source);
|
||||
} catch (SAXParseException e) {
|
||||
@@ -251,7 +220,7 @@ public class SdkRepositoryTest extends TestCase {
|
||||
Source source = new StreamSource(new StringReader(document));
|
||||
|
||||
// don't capture the validator errors, we want it to fail and catch the exception
|
||||
Validator validator = getValidator(SdkRepository.XSD_LATEST_VERSION, null);
|
||||
Validator validator = getValidator(SdkRepository.NS_LATEST_VERSION, null);
|
||||
try {
|
||||
validator.validate(source);
|
||||
} catch (SAXParseException e) {
|
||||
@@ -273,7 +242,7 @@ public class SdkRepositoryTest extends TestCase {
|
||||
Source source = new StreamSource(new StringReader(document));
|
||||
|
||||
// don't capture the validator errors, we want it to fail and catch the exception
|
||||
Validator validator = getValidator(SdkRepository.XSD_LATEST_VERSION, null);
|
||||
Validator validator = getValidator(SdkRepository.NS_LATEST_VERSION, null);
|
||||
try {
|
||||
validator.validate(source);
|
||||
} catch (SAXParseException e) {
|
||||
@@ -300,7 +269,7 @@ public class SdkRepositoryTest extends TestCase {
|
||||
Source source = new StreamSource(new StringReader(document));
|
||||
|
||||
// don't capture the validator errors, we want it to fail and catch the exception
|
||||
Validator validator = getValidator(SdkRepository.XSD_LATEST_VERSION, null);
|
||||
Validator validator = getValidator(SdkRepository.NS_LATEST_VERSION, null);
|
||||
try {
|
||||
validator.validate(source);
|
||||
} catch (SAXParseException e) {
|
||||
@@ -326,7 +295,7 @@ public class SdkRepositoryTest extends TestCase {
|
||||
Source source = new StreamSource(new StringReader(document));
|
||||
|
||||
// don't capture the validator errors, we want it to fail and catch the exception
|
||||
Validator validator = getValidator(SdkRepository.XSD_LATEST_VERSION, null);
|
||||
Validator validator = getValidator(SdkRepository.NS_LATEST_VERSION, null);
|
||||
try {
|
||||
validator.validate(source);
|
||||
} catch (SAXParseException e) {
|
||||
|
||||
@@ -1,288 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
* 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.
|
||||
-->
|
||||
<sdk:sdk-repository
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:sdk="http://schemas.android.com/sdk/android/repository/2">
|
||||
|
||||
<!-- Define a couple of licenses. These will be referenced by uses-license later. -->
|
||||
|
||||
<sdk:license type="text" id="license1">
|
||||
This is the license
|
||||
for this platform.
|
||||
</sdk:license>
|
||||
|
||||
<sdk:license id="license2">
|
||||
Licenses are only of type 'text' right now, so this is implied.
|
||||
</sdk:license>
|
||||
|
||||
<!-- Inner elements must be either platform, add-on, doc or tool.
|
||||
There can be 0 or more of each, in any order. -->
|
||||
|
||||
<sdk:platform>
|
||||
<sdk:version>1.0</sdk:version>
|
||||
<sdk:api-level>1</sdk:api-level>
|
||||
<sdk:revision>3</sdk:revision>
|
||||
<sdk:uses-license ref="license1" />
|
||||
<sdk:description>Some optional description</sdk:description>
|
||||
<sdk:desc-url>http://www.example.com/platform1.html</sdk:desc-url>
|
||||
<sdk:release-note>This is an optional release note
|
||||
for this package. It's a free multi-line text.
|
||||
</sdk:release-note>
|
||||
<sdk:release-url>http://some/url/for/the/release/note.html</sdk:release-url>
|
||||
<sdk:min-tools-rev>2</sdk:min-tools-rev>
|
||||
<!-- The archives node is mandatory and it cannot be empty. -->
|
||||
<sdk:archives>
|
||||
<sdk:archive os="any">
|
||||
<sdk:size>65536</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
|
||||
<sdk:url>http://www.example.com/files/plat1.zip</sdk:url>
|
||||
</sdk:archive>
|
||||
</sdk:archives>
|
||||
</sdk:platform>
|
||||
|
||||
<sdk:doc>
|
||||
<sdk:api-level>1</sdk:api-level>
|
||||
<sdk:revision>1</sdk:revision>
|
||||
<!-- the license element is not mandatory. -->
|
||||
<sdk:description>Some optional description</sdk:description>
|
||||
<sdk:desc-url>http://www.example.com/docs.html</sdk:desc-url>
|
||||
<sdk:archives>
|
||||
<sdk:archive os="any">
|
||||
<sdk:size>65536</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
|
||||
<sdk:url>http://www.example.com/docs/docs1.zip</sdk:url>
|
||||
</sdk:archive>
|
||||
</sdk:archives>
|
||||
</sdk:doc>
|
||||
|
||||
<sdk:add-on>
|
||||
<sdk:name>My First add-on</sdk:name>
|
||||
<sdk:api-level>1</sdk:api-level>
|
||||
<sdk:vendor>John Doe</sdk:vendor>
|
||||
<sdk:revision>1</sdk:revision>
|
||||
<sdk:uses-license ref="license2" />
|
||||
<sdk:description>Some optional description</sdk:description>
|
||||
<sdk:desc-url>http://www.example.com/myfirstaddon</sdk:desc-url>
|
||||
<sdk:archives>
|
||||
<sdk:archive os="any">
|
||||
<sdk:size>65536</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
|
||||
<sdk:url>http://www.example.com/add-ons/first.zip</sdk:url>
|
||||
</sdk:archive>
|
||||
</sdk:archives>
|
||||
<!-- The libs node is mandatory, however it can be empty. -->
|
||||
<sdk:libs>
|
||||
<sdk:lib>
|
||||
<sdk:name>android.blah.somelib</sdk:name>
|
||||
<sdk:description>The description for this library.</sdk:description>
|
||||
</sdk:lib>
|
||||
<sdk:lib>
|
||||
<!-- sdk:description is optional, name is not -->
|
||||
<sdk:name>com.android.mymaps</sdk:name>
|
||||
</sdk:lib>
|
||||
</sdk:libs>
|
||||
</sdk:add-on>
|
||||
|
||||
<sdk:platform>
|
||||
<sdk:version>1.1</sdk:version>
|
||||
<sdk:api-level>2</sdk:api-level>
|
||||
<sdk:revision>12</sdk:revision>
|
||||
<sdk:uses-license ref="license1" />
|
||||
<!-- sdk:description and sdk:desc-url are optional -->
|
||||
<sdk:archives>
|
||||
<sdk:archive os="windows">
|
||||
<!-- arch attribute is optional -->
|
||||
<sdk:size>65536</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
|
||||
<sdk:url>distrib/platform-2-12-win.zip</sdk:url>
|
||||
</sdk:archive>
|
||||
<sdk:archive os="macosx" arch="any">
|
||||
<sdk:size>65536</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
|
||||
<sdk:url>distrib/platform-2-12-mac.zip</sdk:url>
|
||||
</sdk:archive>
|
||||
<sdk:archive os="macosx" arch="ppc">
|
||||
<sdk:size>65536</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
|
||||
<sdk:url>distrib/platform-2-12-mac.zip</sdk:url>
|
||||
</sdk:archive>
|
||||
<sdk:archive os="linux" arch="x86">
|
||||
<sdk:size>65536</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
|
||||
<sdk:url>distrib/platform-2-12-linux.tar.bz2</sdk:url>
|
||||
</sdk:archive>
|
||||
<sdk:archive os="linux" arch="x86_64">
|
||||
<sdk:size>65536</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
|
||||
<sdk:url>distrib/platform-2-12-linux.tar.bz2</sdk:url>
|
||||
</sdk:archive>
|
||||
</sdk:archives>
|
||||
</sdk:platform>
|
||||
|
||||
<sdk:add-on>
|
||||
<sdk:name>My Second add-on</sdk:name>
|
||||
<sdk:api-level>2</sdk:api-level>
|
||||
<sdk:vendor>John Deer</sdk:vendor>
|
||||
<sdk:revision>42</sdk:revision>
|
||||
<sdk:archives>
|
||||
<sdk:archive os="windows">
|
||||
<sdk:size>65536</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
|
||||
<sdk:url>distrib/second-42-win.zip</sdk:url>
|
||||
</sdk:archive>
|
||||
<sdk:archive os="linux">
|
||||
<sdk:size>65536</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
|
||||
<sdk:url>distrib/second-42-linux.tar.bz2</sdk:url>
|
||||
</sdk:archive>
|
||||
</sdk:archives>
|
||||
<sdk:libs>
|
||||
<sdk:lib>
|
||||
<sdk:name>android.blah.somelib</sdk:name>
|
||||
<sdk:description>The description for this library.</sdk:description>
|
||||
</sdk:lib>
|
||||
<sdk:lib>
|
||||
<sdk:name>com.android.mymaps</sdk:name>
|
||||
</sdk:lib>
|
||||
</sdk:libs>
|
||||
<sdk:uses-license ref="license2" />
|
||||
</sdk:add-on>
|
||||
|
||||
<sdk:platform>
|
||||
<sdk:version>Pastry</sdk:version>
|
||||
<sdk:api-level>5</sdk:api-level>
|
||||
<sdk:codename>Pastry</sdk:codename>
|
||||
<sdk:revision>3</sdk:revision>
|
||||
<sdk:uses-license ref="license1" />
|
||||
<sdk:description>Preview version for Pastry</sdk:description>
|
||||
<sdk:desc-url>http://www.example.com/platform1.html</sdk:desc-url>
|
||||
<!-- The archives node is mandatory and it cannot be empty. -->
|
||||
<sdk:archives>
|
||||
<sdk:archive os="any">
|
||||
<sdk:size>65536</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
|
||||
<sdk:url>http://www.example.com/files/plat1.zip</sdk:url>
|
||||
</sdk:archive>
|
||||
</sdk:archives>
|
||||
</sdk:platform>
|
||||
|
||||
<sdk:tool>
|
||||
<sdk:revision>1</sdk:revision>
|
||||
<sdk:description>Some optional description</sdk:description>
|
||||
<sdk:desc-url>http://www.example.com/tools.html</sdk:desc-url>
|
||||
<sdk:uses-license ref="license1" />
|
||||
<sdk:archives>
|
||||
<sdk:archive os="any">
|
||||
<sdk:size>65536</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
|
||||
<sdk:url>http://www.example.com/files/tools1.zip</sdk:url>
|
||||
</sdk:archive>
|
||||
</sdk:archives>
|
||||
</sdk:tool>
|
||||
|
||||
<sdk:doc>
|
||||
<sdk:api-level>2</sdk:api-level>
|
||||
<sdk:revision>42</sdk:revision>
|
||||
<sdk:uses-license ref="license2" />
|
||||
<sdk:archives>
|
||||
<sdk:archive os="windows">
|
||||
<sdk:size>65536</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
|
||||
<sdk:url>distrib/docs/2.zip</sdk:url>
|
||||
</sdk:archive>
|
||||
<sdk:archive os="linux">
|
||||
<sdk:size>65536</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
|
||||
<sdk:url>distrib/docs2-linux.tar.bz2</sdk:url>
|
||||
</sdk:archive>
|
||||
<sdk:archive os="macosx">
|
||||
<sdk:size>65536</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
|
||||
<sdk:url>distrib/docs2-mac.tar.bz2</sdk:url>
|
||||
</sdk:archive>
|
||||
</sdk:archives>
|
||||
</sdk:doc>
|
||||
|
||||
<sdk:tool>
|
||||
<sdk:revision>42</sdk:revision>
|
||||
<sdk:uses-license ref="license1" />
|
||||
<sdk:archives>
|
||||
<sdk:archive os="windows">
|
||||
<sdk:size>65536</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
|
||||
<sdk:url>distrib/tools/2.zip</sdk:url>
|
||||
</sdk:archive>
|
||||
<sdk:archive os="linux">
|
||||
<sdk:size>65536</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
|
||||
<sdk:url>distrib/tools2-linux.tar.bz2</sdk:url>
|
||||
</sdk:archive>
|
||||
<sdk:archive os="macosx">
|
||||
<sdk:size>65536</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
|
||||
<sdk:url>distrib/tools2-mac.tar.bz2</sdk:url>
|
||||
</sdk:archive>
|
||||
</sdk:archives>
|
||||
</sdk:tool>
|
||||
|
||||
<sdk:add-on>
|
||||
<sdk:uses-license ref="license2" />
|
||||
<sdk:name>This add-on has no libraries</sdk:name>
|
||||
<sdk:api-level>4</sdk:api-level>
|
||||
<sdk:vendor>Joe Bar</sdk:vendor>
|
||||
<sdk:revision>3</sdk:revision>
|
||||
<sdk:archives>
|
||||
<sdk:archive os="any" arch="any">
|
||||
<sdk:size>65536</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
|
||||
<sdk:url>distrib/imnotanarchiveimadoctorjim.zip</sdk:url>
|
||||
</sdk:archive>
|
||||
</sdk:archives>
|
||||
<!-- The libs node is mandatory, however it can be empty. -->
|
||||
<sdk:libs />
|
||||
</sdk:add-on>
|
||||
|
||||
<sdk:extra>
|
||||
<sdk:path>usb_driver</sdk:path>
|
||||
<sdk:uses-license ref="license2" />
|
||||
<sdk:revision>43</sdk:revision>
|
||||
<sdk:archives>
|
||||
<sdk:archive os="any" arch="any">
|
||||
<sdk:size>65536</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
|
||||
<sdk:url>distrib/extraduff.zip</sdk:url>
|
||||
</sdk:archive>
|
||||
</sdk:archives>
|
||||
<sdk:description>An Extra package for the USB driver, it will install in $SDK/usb_driver</sdk:description>
|
||||
<sdk:desc-url>http://www.example.com/extra.html</sdk:desc-url>
|
||||
<sdk:min-tools-rev>3</sdk:min-tools-rev>
|
||||
</sdk:extra>
|
||||
|
||||
<sdk:sample>
|
||||
<sdk:uses-license ref="license2" />
|
||||
<sdk:api-level>1234</sdk:api-level>
|
||||
<sdk:revision>314153</sdk:revision>
|
||||
<sdk:archives>
|
||||
<sdk:archive os="any" arch="any">
|
||||
<sdk:size>123456</sdk:size>
|
||||
<sdk:checksum type="sha1">2822ae37115ebf13412bbef91339ee0d94545228</sdk:checksum>
|
||||
<sdk:url>archives/samples/dream-1234.zip</sdk:url>
|
||||
</sdk:archive>
|
||||
</sdk:archives>
|
||||
</sdk:sample>
|
||||
|
||||
</sdk:sdk-repository>
|
||||
Reference in New Issue
Block a user