Skip to content

Commit 12ed1a7

Browse files
RaphaelAndroid Git Automerger
authored andcommitted
am 5df7d75: am f4c63fa: SDK Manager support for future schemas.
Merge commit '5df7d75e1c9cc73b4fe0111f89f099e8dba3486b' into eclair-mr2 * commit '5df7d75e1c9cc73b4fe0111f89f099e8dba3486b': SDK Manager support for future schemas.
2 parents eeef441 + 5df7d75 commit 12ed1a7

File tree

5 files changed

+22
-770
lines changed

5 files changed

+22
-770
lines changed

tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/RepoSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ private String validateXml(ByteArrayInputStream xml, String url, ITaskMonitor mo
322322

323323
String lastError = null;
324324
String extraError = null;
325-
for (int version = SdkRepository.XSD_LATEST_VERSION; version >= 1; version--) {
325+
for (int version = SdkRepository.NS_LATEST_VERSION; version >= 1; version--) {
326326
try {
327327
Validator validator = getValidator(version);
328328

tools/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/SdkRepository.java

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,24 @@ public class SdkRepository {
2626

2727
/** The URL of the official Google sdk-repository site. */
2828
public static final String URL_GOOGLE_SDK_REPO_SITE =
29-
"https://dl-ssl.google.com/android/repository/"; //$NON-NLS-1$
29+
"https://dl-ssl.google.com/android/repository/"; //$NON-NLS-1$
3030

3131
public static final String URL_DEFAULT_XML_FILE = "repository.xml"; //$NON-NLS-1$
3232

33-
/** The XML namespace of the sdk-repository XML version 1.
34-
* @deprecated
35-
*/
36-
public static final String NS_SDK_REPOSITORY_1 = getSchemaUri(1);
37-
38-
/** The XML namespace of the sdk-repository XML version 2.
39-
* @deprecated
40-
*/
41-
public static final String NS_SDK_REPOSITORY_2 = getSchemaUri(2);
42-
43-
/** The XML namespace of the latest sdk-repository XML. */
44-
public static final String NS_SDK_REPOSITORY = NS_SDK_REPOSITORY_2;
33+
/** The base of our XML namespace. */
34+
private static final String NS_SDK_REPOSITORY_BASE =
35+
"http://schemas.android.com/sdk/android/repository/"; //$NON-NLS-1$
4536

4637
/** The pattern of our XML namespace. */
4738
public static final String NS_SDK_REPOSITORY_PATTERN =
48-
"http://schemas.android.com/sdk/android/repository/[1-9][0-9]*"; //$NON-NLS-1$
39+
NS_SDK_REPOSITORY_BASE + "[1-9][0-9]*"; //$NON-NLS-1$
4940

50-
/** The latest version of the sdk-repository XML Schema, currently 2.
41+
/** The latest version of the sdk-repository XML Schema.
5142
* Valid version numbers are between 1 and this number, included. */
52-
public static final int XSD_LATEST_VERSION = 2;
43+
public static final int NS_LATEST_VERSION = 1;
44+
45+
/** The XML namespace of the latest sdk-repository XML. */
46+
public static final String NS_SDK_REPOSITORY = getSchemaUri(NS_LATEST_VERSION);
5347

5448
/** The root sdk-repository element */
5549
public static final String NODE_SDK_REPOSITORY = "sdk-repository"; //$NON-NLS-1$
@@ -135,8 +129,7 @@ public class SdkRepository {
135129
/**
136130
* Returns a stream to the requested repository XML Schema.
137131
*
138-
* @param version 1 for {@link #NS_SDK_REPOSITORY_1}, 2 for {@link #NS_SDK_REPOSITORY_2}.
139-
* You can use {@link #XSD_LATEST_VERSION} to always get the latest version.
132+
* @param version Between 1 and {@link #NS_LATEST_VERSION}, included.
140133
* @return An {@link InputStream} object for the local XSD file or
141134
* null if there is no schema for the requested version.
142135
*/
@@ -147,11 +140,10 @@ public static InputStream getXsdStream(int version) {
147140

148141
/**
149142
* Returns the URI of the SDK Repository schema for the given version number.
150-
* @param version Between 1 and {@link #XSD_LATEST_VERSION} included.
143+
* @param version Between 1 and {@link #NS_LATEST_VERSION} included.
151144
*/
152145
public static String getSchemaUri(int version) {
153-
return String.format("http://schemas.android.com/sdk/android/repository/%d", //$NON-NLS-1$
154-
version); //
146+
return String.format(NS_SDK_REPOSITORY_BASE + "%d", version); //$NON-NLS-1$
155147
}
156148

157149
}

0 commit comments

Comments
 (0)