aboutsummaryrefslogtreecommitdiffstats
path: root/sdkmanager
diff options
context:
space:
mode:
authorRaphael Moll <ralf@android.com>2012-05-03 12:04:38 -0700
committerandroid code review <noreply-gerritcodereview@google.com>2012-05-03 12:04:39 -0700
commitea0e2af1c398ad3b189a163fa574ca3d255e5895 (patch)
treea243795d9b19fe4c5ce369731f7f05d7a54b38a1 /sdkmanager
parenta223f715737b30eba8b77bac583dd4686fb316aa (diff)
parent0c6def5d3f0d611bca7dbb7c2b773cd1664ec390 (diff)
downloadsdk-ea0e2af1c398ad3b189a163fa574ca3d255e5895.zip
sdk-ea0e2af1c398ad3b189a163fa574ca3d255e5895.tar.gz
sdk-ea0e2af1c398ad3b189a163fa574ca3d255e5895.tar.bz2
Merge "SDK Tools pkg support for major.minor.micro revisions."
Diffstat (limited to 'sdkmanager')
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/AddonPackage.java9
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/DocPackage.java20
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/IAndroidVersionProvider.java (renamed from sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/IPackageVersion.java)7
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/IPlatformDependency.java8
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/IPreviewVersionProvider.java32
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/Package.java12
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PlatformPackage.java12
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PlatformToolPackage.java10
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PreviewVersion.java185
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PreviewVersionPackage.java158
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SamplePackage.java21
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SourcePackage.java11
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SystemImagePackage.java9
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/ToolPackage.java23
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/repository/--sdk-addon-5.xsd410
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/repository/-sdk-repository-7.xsd601
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/repository/PkgProps.java12
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/repository/SdkRepoConstants.java14
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-addon-4.xsd3
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository-6.xsd2
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/archives/ArchiveInstallerTest.java2
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockExtraPackage.java5
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockPlatformToolPackage.java34
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockSystemImagePackage.java8
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockToolPackage.java42
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/PlatformPackageTest.java2
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/PreviewVersionTest.java107
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/SourcePackageTest.java2
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/SystemImagePackageTest.java2
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/sources/SdkRepoSourceTest.java151
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/repository/ValidateRepositoryXmlTest.java26
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/testdata/repository_sample_4.xml2
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/testdata/repository_sample_5.xml2
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/testdata/repository_sample_6.xml2
-rwxr-xr-xsdkmanager/libs/sdklib/tests/src/com/android/sdklib/testdata/repository_sample_7.xml331
-rwxr-xr-xsdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SdkUpdaterChooserDialog.java9
-rwxr-xr-xsdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SdkUpdaterLogic.java42
-rwxr-xr-xsdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/AdtUpdateDialog.java8
-rwxr-xr-xsdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PackagesDiffLogic.java10
-rwxr-xr-xsdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PackagesPage.java2
-rwxr-xr-xsdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PkgItem.java14
41 files changed, 2236 insertions, 126 deletions
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/AddonPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/AddonPackage.java
index cc35e54..9a86952 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/AddonPackage.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/AddonPackage.java
@@ -47,7 +47,8 @@ import java.util.Properties;
* Represents an add-on XML node in an SDK repository.
*/
public class AddonPackage extends Package
- implements IPackageVersion, IPlatformDependency, IExactApiLevelDependency, ILayoutlibVersion {
+ implements IAndroidVersionProvider, IPlatformDependency,
+ IExactApiLevelDependency, ILayoutlibVersion {
private final String mVendorId;
private final String mVendorDisplay;
@@ -428,8 +429,8 @@ public class AddonPackage extends Package
* <p/>
* An add-on has the same {@link AndroidVersion} as the platform it depends on.
*/
- @Override
- public @NonNull AndroidVersion getVersion() {
+ @Override @NonNull
+ public AndroidVersion getAndroidVersion() {
return mVersion;
}
@@ -601,7 +602,7 @@ public class AddonPackage extends Package
// check they are the same add-on.
if (getNameId().equals(newPkg.getNameId()) &&
- getVersion().equals(newPkg.getVersion())) {
+ getAndroidVersion().equals(newPkg.getAndroidVersion())) {
// Check the vendor-id field.
if (getVendorId().equals(newPkg.getVendorId())) {
return true;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/DocPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/DocPackage.java
index 54dfc5e..635dff9 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/DocPackage.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/DocPackage.java
@@ -16,6 +16,7 @@
package com.android.sdklib.internal.repository.packages;
+import com.android.annotations.NonNull;
import com.android.sdklib.AndroidVersion;
import com.android.sdklib.SdkConstants;
import com.android.sdklib.SdkManager;
@@ -35,11 +36,11 @@ import java.util.Properties;
/**
* Represents a doc XML node in an SDK repository.
* <p/>
- * Note that a doc package has a version and thus implements {@link IPackageVersion}.
+ * Note that a doc package has a version and thus implements {@link IAndroidVersionProvider}.
* However there is no mandatory dependency that limits installation so this does not
* implement {@link IPlatformDependency}.
*/
-public class DocPackage extends Package implements IPackageVersion {
+public class DocPackage extends Package implements IAndroidVersionProvider {
private final AndroidVersion mVersion;
@@ -53,7 +54,10 @@ public class DocPackage extends Package implements IPackageVersion {
* parameters that vary according to the originating XML schema.
* @param licenses The licenses loaded from the XML originating document.
*/
- public DocPackage(SdkSource source, Node packageNode, String nsUri, Map<String,String> licenses) {
+ public DocPackage(SdkSource source,
+ Node packageNode,
+ String nsUri,
+ Map<String,String> licenses) {
super(source, packageNode, nsUri, licenses);
int apiLevel = XmlParserUtils.getXmlInt (packageNode, SdkRepoConstants.NODE_API_LEVEL, 0);
@@ -124,8 +128,8 @@ public class DocPackage extends Package implements IPackageVersion {
* Returns the version, for platform, add-on and doc packages.
* Can be 0 if this is a local package of unknown api-level.
*/
- @Override
- public AndroidVersion getVersion() {
+ @Override @NonNull
+ public AndroidVersion getAndroidVersion() {
return mVersion;
}
@@ -220,8 +224,8 @@ public class DocPackage extends Package implements IPackageVersion {
@Override
public boolean sameItemAs(Package pkg) {
if (pkg instanceof DocPackage) {
- AndroidVersion rev2 = ((DocPackage) pkg).getVersion();
- return this.getVersion().equals(rev2);
+ AndroidVersion rev2 = ((DocPackage) pkg).getAndroidVersion();
+ return this.getAndroidVersion().equals(rev2);
}
return false;
@@ -248,7 +252,7 @@ public class DocPackage extends Package implements IPackageVersion {
DocPackage replacementDoc = (DocPackage)replacementPackage;
- AndroidVersion replacementVersion = replacementDoc.getVersion();
+ AndroidVersion replacementVersion = replacementDoc.getAndroidVersion();
// Check if they're the same exact (api and codename)
if (replacementVersion.equals(mVersion)) {
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/IPackageVersion.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/IAndroidVersionProvider.java
index 77a6a1d..e3ab5bd 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/IPackageVersion.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/IAndroidVersionProvider.java
@@ -16,6 +16,7 @@
package com.android.sdklib.internal.repository.packages;
+import com.android.annotations.NonNull;
import com.android.sdklib.AndroidVersion;
/**
@@ -26,11 +27,11 @@ import com.android.sdklib.AndroidVersion;
* requested platform is present, whereas this interface denotes that the given package simply
* has a version, which is not necessarily a dependency.
*/
-public interface IPackageVersion {
+public interface IAndroidVersionProvider {
/**
- * Returns the version, for platform, add-on and doc packages.
+ * Returns the android version, for platform, add-on and doc packages.
* Can be 0 if this is a local package of unknown api-level.
*/
- public abstract AndroidVersion getVersion();
+ public abstract @NonNull AndroidVersion getAndroidVersion();
}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/IPlatformDependency.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/IPlatformDependency.java
index a61fbea..9665528 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/IPlatformDependency.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/IPlatformDependency.java
@@ -25,13 +25,13 @@ import com.android.sdklib.AndroidVersion;
* A package that has this dependency can only be installed if a platform with at least the
* requested API level is present or installed at the same time.
* <p/>
- * Note that although this interface looks like {@link IPackageVersion}, it does not convey
- * the same semantic, that is {@link IPackageVersion} does <em>not</em> imply any dependency being
- * a limiting factor as far as installation is concerned.
+ * Note that although this interface looks like {@link IAndroidVersionProvider}, it does
+ * not convey the same semantic since {@link IAndroidVersionProvider} does <em>not</em>
+ * imply any dependency being a limiting factor as far as installation is concerned.
*/
public interface IPlatformDependency {
/** Returns the version of the platform dependency of this package. */
- AndroidVersion getVersion();
+ AndroidVersion getAndroidVersion();
}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/IPreviewVersionProvider.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/IPreviewVersionProvider.java
new file mode 100755
index 0000000..5a9f8a0
--- /dev/null
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/IPreviewVersionProvider.java
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+package com.android.sdklib.internal.repository.packages;
+
+import com.android.annotations.NonNull;
+
+
+/**
+ * Interface for packages that provide a {@link PreviewVersion},
+ * which is a multi-part revision number (major.minor.micro) and an optional preview revision.
+ */
+public interface IPreviewVersionProvider {
+
+ /**
+ * Returns a {@link PreviewVersion} for this package. Never null.
+ */
+ public abstract @NonNull PreviewVersion getPreviewVersion();
+}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/Package.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/Package.java
index 0e2b615..6760747 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/Package.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/Package.java
@@ -730,10 +730,10 @@ public abstract class Package implements IDescription, Comparable<Package> {
// We insert the package version here because it is more important
// than the revision number. We want package version to be sorted
// top-down, so we'll use 10k-api as the sorting key. The day we
- // get reach 10k APIs, we'll need to revisit this.
+ // reach 10k APIs, we'll need to revisit this.
sb.append("|v:"); //$NON-NLS-1$
- if (this instanceof IPackageVersion) {
- AndroidVersion v = ((IPackageVersion) this).getVersion();
+ if (this instanceof IAndroidVersionProvider) {
+ AndroidVersion v = ((IAndroidVersionProvider) this).getAndroidVersion();
sb.append(String.format("%1$04d.%2$d", //$NON-NLS-1$
10000 - v.getApiLevel(),
@@ -743,7 +743,11 @@ public abstract class Package implements IDescription, Comparable<Package> {
// Append revision number
sb.append("|r:"); //$NON-NLS-1$
- sb.append(String.format("%1$04d", getRevision())); //$NON-NLS-1$
+ if (this instanceof IPreviewVersionProvider) {
+ sb.append(String.format("%1$s", ((IPreviewVersionProvider) this).getPreviewVersion()));
+ } else {
+ sb.append(String.format("%1$04d", getRevision())); //$NON-NLS-1$
+ }
sb.append('|');
return sb.toString();
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PlatformPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PlatformPackage.java
index 391c32e..2f75610 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PlatformPackage.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PlatformPackage.java
@@ -16,6 +16,7 @@
package com.android.sdklib.internal.repository.packages;
+import com.android.annotations.NonNull;
import com.android.annotations.VisibleForTesting;
import com.android.annotations.VisibleForTesting.Visibility;
import com.android.sdklib.AndroidVersion;
@@ -40,7 +41,8 @@ import java.util.Properties;
/**
* Represents a platform XML node in an SDK repository.
*/
-public class PlatformPackage extends MinToolsPackage implements IPackageVersion, ILayoutlibVersion {
+public class PlatformPackage extends MinToolsPackage
+ implements IAndroidVersionProvider, ILayoutlibVersion {
/** The package version, for platform, add-on and doc packages. */
private final AndroidVersion mVersion;
@@ -145,8 +147,8 @@ public class PlatformPackage extends MinToolsPackage implements IPackageVersion,
}
/** Returns the package version, for platform, add-on and doc packages. */
- @Override
- public AndroidVersion getVersion() {
+ @Override @NonNull
+ public AndroidVersion getAndroidVersion() {
return mVersion;
}
@@ -279,7 +281,7 @@ public class PlatformPackage extends MinToolsPackage implements IPackageVersion,
File platforms = new File(osSdkRoot, SdkConstants.FD_PLATFORMS);
File folder = new File(platforms,
- String.format("android-%s", getVersion().getApiString())); //$NON-NLS-1$
+ String.format("android-%s", getAndroidVersion().getApiString())); //$NON-NLS-1$
return folder;
}
@@ -290,7 +292,7 @@ public class PlatformPackage extends MinToolsPackage implements IPackageVersion,
PlatformPackage newPkg = (PlatformPackage)pkg;
// check they are the same version.
- return newPkg.getVersion().equals(this.getVersion());
+ return newPkg.getAndroidVersion().equals(this.getAndroidVersion());
}
return false;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PlatformToolPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PlatformToolPackage.java
index 6070593..2566ce3 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PlatformToolPackage.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PlatformToolPackage.java
@@ -39,7 +39,7 @@ import java.util.Set;
/**
* Represents a platform-tool XML node in an SDK repository.
*/
-public class PlatformToolPackage extends Package {
+public class PlatformToolPackage extends PreviewVersionPackage {
/** The value returned by {@link PlatformToolPackage#installId()}. */
public static final String INSTALL_ID = "platform-tools"; //$NON-NLS-1$
@@ -178,8 +178,8 @@ public class PlatformToolPackage extends Package {
*/
@Override
public String getShortDescription() {
- return String.format("Android SDK Platform-tools, revision %1$d%2$s",
- getRevision(),
+ return String.format("Android SDK Platform-tools, revision %1$s%2$s",
+ getPreviewVersion().toShortString(),
isObsolete() ? " (Obsolete)" : "");
}
@@ -192,8 +192,8 @@ public class PlatformToolPackage extends Package {
}
if (s.indexOf("revision") == -1) {
- s += String.format("\nRevision %1$d%2$s",
- getRevision(),
+ s += String.format("\nRevision %1$s%2$s",
+ getPreviewVersion().toShortString(),
isObsolete() ? " (Obsolete)" : "");
}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PreviewVersion.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PreviewVersion.java
new file mode 100755
index 0000000..a75eb4b
--- /dev/null
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PreviewVersion.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+package com.android.sdklib.internal.repository.packages;
+
+
+/**
+ * Package multi-part revision number composed of a tuple
+ * (major.minor.micro) and an optional preview revision
+ * (the lack of a preview number indicates it's not a preview
+ * but a final package.)
+ */
+public class PreviewVersion implements Comparable<PreviewVersion> {
+
+ public static final int IMPLICIT_MINOR_REV = 0;
+ public static final int IMPLICIT_MICRO_REV = 0;
+ public static final int NOT_A_PREVIEW = 0;
+
+ private final int mMajor;
+ private final int mMinor;
+ private final int mMicro;
+ private final int mPreview;
+
+ public PreviewVersion(int major) {
+ this(major, 0, 0);
+ }
+
+ public PreviewVersion(int major, int minor, int micro) {
+ this(major, minor, micro, NOT_A_PREVIEW);
+ }
+
+ public PreviewVersion(int major, int minor, int micro, int preview) {
+ mMajor = major;
+ mMinor = minor;
+ mMicro = micro;
+ mPreview = preview;
+ }
+
+ public int getMajor() {
+ return mMajor;
+ }
+
+ public int getMinor() {
+ return mMinor;
+ }
+
+ public int getMicro() {
+ return mMicro;
+ }
+
+ public boolean isPreview() {
+ return mPreview > NOT_A_PREVIEW;
+ }
+
+ public int getPreview() {
+ return mPreview;
+ }
+
+ /**
+ * Returns the version in a fixed format major.minor.micro
+ * with an optional "rc preview#". For example it would
+ * return "18.0.0", "18.1.0" or "18.1.2 rc5".
+ */
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(mMajor)
+ .append('.').append(mMinor)
+ .append('.').append(mMicro);
+
+ if (mPreview != NOT_A_PREVIEW) {
+ sb.append(" rc").append(mPreview);
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * Returns the version in a dynamic format "major.minor.micro rc#".
+ * This is similar to {@link #toString()} except it omits minor, micro
+ * or preview versions when they are zero.
+ * For example it would return "18 rc1" instead of "18.0.0 rc1",
+ * or "18.1 rc2" instead of "18.1.0 rc2".
+ */
+ public String toShortString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(mMajor);
+ if (mMinor > 0 || mMicro > 0) {
+ sb.append('.').append(mMinor);
+ }
+ if (mMicro > 0) {
+ sb.append('.').append(mMicro);
+ }
+ if (mPreview != NOT_A_PREVIEW) {
+ sb.append(" rc").append(mPreview);
+ }
+
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + mMajor;
+ result = prime * result + mMinor;
+ result = prime * result + mMicro;
+ result = prime * result + mPreview;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object rhs) {
+ if (this == rhs) {
+ return true;
+ }
+ if (rhs == null) {
+ return false;
+ }
+ if (!(rhs instanceof PreviewVersion)) {
+ return false;
+ }
+ PreviewVersion other = (PreviewVersion) rhs;
+ if (mMajor != other.mMajor) {
+ return false;
+ }
+ if (mMinor != other.mMinor) {
+ return false;
+ }
+ if (mMicro != other.mMicro) {
+ return false;
+ }
+ if (mPreview != other.mPreview) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Trivial comparision of a version, e.g 17.1.2 < 18.0.0.
+ *
+ * Note that preview/release candidate are released before their final version,
+ * so "18.0.0 rc1" comes below "18.0.0". The best way to think of it as if the
+ * lack of preview number was "+inf":
+ * "18.1.2 rc5" => "18.1.2.5" so its less than "18.1.2.+INF" but more than "18.1.1.0"
+ * and more than "18.1.2.4"
+ */
+ @Override
+ public int compareTo(PreviewVersion rhs) {
+ int delta = mMajor - rhs.mMajor;
+ if (delta != 0) {
+ return delta;
+ }
+
+ delta = mMinor - rhs.mMinor;
+ if (delta != 0) {
+ return delta;
+ }
+
+ delta = mMicro - rhs.mMicro;
+ if (delta != 0) {
+ return delta;
+ }
+
+ int p1 = mPreview == NOT_A_PREVIEW ? Integer.MAX_VALUE : mPreview;
+ int p2 = rhs.mPreview == NOT_A_PREVIEW ? Integer.MAX_VALUE : rhs.mPreview;
+ delta = p1 - p2;
+ return delta;
+ }
+
+
+}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PreviewVersionPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PreviewVersionPackage.java
new file mode 100755
index 0000000..eac548e
--- /dev/null
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/PreviewVersionPackage.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+package com.android.sdklib.internal.repository.packages;
+
+import com.android.annotations.NonNull;
+import com.android.sdklib.internal.repository.XmlParserUtils;
+import com.android.sdklib.internal.repository.archives.Archive.Arch;
+import com.android.sdklib.internal.repository.archives.Archive.Os;
+import com.android.sdklib.internal.repository.sources.SdkSource;
+import com.android.sdklib.repository.PkgProps;
+import com.android.sdklib.repository.SdkRepoConstants;
+
+import org.w3c.dom.Node;
+
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Represents a package in an SDK repository that has a {@link PreviewVersion},
+ * which is a multi-part revision number (major.minor.micro) and an optional preview revision.
+ */
+public abstract class PreviewVersionPackage extends Package
+ implements IPreviewVersionProvider {
+
+ private final PreviewVersion mPreviewVersion;
+
+ /**
+ * Creates a new package from the attributes and elements of the given XML node.
+ * This constructor should throw an exception if the package cannot be created.
+ *
+ * @param source The {@link SdkSource} where this is loaded from.
+ * @param packageNode The XML element being parsed.
+ * @param nsUri The namespace URI of the originating XML document, to be able to deal with
+ * parameters that vary according to the originating XML schema.
+ * @param licenses The licenses loaded from the XML originating document.
+ */
+ PreviewVersionPackage(SdkSource source,
+ Node packageNode,
+ String nsUri,
+ Map<String,String> licenses) {
+ super(source, packageNode, nsUri, licenses);
+
+ // The major revision is getRevision(), already handled by Package.
+
+ int minorRevision = XmlParserUtils.getXmlInt(packageNode,
+ SdkRepoConstants.NODE_MINOR_REV,
+ PreviewVersion.IMPLICIT_MINOR_REV);
+ int microRevision = XmlParserUtils.getXmlInt(packageNode,
+ SdkRepoConstants.NODE_MICRO_REV,
+ PreviewVersion.IMPLICIT_MICRO_REV);
+ int preview = XmlParserUtils.getXmlInt(packageNode,
+ SdkRepoConstants.NODE_PREVIEW,
+ PreviewVersion.NOT_A_PREVIEW);
+
+ mPreviewVersion = new PreviewVersion(getRevision(), minorRevision, microRevision, preview);
+ }
+
+ /**
+ * Manually create a new package with one archive and the given attributes.
+ * This is used to create packages from local directories in which case there must be
+ * one archive which URL is the actual target location.
+ * <p/>
+ * Properties from props are used first when possible, e.g. if props is non null.
+ * <p/>
+ * By design, this creates a package with one and only one archive.
+ */
+ public PreviewVersionPackage(
+ SdkSource source,
+ Properties props,
+ int revision,
+ String license,
+ String description,
+ String descUrl,
+ Os archiveOs,
+ Arch archiveArch,
+ String archiveOsPath) {
+ super(source, props, revision, license, description, descUrl,
+ archiveOs, archiveArch, archiveOsPath);
+
+ // The major revision is getRevision(), already handled by Package.
+
+ int minorRevision = Integer.parseInt(
+ getProperty(props,
+ PkgProps.PKG_MINOR_REV,
+ Integer.toString(PreviewVersion.IMPLICIT_MINOR_REV)));
+ int microRevision = Integer.parseInt(
+ getProperty(props,
+ PkgProps.PKG_MICRO_REV,
+ Integer.toString(PreviewVersion.IMPLICIT_MINOR_REV)));
+ int preview = Integer.parseInt(
+ getProperty(props,
+ PkgProps.PKG_PREVIEW_REV,
+ Integer.toString(PreviewVersion.NOT_A_PREVIEW)));
+
+ mPreviewVersion = new PreviewVersion(getRevision(), minorRevision, microRevision, preview);
+ }
+
+ @Override @NonNull
+ public PreviewVersion getPreviewVersion() {
+ return mPreviewVersion;
+ }
+
+ @Override
+ public void saveProperties(Properties props) {
+ super.saveProperties(props);
+
+ // The major revision is getRevision(), already handled by Package.
+ assert mPreviewVersion.getMajor() == getRevision();
+
+ props.setProperty(PkgProps.PKG_MINOR_REV, Integer.toString(mPreviewVersion.getMinor()));
+ props.setProperty(PkgProps.PKG_MICRO_REV, Integer.toString(mPreviewVersion.getMicro()));
+ props.setProperty(PkgProps.PKG_PREVIEW_REV, Integer.toString(mPreviewVersion.getPreview()));
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((mPreviewVersion == null) ? 0 : mPreviewVersion.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof PreviewVersionPackage)) {
+ return false;
+ }
+ PreviewVersionPackage other = (PreviewVersionPackage) obj;
+ if (mPreviewVersion == null) {
+ if (other.mPreviewVersion != null) {
+ return false;
+ }
+ } else if (!mPreviewVersion.equals(other.mPreviewVersion)) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SamplePackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SamplePackage.java
index ed5eda5..e95c12e 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SamplePackage.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SamplePackage.java
@@ -16,6 +16,7 @@
package com.android.sdklib.internal.repository.packages;
+import com.android.annotations.NonNull;
import com.android.sdklib.AndroidVersion;
import com.android.sdklib.AndroidVersion.AndroidVersionException;
import com.android.sdklib.IAndroidTarget;
@@ -49,7 +50,7 @@ import java.util.Properties;
* Represents a sample XML node in an SDK repository.
*/
public class SamplePackage extends MinToolsPackage
- implements IPackageVersion, IMinApiLevelDependency {
+ implements IAndroidVersionProvider, IMinApiLevelDependency {
/** The matching platform version. */
private final AndroidVersion mVersion;
@@ -70,7 +71,10 @@ public class SamplePackage extends MinToolsPackage
* parameters that vary according to the originating XML schema.
* @param licenses The licenses loaded from the XML originating document.
*/
- public SamplePackage(SdkSource source, Node packageNode, String nsUri, Map<String,String> licenses) {
+ public SamplePackage(SdkSource source,
+ Node packageNode,
+ String nsUri,
+ Map<String,String> licenses) {
super(source, packageNode, nsUri, licenses);
int apiLevel = XmlParserUtils.getXmlInt (packageNode, SdkRepoConstants.NODE_API_LEVEL, 0);
@@ -133,7 +137,8 @@ public class SamplePackage extends MinToolsPackage
* @throws AndroidVersionException if the {@link AndroidVersion} can't be restored
* from properties.
*/
- public static Package create(String archiveOsPath, Properties props) throws AndroidVersionException {
+ public static Package create(String archiveOsPath, Properties props)
+ throws AndroidVersionException {
return new SamplePackage(archiveOsPath, props);
}
@@ -182,8 +187,8 @@ public class SamplePackage extends MinToolsPackage
}
/** Returns the matching platform version. */
- @Override
- public AndroidVersion getVersion() {
+ @Override @NonNull
+ public AndroidVersion getAndroidVersion() {
return mVersion;
}
@@ -284,12 +289,12 @@ public class SamplePackage extends MinToolsPackage
// Otherwise, get a suitable default
File folder = new File(samplesRoot,
- String.format("android-%s", getVersion().getApiString())); //$NON-NLS-1$
+ String.format("android-%s", getAndroidVersion().getApiString())); //$NON-NLS-1$
for (int n = 1; folder.exists(); n++) {
// Keep trying till we find an unused directory.
folder = new File(samplesRoot,
- String.format("android-%s_%d", getVersion().getApiString(), n)); //$NON-NLS-1$
+ String.format("android-%s_%d", getAndroidVersion().getApiString(), n)); //$NON-NLS-1$
}
return folder;
@@ -301,7 +306,7 @@ public class SamplePackage extends MinToolsPackage
SamplePackage newPkg = (SamplePackage)pkg;
// check they are the same version.
- return newPkg.getVersion().equals(this.getVersion());
+ return newPkg.getAndroidVersion().equals(this.getAndroidVersion());
}
return false;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SourcePackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SourcePackage.java
index 2c577e4..cf280f8 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SourcePackage.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SourcePackage.java
@@ -16,6 +16,7 @@
package com.android.sdklib.internal.repository.packages;
+import com.android.annotations.NonNull;
import com.android.annotations.VisibleForTesting;
import com.android.annotations.VisibleForTesting.Visibility;
import com.android.sdklib.AndroidVersion;
@@ -42,11 +43,11 @@ import java.util.Properties;
/**
* Represents a source XML node in an SDK repository.
* <p/>
- * Note that a source package has a version and thus implements {@link IPackageVersion}.
+ * Note that a source package has a version and thus implements {@link IAndroidVersionProvider}.
* However there is no mandatory dependency that limits installation so this does not
* implement {@link IPlatformDependency}.
*/
-public class SourcePackage extends Package implements IPackageVersion {
+public class SourcePackage extends Package implements IAndroidVersionProvider {
/** The package version, for platform, add-on and doc packages. */
private final AndroidVersion mVersion;
@@ -184,8 +185,8 @@ public class SourcePackage extends Package implements IPackageVersion {
/**
* Returns the android version of this package.
*/
- @Override
- public AndroidVersion getVersion() {
+ @Override @NonNull
+ public AndroidVersion getAndroidVersion() {
return mVersion;
}
@@ -300,7 +301,7 @@ public class SourcePackage extends Package implements IPackageVersion {
SourcePackage newPkg = (SourcePackage)pkg;
// check they are the same version.
- return getVersion().equals(newPkg.getVersion());
+ return getAndroidVersion().equals(newPkg.getAndroidVersion());
}
return false;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SystemImagePackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SystemImagePackage.java
index c862882..e1e441c 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SystemImagePackage.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/SystemImagePackage.java
@@ -16,6 +16,7 @@
package com.android.sdklib.internal.repository.packages;
+import com.android.annotations.NonNull;
import com.android.annotations.VisibleForTesting;
import com.android.annotations.VisibleForTesting.Visibility;
import com.android.sdklib.AndroidVersion;
@@ -42,7 +43,7 @@ import java.util.Properties;
* Represents a system-image XML node in an SDK repository.
*/
public class SystemImagePackage extends Package
- implements IPackageVersion, IPlatformDependency {
+ implements IAndroidVersionProvider, IPlatformDependency {
/** The package version, for platform, add-on and doc packages. */
private final AndroidVersion mVersion;
@@ -217,8 +218,8 @@ public class SystemImagePackage extends Package
* <p/>
* A system-image has the same {@link AndroidVersion} as the platform it depends on.
*/
- @Override
- public AndroidVersion getVersion() {
+ @Override @NonNull
+ public AndroidVersion getAndroidVersion() {
return mVersion;
}
@@ -314,7 +315,7 @@ public class SystemImagePackage extends Package
// check they are the same abi and version.
return getAbi().equals(newPkg.getAbi()) &&
- getVersion().equals(newPkg.getVersion());
+ getAndroidVersion().equals(newPkg.getAndroidVersion());
}
return false;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/ToolPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/ToolPackage.java
index e4a8fe6..763ed43 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/ToolPackage.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/packages/ToolPackage.java
@@ -27,6 +27,7 @@ import com.android.sdklib.internal.repository.archives.Archive;
import com.android.sdklib.internal.repository.archives.Archive.Arch;
import com.android.sdklib.internal.repository.archives.Archive.Os;
import com.android.sdklib.internal.repository.sources.SdkSource;
+import com.android.sdklib.repository.PkgProps;
import com.android.sdklib.repository.SdkRepoConstants;
import com.android.sdklib.util.GrabProcessOutput;
import com.android.sdklib.util.GrabProcessOutput.IProcessOutput;
@@ -43,14 +44,11 @@ import java.util.regex.Pattern;
/**
* Represents a tool XML node in an SDK repository.
*/
-public class ToolPackage extends Package implements IMinPlatformToolsDependency {
+public class ToolPackage extends PreviewVersionPackage implements IMinPlatformToolsDependency {
/** The value returned by {@link ToolPackage#installId()}. */
public static final String INSTALL_ID = "tools"; //$NON-NLS-1$
- public static final String PROP_MIN_PLATFORM_TOOLS_REV =
- "Platform.MinPlatformToolsRev"; //$NON-NLS-1$
-
/**
* The minimal revision of the platform-tools package required by this package
* or {@link #MIN_PLATFORM_TOOLS_REV_INVALID} if the value was missing.
@@ -67,7 +65,10 @@ public class ToolPackage extends Package implements IMinPlatformToolsDependency
* parameters that vary according to the originating XML schema.
* @param licenses The licenses loaded from the XML originating document.
*/
- public ToolPackage(SdkSource source, Node packageNode, String nsUri, Map<String,String> licenses) {
+ public ToolPackage(SdkSource source,
+ Node packageNode,
+ String nsUri,
+ Map<String,String> licenses) {
super(source, packageNode, nsUri, licenses);
mMinPlatformToolsRevision = XmlParserUtils.getXmlInt(
@@ -145,7 +146,7 @@ public class ToolPackage extends Package implements IMinPlatformToolsDependency
mMinPlatformToolsRevision = Integer.parseInt(
getProperty(
props,
- PROP_MIN_PLATFORM_TOOLS_REV,
+ PkgProps.MIN_PLATFORM_TOOLS_REV,
Integer.toString(MIN_PLATFORM_TOOLS_REV_INVALID)));
}
@@ -187,8 +188,8 @@ public class ToolPackage extends Package implements IMinPlatformToolsDependency
*/
@Override
public String getShortDescription() {
- return String.format("Android SDK Tools, revision %1$d%2$s",
- getRevision(),
+ return String.format("Android SDK Tools, revision %1$s%2$s",
+ getPreviewVersion().toShortString(),
isObsolete() ? " (Obsolete)" : "");
}
@@ -201,8 +202,8 @@ public class ToolPackage extends Package implements IMinPlatformToolsDependency
}
if (s.indexOf("revision") == -1) {
- s += String.format("\nRevision %1$d%2$s",
- getRevision(),
+ s += String.format("\nRevision %1$s%2$s",
+ getPreviewVersion().toShortString(),
isObsolete() ? " (Obsolete)" : "");
}
@@ -235,7 +236,7 @@ public class ToolPackage extends Package implements IMinPlatformToolsDependency
super.saveProperties(props);
if (getMinPlatformToolsRevision() != MIN_PLATFORM_TOOLS_REV_INVALID) {
- props.setProperty(PROP_MIN_PLATFORM_TOOLS_REV,
+ props.setProperty(PkgProps.MIN_PLATFORM_TOOLS_REV,
Integer.toString(getMinPlatformToolsRevision()));
}
}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/--sdk-addon-5.xsd b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/--sdk-addon-5.xsd
new file mode 100755
index 0000000..180a885
--- /dev/null
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/--sdk-addon-5.xsd
@@ -0,0 +1,410 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (C) 2011 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/addon/4"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdk="http://schemas.android.com/sdk/android/addon/4"
+ 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 Addon repository is a web site that contains an "addon.xml"
+ file that conforms to this XML Schema.
+
+ History:
+ - v1 is used by the SDK Updater in Tools r8. It is split out of the
+ main SDK Repository XML Schema and can only contain <addon> and
+ <extra> packages.
+
+ - v2 is used by the SDK Updater in Tools r12.
+ - <extra> element now has a <project-files> element that contains 1 or
+ or more <path>, each indicating the relative path of a file that this package
+ can contribute to installed projects.
+ - <addon> element now has an optional <layoutlib> that indicates the API
+ and revision of the layout library for this particular add-on, if any.
+
+ - v3 is used by the SDK Manager in Tools r14:
+ - <extra> now has an <old-paths> element, a ;-separated list of old paths that
+ should be detected and migrated to the new <path> for that package.
+
+ - v4 is used by the SDK Manager in Tools r18:
+ - <extra> and <addon> are not in the Repository XSD v6 anymore.
+ - <extra> get a new field <name-display>, which is used by the SDK Manager to
+ customize the name of the extra in the list display. The single <vendor>
+ field becomes <vendor-id> and <vendor-display>, the id being used internally
+ and the display in the UI.
+ - <addon> does the same, where <name> is replaced by <name-id> and <name-display>
+ and <vendor> is replaced by <vendor-id> and <vendor-display>.
+
+ - v5 is not used yet:
+ - The <beta-rc> element is no longer supported. It was never implemented anyway.
+
+ -->
+
+ <xsd:element name="sdk-addon" type="sdk:repositoryType" />
+
+ <xsd:complexType name="repositoryType">
+ <xsd:annotation>
+ <xsd:documentation>
+ The repository contains a collection of downloadable packages.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="add-on" type="sdk:addonType" />
+ <xsd:element name="extra" type="sdk:extraType" />
+ <xsd:element name="license" type="sdk:licenseType" />
+ </xsd:choice>
+ </xsd:complexType>
+
+ <!-- The definition of an SDK Add-on package. -->
+
+ <xsd:complexType name="addonType">
+ <xsd:annotation>
+ <xsd:documentation>An SDK add-on package.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:all>
+ <!-- The internal name id of the add-on. Must be unique per vendor. -->
+ <xsd:element name="name-id" type="sdk:idType" />
+ <!-- The displayed name of the add-on. -->
+ <xsd:element name="name-display" type="xsd:normalizedString" />
+
+ <!-- The internal vendor id of the add-on. Must be unique amongst vendors. -->
+ <xsd:element name="vendor-id" type="sdk:idType" />
+ <!-- The displayed vendor name of the add-on. -->
+ <xsd:element name="vendor-display" type="xsd:normalizedString" />
+
+ <!-- The Android API Level for the add-on. An int > 0. -->
+ <xsd:element name="api-level" type="xsd:positiveInteger" />
+ <!-- Note: Add-ons do not support 'codenames' (a.k.a. API previews). -->
+ <!-- The revision, an int > 0, incremented each time a new
+ package is generated. -->
+ <xsd:element name="revision" type="xsd:positiveInteger" />
+
+ <!-- An add-on can declare 0 or more libraries.
+ This element is mandatory but it can be empty.
+ -->
+
+ <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>
+
+ <!-- optional elements -->
+
+ <!-- The optional license of this package. If present, users will have
+ to agree to it before downloading. -->
+ <xsd:element name="uses-license" type="sdk:usesLicenseType" 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 optional element indicating the package is obsolete.
+ The string content is however currently not defined and ignored. -->
+ <xsd:element name="obsolete" type="xsd:string" minOccurs="0" />
+
+ <!-- Optional information on the layoutlib packaged in this platform. -->
+ <xsd:element name="layoutlib" type="sdk:layoutlibType" minOccurs="0" />
+ </xsd:all>
+ </xsd:complexType>
+
+
+ <xsd:simpleType name="idType">
+ <xsd:annotation>
+ <xsd:documentation>
+ An ID string for an addon/extra name-id or vendor-id
+ can only be simple alphanumeric string.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:pattern value="[a-zA-Z0-9_-]+"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+
+ <!-- The definition of a layout library used by an addon. -->
+
+ <xsd:complexType name="layoutlibType" >
+ <xsd:annotation>
+ <xsd:documentation>
+ Version information for a layoutlib included in an addon.
+ .</xsd:documentation>
+ </xsd:annotation>
+ <xsd:all>
+ <!-- The layoutlib API level, an int > 0,
+ incremented with each new incompatible lib. -->
+ <xsd:element name="api" type="xsd:positiveInteger" />
+ <!-- The incremental minor revision for that API, e.g. in case of bug fixes.
+ Optional. An int >= 0, assumed to be 0 if the element is missing. -->
+ <xsd:element name="revision" type="xsd:nonNegativeInteger" minOccurs="0" />
+ </xsd:all>
+ </xsd:complexType>
+
+
+ <!-- The definition of an SDK extra package. This kind of package is for
+ "free" content. Such packages are installed in SDK/extras/vendor/path.
+ -->
+
+ <xsd:complexType name="extraType" >
+ <xsd:annotation>
+ <xsd:documentation>
+ An SDK extra package. This kind of package is for "free" content.
+ Such packages are installed in SDK/vendor/path.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:all>
+ <!-- The displayed name of the extra. -->
+ <xsd:element name="name-display" type="xsd:normalizedString" />
+
+ <!-- The internal vendor id of the extra. Must be unique amongst vendors. -->
+ <xsd:element name="vendor-id" type="sdk:idType" />
+ <!-- The displayed vendor name of the extra. -->
+ <xsd:element name="vendor-display" type="xsd:normalizedString" />
+
+ <!-- The install path sub-folder name. It must not be empty. -->
+ <xsd:element name="path" type="sdk:segmentType" />
+
+ <!-- A semi-colon separated list of "obsolete" path names which are equivalent
+ to the current 'path' name. When a package is seen using an old-paths' name,
+ the package manager will try to upgrade it to the new path. -->
+ <xsd:element name="old-paths" type="sdk:segmentListType" minOccurs="0" />
+
+ <!-- The revision, an int > 0, incremented each time a new
+ package is generated. -->
+ <xsd:element name="revision" type="xsd:positiveInteger" />
+
+ <!-- A list of file archives for this package. -->
+ <xsd:element name="archives" type="sdk:archivesType" />
+
+ <!-- optional elements -->
+
+ <!-- The optional license of this package. If present, users will have
+ to agree to it before downloading. -->
+ <xsd:element name="uses-license" type="sdk:usesLicenseType" 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" />
+ <!-- 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" />
+ <!-- The minimal API level required by this package.
+ Optional. If present, must be an int > 0. -->
+ <xsd:element name="min-api-level" type="xsd:positiveInteger" minOccurs="0" />
+
+ <!-- An optional element indicating the package is obsolete.
+ The string content is however currently not defined and ignored. -->
+ <xsd:element name="obsolete" type="xsd:string" minOccurs="0" />
+
+ <!-- A list of project files contributed by this package. Optional. -->
+ <xsd:element name="project-files" type="sdk:projectFilesType" minOccurs="0" />
+ </xsd:all>
+ </xsd:complexType>
+
+
+ <!-- The definition of a path segment used by the extra element. -->
+
+ <xsd:simpleType name="segmentType">
+ <xsd:annotation>
+ <xsd:documentation>
+ One path segment for the install path of an extra element.
+ It must be a single-segment path. It must not be empty.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:pattern value="[a-zA-Z0-9_]+"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="segmentListType">
+ <xsd:annotation>
+ <xsd:documentation>
+ A semi-colon separated list of a segmentTypes.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:pattern value="[a-zA-Z0-9_;]+"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+
+ <!-- The definition of a license to be referenced by the uses-license element. -->
+
+ <xsd:complexType name="licenseType">
+ <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: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>
+
+
+ <!-- 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="usesLicenseType">
+ <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 &lt;archives&gt; node is mandatory in the repository packages and the
+ collection must have at least one &lt;archive&gt; 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>
+
+
+ <!-- A collection of file paths available in an &lt;extra&gt; package
+ that can be installed in an Android project.
+ If present, the &lt;project-files&gt; collection must contain at least one path.
+ Each path is relative to the root directory of the package.
+ -->
+
+ <xsd:complexType name="projectFilesType">
+ <xsd:annotation>
+ <xsd:documentation>
+ A collection of file paths available in an &lt;extra&gt; package
+ that can be installed in an Android project.
+ If present, the &lt;project-files&gt; collection must contain at least one path.
+ Each path is relative to the root directory of the package.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence minOccurs="1" maxOccurs="unbounded">
+ <!-- One JAR Path, relative to the root folder of the package. -->
+ <xsd:element name="path" type="xsd:string" />
+ </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>
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/-sdk-repository-7.xsd b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/-sdk-repository-7.xsd
new file mode 100755
index 0000000..c1e5017
--- /dev/null
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/-sdk-repository-7.xsd
@@ -0,0 +1,601 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (C) 2012 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/7"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdk="http://schemas.android.com/sdk/android/repository/7"
+ 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.
+
+ History:
+ - v1 is used by the SDK Updater in Tools r3 and r4.
+
+ - v2 is used by the SDK Updater in Tools r5:
+ - It introduces a new <sample> repository type. Previously samples
+ were included in the <platform> packages. Instead this package is used
+ and and the samples are installed in $SDK/samples.
+ - All repository types have a new <obsolete> node. It works as a marker
+ to indicate the package is obsolete and should not be selected by default.
+ The UI also hides these out by default.
+
+ - v3 is used by the SDK Updater in Tools r8:
+ - It introduces a new <platform-tool> repository type. Previously platform-specific
+ tools were included in the <platform> packages. Instead this package is used
+ and platform-specific tools are installed in $SDK/platform-tools
+ - There's a new element <min-platform-tools-rev> in <tool>. The tool package now
+ requires that at least some minimal version of <platform-tool> be installed.
+ - It removes the <addon> repository type, which is now in its own XML Schema.
+
+ - v4 is used by the SDK Updater in Tools r12:
+ - <extra> element now has a <project-files> element that contains 1 or
+ or more <path>, each indicating the relative path of a file that this package
+ can contribute to installed projects.
+ - <platform> element now has a mandatory <layoutlib> that indicates the API
+ and revision of that layout library for this particular platform.
+
+ - v5 is used by the SDK Manager in Tools r14:
+ - <extra> now has an <old-paths> element, a ;-separated list of old paths that
+ should be detected and migrated to the new <path> for that package.
+ - <platform> has a new optional <abi-included> that describes the ABI of the
+ system image included in the platform, if any.
+ - New <system-image> package type, to store system images outside of <platform>s.
+ - New <source> package type.
+
+ - v6 is used by the SDK Manager in Tools r18:
+ - <extra> packages are removed. They are served only by the addon XML.
+ - <platform>, <system-image>, <source>, <tool>, <platform-tool>, <doc>
+ and <sample> get a new optional field <beta-rc> which can be used to indicate
+ the package is a Beta Release Candidate and not a final release.
+
+ - v7 is used by the SDK Manager in Tools r20:
+ - <tool> and <platform-tool> packages have new <minor-rev> and
+ <micro-rev> numbers.
+ - The <beta-rc> element is no longer supported, it is replaced by <preview>
+ which is only for <tool> and <platform-tool> packages.
+ -->
+
+ <xsd:element name="sdk-repository" type="sdk:repositoryType" />
+
+ <xsd:complexType name="repositoryType">
+ <xsd:annotation>
+ <xsd:documentation>
+ The repository contains a collection of downloadable packages.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="platform" type="sdk:platformType" />
+ <xsd:element name="system-image" type="sdk:systemImageType" />
+ <xsd:element name="source" type="sdk:sourceType" />
+ <xsd:element name="tool" type="sdk:toolType" />
+ <xsd:element name="platform-tool" type="sdk:platformToolType" />
+ <xsd:element name="doc" type="sdk:docType" />
+ <xsd:element name="sample" type="sdk:sampleType" />
+ <xsd:element name="license" type="sdk:licenseType" />
+ </xsd:choice>
+ </xsd:complexType>
+
+ <!-- The definition of an SDK platform package. -->
+
+ <xsd:complexType name="platformType">
+ <xsd:annotation>
+ <xsd:documentation>An SDK platform package.</xsd:documentation>
+ </xsd:annotation>
+ <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" />
+
+ <!-- Information on the layoutlib packaged in this platform. -->
+ <xsd:element name="layoutlib" type="sdk:layoutlibType" />
+
+ <!-- optional elements -->
+
+ <!-- The optional license of this package. If present, users will have
+ to agree to it before downloading. -->
+ <xsd:element name="uses-license" type="sdk:usesLicenseType" 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" />
+
+ <!-- The ABI of the system image *included* in this platform, if any.
+ When the field is present, it means the platform already embeds one
+ system image. A platform can also have any number of external
+ &lt;system-image&gt; associated with it. -->
+ <xsd:element name="included-abi" type="sdk:abiType" minOccurs="0" />
+
+ <!-- An optional element indicating the package is obsolete.
+ The string content is however currently not defined and ignored. -->
+ <xsd:element name="obsolete" type="xsd:string" minOccurs="0" />
+ </xsd:all>
+ </xsd:complexType>
+
+
+ <!-- The definition of a layout library used by a platform. -->
+
+ <xsd:complexType name="layoutlibType" >
+ <xsd:annotation>
+ <xsd:documentation>
+ Version information for a layoutlib included in a platform.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:all>
+ <!-- The layoutlib API level, an int > 0,
+ incremented with each new incompatible lib. -->
+ <xsd:element name="api" type="xsd:positiveInteger" />
+ <!-- The incremental minor revision for that API, e.g. in case of bug fixes.
+ Optional. An int >= 0, assumed to be 0 if the element is missing. -->
+ <xsd:element name="revision" type="xsd:nonNegativeInteger" minOccurs="0" />
+ </xsd:all>
+ </xsd:complexType>
+
+
+ <!-- The definition of a system image used by a platform. -->
+
+ <xsd:complexType name="systemImageType" >
+ <xsd:annotation>
+ <xsd:documentation>
+ System Image for a platform.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:all>
+ <!-- api-level + codename identifies the platform to which this system image belongs. -->
+
+ <!-- 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 ABI of the system emulated by this image. -->
+ <xsd:element name="abi" type="sdk:abiType" />
+
+ <!-- The optional license of this package. If present, users will have
+ to agree to it before downloading. -->
+ <xsd:element name="uses-license" type="sdk:usesLicenseType" 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 optional element indicating the package is obsolete.
+ The string content is however currently not defined and ignored. -->
+ <xsd:element name="obsolete" type="xsd:string" minOccurs="0" />
+ </xsd:all>
+ </xsd:complexType>
+
+ <!-- The definition of the ABI supported by a platform's system image. -->
+
+ <xsd:simpleType name="abiType">
+ <xsd:annotation>
+ <xsd:documentation>The ABI of a platform's system image.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="armeabi" />
+ <xsd:enumeration value="armeabi-v7a" />
+ <xsd:enumeration value="x86" />
+ <xsd:enumeration value="mips" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+
+ <!-- The definition of a source package. -->
+
+ <xsd:complexType name="sourceType" >
+ <xsd:annotation>
+ <xsd:documentation>
+ Sources for a platform.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:all>
+ <!-- api-level + codename identifies the platform to which this source belongs. -->
+
+ <!-- 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:usesLicenseType" 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 optional element indicating the package is obsolete.
+ The string content is however currently not defined and ignored. -->
+ <xsd:element name="obsolete" type="xsd:string" minOccurs="0" />
+ </xsd:all>
+ </xsd:complexType>
+
+
+ <!-- The definition of an SDK tool package. -->
+
+ <xsd:complexType name="toolType" >
+ <xsd:annotation>
+ <xsd:documentation>An SDK tool package.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:all>
+ <!-- The revision, an int > 0, incremented each time a new
+ package is generated. -->
+ <xsd:element name="revision" type="xsd:positiveInteger" />
+ <!-- The minor revision, an int >= 0, incremented each time a new
+ package is generated. Assumed to be 0 if missing. -->
+ <xsd:element name="minor-rev" type="xsd:nonNegativeInteger" minOccurs="0" />
+ <!-- The micro revision, an int >= 0, incremented each time a new
+ package is generated. Assumed to be 0 if missing. -->
+ <xsd:element name="micro-rev" type="xsd:nonNegativeInteger" minOccurs="0" />
+ <!-- The preview/release candidate revision, an int > 0,
+ incremented each time a new preview is generated.
+ Not present for final releases. -->
+ <xsd:element name="preview" type="xsd:positiveInteger" minOccurs="0" />
+
+ <!-- The optional license of this package. If present, users will have
+ to agree to it before downloading. -->
+ <xsd:element name="uses-license" type="sdk:usesLicenseType" 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 platform-tools required by this package.
+ Mandatory. Must be an int > 0. -->
+ <xsd:element name="min-platform-tools-rev" type="xsd:positiveInteger" />
+
+ <!-- An optional element indicating the package is obsolete.
+ The string content is however currently not defined and ignored. -->
+ <xsd:element name="obsolete" type="xsd:string" minOccurs="0" />
+ </xsd:all>
+ </xsd:complexType>
+
+
+ <!-- The definition of an SDK platform-tool package. -->
+
+ <xsd:complexType name="platformToolType" >
+ <xsd:annotation>
+ <xsd:documentation>An SDK platform-tool package.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:all>
+ <!-- The revision, an int > 0, incremented each time a new
+ package is generated. -->
+ <xsd:element name="revision" type="xsd:positiveInteger" />
+ <!-- The minor revision, an int >= 0, incremented each time a new
+ package is generated. Assumed to be 0 if missing. -->
+ <xsd:element name="minor-rev" type="xsd:nonNegativeInteger" minOccurs="0" />
+ <!-- The micro revision, an int >= 0, incremented each time a new
+ package is generated. Assumed to be 0 if missing. -->
+ <xsd:element name="micro-rev" type="xsd:nonNegativeInteger" minOccurs="0" />
+ <!-- The preview/release candidate revision, an int > 0,
+ incremented each time a new preview is generated.
+ Not present for final releases. -->
+ <xsd:element name="preview" type="xsd:positiveInteger" minOccurs="0" />
+
+ <!-- The optional license of this package. If present, users will have
+ to agree to it before downloading. -->
+ <xsd:element name="uses-license" type="sdk:usesLicenseType" 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 optional element indicating the package is obsolete.
+ The string content is however currently not defined and ignored. -->
+ <xsd:element name="obsolete" type="xsd:string" minOccurs="0" />
+ </xsd:all>
+ </xsd:complexType>
+
+
+ <!-- The definition of an SDK doc package. -->
+
+ <xsd:complexType name="docType" >
+ <xsd:annotation>
+ <xsd:documentation>An SDK doc package.</xsd:documentation>
+ </xsd:annotation>
+ <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:usesLicenseType" 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 optional element indicating the package is obsolete.
+ The string content is however currently not defined and ignored. -->
+ <xsd:element name="obsolete" type="xsd:string" minOccurs="0" />
+ </xsd:all>
+ </xsd:complexType>
+
+
+ <!-- The definition of an SDK sample package. -->
+
+ <xsd:complexType name="sampleType" >
+ <xsd:annotation>
+ <xsd:documentation>An SDK sample package.</xsd:documentation>
+ </xsd:annotation>
+ <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:usesLicenseType" 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" />
+
+
+ <!-- An optional element indicating the package is obsolete.
+ The string content is however currently not defined and ignored. -->
+ <xsd:element name="obsolete" type="xsd:string" minOccurs="0" />
+ </xsd:all>
+ </xsd:complexType>
+
+
+ <!-- The definition of a path segment used by the extra element. -->
+
+ <xsd:simpleType name="segmentType">
+ <xsd:annotation>
+ <xsd:documentation>
+ One path segment for the install path of an extra element.
+ It must be a single-segment path.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:pattern value="[a-zA-Z0-9_]+"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="segmentListType">
+ <xsd:annotation>
+ <xsd:documentation>
+ A semi-colon separated list of a segmentTypes.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:pattern value="[a-zA-Z0-9_;]+"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+
+ <!-- The definition of a license to be referenced by the uses-license element. -->
+
+ <xsd:complexType name="licenseType">
+ <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: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>
+
+
+ <!-- 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="usesLicenseType">
+ <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 &lt;archives&gt; node is mandatory in the repository packages and the
+ collection must have at least one &lt;archive&gt; 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>
+
+
+ <!-- A collection of file paths available in an &lt;extra&gt; package
+ that can be installed in an Android project.
+ If present, the &lt;project-files&gt; collection must contain at least one path.
+ Each path is relative to the root directory of the package.
+ -->
+
+ <xsd:complexType name="projectFilesType">
+ <xsd:annotation>
+ <xsd:documentation>
+ A collection of file paths available in an &lt;extra&gt; package
+ that can be installed in an Android project.
+ If present, the &lt;project-files&gt; collection must contain at least one path.
+ Each path is relative to the root directory of the package.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence minOccurs="1" maxOccurs="unbounded">
+ <!-- One JAR Path, relative to the root folder of the package. -->
+ <xsd:element name="path" type="xsd:string" />
+ </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>
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/PkgProps.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/PkgProps.java
index 579656a..a570153 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/PkgProps.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/PkgProps.java
@@ -44,6 +44,13 @@ public class PkgProps {
public static final String VERSION_API_LEVEL = "AndroidVersion.ApiLevel";//$NON-NLS-1$
public static final String VERSION_CODENAME = "AndroidVersion.CodeName";//$NON-NLS-1$
+ // PreviewVersion
+
+ public static final String PKG_MINOR_REV = "PreviewVersion.MinorRev";//$NON-NLS-1$
+ public static final String PKG_MICRO_REV = "PreviewVersion.MicroRev";//$NON-NLS-1$
+ public static final String PKG_PREVIEW_REV = "PreviewVersion.Preview"; //$NON-NLS-1$
+
+
// AddonPackage
public static final String ADDON_NAME = "Addon.Name"; //$NON-NLS-1$
@@ -81,7 +88,10 @@ public class PkgProps {
public static final String PLATFORM_VERSION = "Platform.Version"; //$NON-NLS-1$
public static final String PLATFORM_INCLUDED_ABI = "Platform.Included.Abi"; //$NON-NLS-1$
- // PlatformToolPackage
+ // ToolPackage
+
+ public static final String MIN_PLATFORM_TOOLS_REV = "Platform.MinPlatformToolsRev";//$NON-NLS-1$
+
// SamplePackage
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/SdkRepoConstants.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/SdkRepoConstants.java
index 258ea26..9f4077f 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/SdkRepoConstants.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/SdkRepoConstants.java
@@ -30,7 +30,7 @@ public class SdkRepoConstants extends RepoConstants {
* The latest version of the sdk-repository XML Schema.
* Valid version numbers are between 1 and this number, included.
*/
- public static final int NS_LATEST_VERSION = 6;
+ public static final int NS_LATEST_VERSION = 7;
/**
* The min version of the sdk-repository XML Schema we'll try to load.
@@ -80,6 +80,18 @@ public class SdkRepoConstants extends RepoConstants {
/** The root sdk-repository element */
public static final String NODE_SDK_REPOSITORY = "sdk-repository"; //$NON-NLS-1$
+ /* The minor revision for tool and platform-tool package
+ * (the full revision number is revision.minor.micro + preview#.)
+ * Optional int >= 0. Implied to be 0 when missing. */
+ public static final String NODE_MINOR_REV = "minor-rev"; //$NON-NLS-1$
+ /* The micro revision for tool and platform-tool package
+ * (the full revision number is revision.minor.micro + preview#.)
+ * Optional int >= 0. Implied to be 0 when missing. */
+ public static final String NODE_MICRO_REV = "micro-rev"; //$NON-NLS-1$
+ /* The preview revision for tool and platform-tool package.
+ * Int > 0, only present for "preview / release candidate" packages. */
+ public static final String NODE_PREVIEW = "preview"; //$NON-NLS-1$
+
/** A platform package. */
public static final String NODE_PLATFORM = "platform"; //$NON-NLS-1$
/** A tool package. */
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-addon-4.xsd b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-addon-4.xsd
index 564aaeb..c31efbf 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-addon-4.xsd
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-addon-4.xsd
@@ -137,7 +137,8 @@
<!-- An optional element indicating the package is a beta/preview.
When present, it indicates the release-candidate number.
- When the element is absent, it indicates this is a released package. -->
+ When the element is absent, it indicates this is a released package.
+ DEPRECATED. TODO remove in sdk-addon-5. -->
<xsd:element name="beta-rc" type="xsd:positiveInteger" minOccurs="0" />
<!-- Optional information on the layoutlib packaged in this platform. -->
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository-6.xsd b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository-6.xsd
index 87e183a..bccce69 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository-6.xsd
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository-6.xsd
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2012 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.
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/archives/ArchiveInstallerTest.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/archives/ArchiveInstallerTest.java
index 3f70d79..7f1b99a 100755
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/archives/ArchiveInstallerTest.java
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/archives/ArchiveInstallerTest.java
@@ -366,7 +366,7 @@ public class ArchiveInstallerTest extends TestCase {
int min_platform_tools_rev) {
Properties props = new Properties();
props.setProperty(PkgProps.EXTRA_OLD_PATHS, oldPaths);
- props.setProperty(ToolPackage.PROP_MIN_PLATFORM_TOOLS_REV,
+ props.setProperty(PkgProps.MIN_PLATFORM_TOOLS_REV,
Integer.toString((min_platform_tools_rev)));
return new MockExtraPackage(source, props, vendor, newPath, revision) {
@Override
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockExtraPackage.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockExtraPackage.java
index 6225935..d6a98a0 100755
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockExtraPackage.java
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockExtraPackage.java
@@ -18,9 +18,8 @@ package com.android.sdklib.internal.repository.packages;
import com.android.sdklib.internal.repository.archives.Archive.Arch;
import com.android.sdklib.internal.repository.archives.Archive.Os;
-import com.android.sdklib.internal.repository.packages.ExtraPackage;
-import com.android.sdklib.internal.repository.packages.ToolPackage;
import com.android.sdklib.internal.repository.sources.SdkSource;
+import com.android.sdklib.repository.PkgProps;
import java.util.Properties;
@@ -73,7 +72,7 @@ public class MockExtraPackage extends ExtraPackage {
private static Properties createProps(int min_platform_tools_rev) {
Properties props = new Properties();
- props.setProperty(ToolPackage.PROP_MIN_PLATFORM_TOOLS_REV,
+ props.setProperty(PkgProps.MIN_PLATFORM_TOOLS_REV,
Integer.toString((min_platform_tools_rev)));
return props;
}
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockPlatformToolPackage.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockPlatformToolPackage.java
index fc01b3c..0b46876 100755
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockPlatformToolPackage.java
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockPlatformToolPackage.java
@@ -20,6 +20,9 @@ import com.android.sdklib.internal.repository.archives.Archive.Arch;
import com.android.sdklib.internal.repository.archives.Archive.Os;
import com.android.sdklib.internal.repository.packages.PlatformToolPackage;
import com.android.sdklib.internal.repository.sources.SdkSource;
+import com.android.sdklib.repository.PkgProps;
+
+import java.util.Properties;
/**
* A mock {@link PlatformToolPackage} for testing.
@@ -57,5 +60,36 @@ public class MockPlatformToolPackage extends PlatformToolPackage {
"foo" // archiveOsPath
);
}
+
+ /**
+ * Creates a {@link MockPlatformToolPackage} with the given revision and hardcoded defaults
+ * for everything else.
+ * <p/>
+ * By design, this creates a package with one and only one archive.
+ */
+ public MockPlatformToolPackage(SdkSource source, PreviewVersion previewVersion) {
+ super(
+ source, // source,
+ createProps(previewVersion), // props,
+ previewVersion.getMajor(),
+ null, // license,
+ "desc", // description,
+ "url", // descUrl,
+ Os.getCurrentOs(), // archiveOs,
+ Arch.getCurrentArch(), // archiveArch,
+ "foo" // archiveOsPath
+ );
+ }
+
+ private static Properties createProps(PreviewVersion previewVersion) {
+ Properties props = new Properties();
+ props.setProperty(PkgProps.PKG_MINOR_REV,
+ Integer.toString(previewVersion.getMinor()));
+ props.setProperty(PkgProps.PKG_MICRO_REV,
+ Integer.toString(previewVersion.getMicro()));
+ props.setProperty(PkgProps.PKG_PREVIEW_REV,
+ Integer.toString(previewVersion.getPreview()));
+ return props;
+ }
}
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockSystemImagePackage.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockSystemImagePackage.java
index 534dad8..1726bbd 100755
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockSystemImagePackage.java
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockSystemImagePackage.java
@@ -33,12 +33,12 @@ public class MockSystemImagePackage extends SystemImagePackage {
* By design, this package contains one and only one archive.
*/
public MockSystemImagePackage(MockPlatformPackage basePlatform, int revision, String abi) {
- super(basePlatform.getVersion(),
+ super(basePlatform.getAndroidVersion(),
revision,
abi,
null /*props*/,
String.format("/sdk/system-images/android-%s/%s",
- basePlatform.getVersion().getApiString(), abi));
+ basePlatform.getAndroidVersion().getApiString(), abi));
}
/**
@@ -53,11 +53,11 @@ public class MockSystemImagePackage extends SystemImagePackage {
int revision,
String abi) {
super(source,
- basePlatform.getVersion(),
+ basePlatform.getAndroidVersion(),
revision,
abi,
null /*props*/,
String.format("/sdk/system-images/android-%s/%s",
- basePlatform.getVersion().getApiString(), abi));
+ basePlatform.getAndroidVersion().getApiString(), abi));
}
}
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockToolPackage.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockToolPackage.java
index e1da422..e4bd9c6 100755
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockToolPackage.java
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/MockToolPackage.java
@@ -20,6 +20,7 @@ import com.android.sdklib.internal.repository.archives.Archive.Arch;
import com.android.sdklib.internal.repository.archives.Archive.Os;
import com.android.sdklib.internal.repository.packages.ToolPackage;
import com.android.sdklib.internal.repository.sources.SdkSource;
+import com.android.sdklib.repository.PkgProps;
import java.util.Properties;
@@ -46,10 +47,10 @@ public class MockToolPackage extends ToolPackage {
* <p/>
* By design, this creates a package with one and only one archive.
*/
- public MockToolPackage(SdkSource source, int revision, int min_platform_tools_rev) {
+ public MockToolPackage(SdkSource source, int revision, int minPlatformToolsRev) {
super(
source, // source,
- createProps(min_platform_tools_rev), // props,
+ createProps(null /*version*/, minPlatformToolsRev), // props,
revision,
null, // license,
"desc", // description,
@@ -60,10 +61,41 @@ public class MockToolPackage extends ToolPackage {
);
}
- private static Properties createProps(int min_platform_tools_rev) {
+ /**
+ * Creates a {@link MockToolPackage} with the given revision and hardcoded defaults
+ * for everything else.
+ * <p/>
+ * By design, this creates a package with one and only one archive.
+ */
+ public MockToolPackage(
+ SdkSource source,
+ PreviewVersion previewVersion,
+ int minPlatformToolsRev) {
+ super(
+ source, // source,
+ createProps(previewVersion, minPlatformToolsRev), // props,
+ previewVersion.getMajor(),
+ null, // license,
+ "desc", // description,
+ "url", // descUrl,
+ Os.getCurrentOs(), // archiveOs,
+ Arch.getCurrentArch(), // archiveArch,
+ "foo" // archiveOsPath
+ );
+ }
+
+ private static Properties createProps(PreviewVersion previewVersion, int minPlatformToolsRev) {
Properties props = new Properties();
- props.setProperty(ToolPackage.PROP_MIN_PLATFORM_TOOLS_REV,
- Integer.toString((min_platform_tools_rev)));
+ props.setProperty(PkgProps.MIN_PLATFORM_TOOLS_REV,
+ Integer.toString((minPlatformToolsRev)));
+ if (previewVersion != null) {
+ props.setProperty(PkgProps.PKG_MINOR_REV,
+ Integer.toString(previewVersion.getMinor()));
+ props.setProperty(PkgProps.PKG_MICRO_REV,
+ Integer.toString(previewVersion.getMicro()));
+ props.setProperty(PkgProps.PKG_PREVIEW_REV,
+ Integer.toString(previewVersion.getPreview()));
+ }
return props;
}
}
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/PlatformPackageTest.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/PlatformPackageTest.java
index a0b4ab7..acb57ee 100755
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/PlatformPackageTest.java
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/PlatformPackageTest.java
@@ -75,7 +75,7 @@ public class PlatformPackageTest extends MinToolsPackageTest {
super.testCreatedPackage(p);
// Package properties
- assertEquals("API 5", p.getVersion().toString());
+ assertEquals("API 5", p.getAndroidVersion().toString());
assertEquals("armeabi", p.getIncludedAbi());
}
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/PreviewVersionTest.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/PreviewVersionTest.java
new file mode 100755
index 0000000..daa4704
--- /dev/null
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/PreviewVersionTest.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+package com.android.sdklib.internal.repository.packages;
+
+import junit.framework.TestCase;
+
+public class PreviewVersionTest extends TestCase {
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public final void testPreviewVersion() {
+ PreviewVersion p = new PreviewVersion(5);
+ assertEquals(5, p.getMajor());
+ assertEquals(PreviewVersion.IMPLICIT_MINOR_REV, p.getMinor());
+ assertEquals(PreviewVersion.IMPLICIT_MICRO_REV, p.getMicro());
+ assertEquals(PreviewVersion.NOT_A_PREVIEW, p.getPreview());
+ assertFalse (p.isPreview());
+ assertEquals("5", p.toShortString());
+ assertEquals("5.0.0", p.toString());
+
+ p = new PreviewVersion(5, 0, 0, 6);
+ assertEquals(5, p.getMajor());
+ assertEquals(PreviewVersion.IMPLICIT_MINOR_REV, p.getMinor());
+ assertEquals(PreviewVersion.IMPLICIT_MICRO_REV, p.getMicro());
+ assertEquals(6, p.getPreview());
+ assertTrue (p.isPreview());
+ assertEquals("5 rc6", p.toShortString());
+ assertEquals("5.0.0 rc6", p.toString());
+
+ p = new PreviewVersion(6, 7, 0);
+ assertEquals(6, p.getMajor());
+ assertEquals(7, p.getMinor());
+ assertEquals(0, p.getMicro());
+ assertEquals(0, p.getPreview());
+ assertFalse (p.isPreview());
+ assertEquals("6.7", p.toShortString());
+ assertEquals("6.7.0", p.toString());
+
+ p = new PreviewVersion(10, 11, 12, PreviewVersion.NOT_A_PREVIEW);
+ assertEquals(10, p.getMajor());
+ assertEquals(11, p.getMinor());
+ assertEquals(12, p.getMicro());
+ assertEquals(0, p.getPreview());
+ assertFalse (p.isPreview());
+ assertEquals("10.11.12", p.toShortString());
+ assertEquals("10.11.12", p.toString());
+
+ p = new PreviewVersion(10, 11, 12, 13);
+ assertEquals(10, p.getMajor());
+ assertEquals(11, p.getMinor());
+ assertEquals(12, p.getMicro());
+ assertEquals(13, p.getPreview());
+ assertTrue (p.isPreview());
+ assertEquals("10.11.12 rc13", p.toShortString());
+ assertEquals("10.11.12 rc13", p.toString());
+ }
+
+ public final void testCompareTo() {
+ PreviewVersion s4 = new PreviewVersion(4);
+ PreviewVersion i4 = new PreviewVersion(4);
+ PreviewVersion g5 = new PreviewVersion(5, 1, 0, 6);
+ PreviewVersion y5 = new PreviewVersion(5);
+ PreviewVersion c5 = new PreviewVersion(5, 1, 0, 6);
+ PreviewVersion o5 = new PreviewVersion(5, 0, 0, 7);
+ PreviewVersion p5 = new PreviewVersion(5, 1, 0, 0);
+
+ assertEquals(s4, i4); // 4.0.0-0 == 4.0.0-0
+ assertEquals(g5, c5); // 5.1.0-6 == 5.1.0-6
+
+ assertFalse(y5.equals(p5)); // 5.0.0-0 != 5.1.0-0
+ assertFalse(g5.equals(p5)); // 5.1.0-6 != 5.1.0-0
+ assertTrue (s4.compareTo(i4) == 0); // 4.0.0-0 == 4.0.0-0
+ assertTrue (s4.compareTo(y5) < 0); // 4.0.0-0 < 5.0.0-0
+ assertTrue (y5.compareTo(y5) == 0); // 5.0.0-0 == 5.0.0-0
+ assertTrue (y5.compareTo(p5) < 0); // 5.0.0-0 < 5.1.0-0
+ assertTrue (o5.compareTo(y5) < 0); // 5.0.0-7 < 5.0.0-0
+ assertTrue (p5.compareTo(p5) == 0); // 5.1.0-0 == 5.1.0-0
+ assertTrue (c5.compareTo(p5) < 0); // 5.1.0-6 < 5.1.0-0
+ assertTrue (p5.compareTo(c5) > 0); // 5.1.0-0 > 5.1.0-6
+ assertTrue (p5.compareTo(o5) > 0); // 5.1.0-0 > 5.0.0-7
+ assertTrue (c5.compareTo(o5) > 0); // 5.1.0-6 > 5.0.0-7
+ assertTrue (o5.compareTo(o5) == 0); // 5.0.0-7 > 5.0.0-7
+ }
+
+}
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/SourcePackageTest.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/SourcePackageTest.java
index 66f37dc..d87eab3 100755
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/SourcePackageTest.java
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/SourcePackageTest.java
@@ -79,7 +79,7 @@ public class SourcePackageTest extends PackageTest {
super.testCreatedPackage(p);
// SourcePackageTest properties
- assertEquals("API 5", p.getVersion().toString());
+ assertEquals("API 5", p.getAndroidVersion().toString());
}
// ----
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/SystemImagePackageTest.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/SystemImagePackageTest.java
index 14e1c3e..c32b81f 100755
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/SystemImagePackageTest.java
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/packages/SystemImagePackageTest.java
@@ -85,7 +85,7 @@ public class SystemImagePackageTest extends PackageTest {
super.testCreatedPackage(p);
// SystemImagePackage properties
- assertEquals("API 5", p.getVersion().toString());
+ assertEquals("API 5", p.getAndroidVersion().toString());
assertEquals("armeabi-v7a", p.getAbi());
}
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/sources/SdkRepoSourceTest.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/sources/SdkRepoSourceTest.java
index 1bc9639..8bf39e1 100755
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/sources/SdkRepoSourceTest.java
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/sources/SdkRepoSourceTest.java
@@ -678,7 +678,7 @@ public class SdkRepoSourceTest extends TestCase {
for (Package p : pkgs) {
if (p instanceof SystemImagePackage) {
SystemImagePackage sip = (SystemImagePackage) p;
- String v = sip.getVersion().getApiString();
+ String v = sip.getAndroidVersion().getApiString();
String a = sip.getAbi();
sysImgVersionAbi.add(String.format("%1$s %2$s", v, a)); //$NON-NLS-1$
}
@@ -694,7 +694,7 @@ public class SdkRepoSourceTest extends TestCase {
for (Package p : pkgs) {
if (p instanceof SourcePackage) {
SourcePackage sp = (SourcePackage) p;
- String v = sp.getVersion().getApiString();
+ String v = sp.getAndroidVersion().getApiString();
sourceVersion.add(v);
}
}
@@ -820,7 +820,7 @@ public class SdkRepoSourceTest extends TestCase {
for (Package p : pkgs) {
if (p instanceof SystemImagePackage) {
SystemImagePackage sip = (SystemImagePackage) p;
- String v = sip.getVersion().getApiString();
+ String v = sip.getAndroidVersion().getApiString();
String a = sip.getAbi();
sysImgVersionAbi.add(String.format("%1$s %2$s", v, a)); //$NON-NLS-1$
}
@@ -837,7 +837,150 @@ public class SdkRepoSourceTest extends TestCase {
for (Package p : pkgs) {
if (p instanceof SourcePackage) {
SourcePackage sp = (SourcePackage) p;
- String v = sp.getVersion().getApiString();
+ String v = sp.getAndroidVersion().getApiString();
+ sourceVersion.add(v);
+ }
+ }
+ assertEquals(
+ "[42, 2, 1]",
+ Arrays.toString(sourceVersion.toArray()));
+ }
+
+ /**
+ * Validate what we can load from repository in schema version 6
+ */
+ public void testLoadXml_7() throws Exception {
+ InputStream xmlStream = getTestResource(
+ "/com/android/sdklib/testdata/repository_sample_7.xml");
+
+ // guess the version from the XML document
+ int version = mSource._getXmlSchemaVersion(xmlStream);
+ assertEquals(7, version);
+
+ Boolean[] validatorFound = new Boolean[] { Boolean.FALSE };
+ String[] validationError = new String[] { null };
+ String url = "not-a-valid-url://" + SdkRepoConstants.URL_DEFAULT_FILENAME;
+
+ String uri = mSource._validateXml(xmlStream, url, version, validationError, validatorFound);
+ assertEquals(Boolean.TRUE, validatorFound[0]);
+ assertEquals(null, validationError[0]);
+ assertEquals(SdkRepoConstants.getSchemaUri(7), uri);
+
+ // Validation was successful, load the document
+ MockMonitor monitor = new MockMonitor();
+ Document doc = mSource._getDocument(xmlStream, monitor);
+ assertNotNull(doc);
+
+ // Get the packages
+ assertTrue(mSource._parsePackages(doc, uri, monitor));
+
+ assertEquals("Found SDK Platform Android 1.0, API 1, revision 3\n" +
+ "Found Documentation for Android SDK, API 1, revision 1\n" +
+ "Found Sources for Android SDK, API 1, revision 1\n" +
+ "Found SDK Platform Android 1.1, API 2, revision 12\n" +
+ "Found Intel x86 Atom System Image, Android API 2, revision 1\n" +
+ "Found ARM EABI v7a System Image, Android API 2, revision 2\n" +
+ "Found Sources for Android SDK, API 2, revision 2\n" +
+ "Found SDK Platform Android Pastry Preview, revision 3\n" +
+ "Found Android SDK Tools, revision 1.2.3 rc4\n" +
+ "Found Documentation for Android SDK, API 2, revision 42\n" +
+ "Found Android SDK Tools, revision 42\n" +
+ "Found Android SDK Platform-tools, revision 3 rc5\n" +
+ "Found Samples for SDK API 14, revision 24 (Obsolete)\n" +
+ "Found ARM EABI System Image, Android API 42, revision 12\n" +
+ "Found Mips System Image, Android API 42, revision 12\n" +
+ "Found Sources for Android SDK, API 42, revision 12\n",
+ monitor.getCapturedVerboseLog());
+ assertEquals("", monitor.getCapturedLog());
+ assertEquals("", monitor.getCapturedErrorLog());
+
+ // check the packages we found... we expected to find 13 packages with each at least
+ // one archive.
+ // Note the order doesn't necessary match the one from the
+ // assertEquald(getCapturedVerboseLog) because packages are sorted using the
+ // Packages' sorting order, e.g. all platforms are sorted by descending API level, etc.
+ Package[] pkgs = mSource.getPackages();
+
+ assertEquals(16, pkgs.length);
+ for (Package p : pkgs) {
+ assertTrue(p.getArchives().length >= 1);
+ }
+
+ // Check the layoutlib & included-abi of the platform packages.
+ ArrayList<Pair<Integer, Integer>> layoutlibVers = new ArrayList<Pair<Integer,Integer>>();
+ ArrayList<String> includedAbi = new ArrayList<String>();
+ for (Package p : pkgs) {
+ if (p instanceof PlatformPackage) {
+ layoutlibVers.add(((PlatformPackage) p).getLayoutlibVersion());
+ String abi = ((PlatformPackage) p).getIncludedAbi();
+ includedAbi.add(abi == null ? "(null)" : abi);
+ }
+ }
+ assertEquals(
+ "[Pair [first=1, second=0], " + // platform API 5 preview
+ "Pair [first=5, second=31415], " + // platform API 2
+ "Pair [first=5, second=0]]", // platform API 1
+ Arrays.toString(layoutlibVers.toArray()));
+ assertEquals(
+ "[(null), " + // platform API 5 preview
+ "x86, " + // platform API 2
+ "armeabi]", // platform API 1
+ Arrays.toString(includedAbi.toArray()));
+
+ // Check the extra packages path, vendor, install folder, project-files, old-paths
+
+ final String osSdkPath = "SDK";
+ final SdkManager sdkManager = new MockEmptySdkManager(osSdkPath);
+
+ ArrayList<String> extraPaths = new ArrayList<String>();
+ ArrayList<String> extraVendors = new ArrayList<String>();
+ ArrayList<File> extraInstall = new ArrayList<File>();
+ ArrayList<ArrayList<String>> extraFilePaths = new ArrayList<ArrayList<String>>();
+ for (Package p : pkgs) {
+ if (p instanceof ExtraPackage) {
+ ExtraPackage ep = (ExtraPackage) p;
+ // combine path and old-paths in the form "path [old_path1, old_path2]"
+ extraPaths.add(ep.getPath() + " " + Arrays.toString(ep.getOldPaths()));
+ extraVendors.add(ep.getVendorId() + "/" + ep.getVendorDisplay());
+ extraInstall.add(ep.getInstallFolder(osSdkPath, sdkManager));
+
+ ArrayList<String> filePaths = new ArrayList<String>();
+ for (String filePath : ep.getProjectFiles()) {
+ filePaths.add(filePath);
+ }
+ extraFilePaths.add(filePaths);
+ }
+ }
+
+ // There are no extra packages anymore in repository-6
+ assertEquals("[]", Arrays.toString(extraPaths.toArray()));
+ assertEquals("[]", Arrays.toString(extraVendors.toArray()));
+ assertEquals("[]", Arrays.toString(extraInstall.toArray()));
+ assertEquals("[]", Arrays.toString(extraFilePaths.toArray()));
+
+ // Check the system-image packages
+ ArrayList<String> sysImgVersionAbi = new ArrayList<String>();
+ for (Package p : pkgs) {
+ if (p instanceof SystemImagePackage) {
+ SystemImagePackage sip = (SystemImagePackage) p;
+ String v = sip.getAndroidVersion().getApiString();
+ String a = sip.getAbi();
+ sysImgVersionAbi.add(String.format("%1$s %2$s", v, a)); //$NON-NLS-1$
+ }
+ }
+ assertEquals(
+ "[42 armeabi, " +
+ "42 mips, " +
+ "2 armeabi-v7a, " +
+ "2 x86]",
+ Arrays.toString(sysImgVersionAbi.toArray()));
+
+ // Check the source packages
+ ArrayList<String> sourceVersion = new ArrayList<String>();
+ for (Package p : pkgs) {
+ if (p instanceof SourcePackage) {
+ SourcePackage sp = (SourcePackage) p;
+ String v = sp.getAndroidVersion().getApiString();
sourceVersion.add(v);
}
}
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/repository/ValidateRepositoryXmlTest.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/repository/ValidateRepositoryXmlTest.java
index ce21650..345b35e 100755
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/repository/ValidateRepositoryXmlTest.java
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/repository/ValidateRepositoryXmlTest.java
@@ -162,6 +162,32 @@ public class ValidateRepositoryXmlTest extends TestCase {
}
+ /** Validate a valid sample using namespace version 5 using an InputStream */
+ public void testValidateLocalRepositoryFile6() throws Exception {
+ InputStream xmlStream = this.getClass().getResourceAsStream(
+ "/com/android/sdklib/testdata/repository_sample_6.xml");
+ Source source = new StreamSource(xmlStream);
+
+ CaptureErrorHandler handler = new CaptureErrorHandler();
+ Validator validator = getRepoValidator(6, handler);
+ validator.validate(source);
+ handler.verify();
+
+ }
+
+ /** Validate a valid sample using namespace version 5 using an InputStream */
+ public void testValidateLocalRepositoryFile7() throws Exception {
+ InputStream xmlStream = this.getClass().getResourceAsStream(
+ "/com/android/sdklib/testdata/repository_sample_7.xml");
+ Source source = new StreamSource(xmlStream);
+
+ CaptureErrorHandler handler = new CaptureErrorHandler();
+ Validator validator = getRepoValidator(7, handler);
+ validator.validate(source);
+ handler.verify();
+
+ }
+
// IMPORTANT: each time you add a test here, you should add a corresponding
// test in SdkRepoSourceTest to validate the XML content is parsed correctly.
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/testdata/repository_sample_4.xml b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/testdata/repository_sample_4.xml
index a201a63..f68b033 100755
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/testdata/repository_sample_4.xml
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/testdata/repository_sample_4.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
- * Copyright (C) 2010 The Android Open Source Project
+ * Copyright (C) 2011 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.
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/testdata/repository_sample_5.xml b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/testdata/repository_sample_5.xml
index 4db8b33..471550e 100755
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/testdata/repository_sample_5.xml
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/testdata/repository_sample_5.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
- * Copyright (C) 2010 The Android Open Source Project
+ * Copyright (C) 2011 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.
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/testdata/repository_sample_6.xml b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/testdata/repository_sample_6.xml
index e57b831..12be591 100755
--- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/testdata/repository_sample_6.xml
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/testdata/repository_sample_6.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
- * Copyright (C) 2010 The Android Open Source Project
+ * Copyright (C) 2012 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.
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/testdata/repository_sample_7.xml b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/testdata/repository_sample_7.xml
new file mode 100755
index 0000000..1232f1d
--- /dev/null
+++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/testdata/repository_sample_7.xml
@@ -0,0 +1,331 @@
+<?xml version="1.0"?>
+<!--
+ * Copyright (C) 2012 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:sdk="http://schemas.android.com/sdk/android/repository/7">
+
+ <!-- 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:layoutlib>
+ <sdk:api>5</sdk:api>
+ <sdk:revision>0</sdk:revision>
+ </sdk:layoutlib>
+ <sdk:included-abi>armeabi</sdk:included-abi>
+ </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:source>
+ <sdk:api-level>1</sdk:api-level>
+ <sdk:revision>1</sdk:revision>
+ <sdk:archives>
+ <sdk:archive os="any">
+ <sdk:size>65535</sdk:size>
+ <sdk:checksum type="sha1">1234ae37115ebf13412bbef91339ee0d94541234</sdk:checksum>
+ <sdk:url>http://www.example.com/plat1/sources1.zip</sdk:url>
+ </sdk:archive>
+ </sdk:archives>
+ </sdk:source>
+
+ <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:layoutlib>
+ <sdk:api>5</sdk:api>
+ <sdk:revision>31415</sdk:revision>
+ </sdk:layoutlib>
+ <sdk:included-abi>x86</sdk:included-abi>
+ </sdk:platform>
+
+ <sdk:system-image>
+ <sdk:api-level>2</sdk:api-level>
+ <sdk:revision>1</sdk:revision>
+ <sdk:abi>x86</sdk:abi>
+ <sdk:archives>
+ <sdk:archive os="any">
+ <sdk:size>65535</sdk:size>
+ <sdk:checksum type="sha1">1234ae37115ebf13412bbef91339ee0d94541234</sdk:checksum>
+ <sdk:url>http://www.example.com/plat1/x86/image1.zip</sdk:url>
+ </sdk:archive>
+ </sdk:archives>
+ </sdk:system-image>
+
+ <sdk:system-image>
+ <sdk:api-level>2</sdk:api-level>
+ <sdk:revision>2</sdk:revision>
+ <sdk:abi>armeabi-v7a</sdk:abi>
+ <sdk:archives>
+ <sdk:archive os="any">
+ <sdk:size>65534</sdk:size>
+ <sdk:checksum type="sha1">1234ae37115ebf13412bbef91339ee0d94541234</sdk:checksum>
+ <sdk:url>http://www.example.com/plat1/armv7/image2.zip</sdk:url>
+ </sdk:archive>
+ </sdk:archives>
+ </sdk:system-image>
+
+ <sdk:source>
+ <sdk:api-level>2</sdk:api-level>
+ <sdk:revision>2</sdk:revision>
+ <sdk:archives>
+ <sdk:archive os="any">
+ <sdk:size>65534</sdk:size>
+ <sdk:checksum type="sha1">1234ae37115ebf13412bbef91339ee0d94541234</sdk:checksum>
+ <sdk:url>http://www.example.com/plat1/sources2.zip</sdk:url>
+ </sdk:archive>
+ </sdk:archives>
+ </sdk:source>
+
+ <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:layoutlib>
+ <sdk:api>1</sdk:api>
+ </sdk:layoutlib>
+ </sdk:platform>
+
+ <sdk:tool>
+ <sdk:revision>1</sdk:revision>
+ <sdk:minor-rev>2</sdk:minor-rev>
+ <sdk:micro-rev>3</sdk:micro-rev>
+ <sdk:preview>4</sdk:preview>
+ <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:min-platform-tools-rev>4</sdk:min-platform-tools-rev>
+ <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:min-platform-tools-rev>3</sdk:min-platform-tools-rev>
+ <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:platform-tool>
+ <sdk:revision>3</sdk:revision>
+ <sdk:minor-rev>0</sdk:minor-rev>
+ <sdk:micro-rev>0</sdk:micro-rev>
+ <sdk:preview>5</sdk:preview>
+ <sdk:uses-license ref="license1" />
+ <sdk:archives>
+ <sdk:archive os="windows">
+ <sdk:size>65536</sdk:size>
+ <sdk:checksum type="sha1">3822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
+ <sdk:url>distrib/platform-tools/2.zip</sdk:url>
+ </sdk:archive>
+ <sdk:archive os="linux">
+ <sdk:size>65536</sdk:size>
+ <sdk:checksum type="sha1">3822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
+ <sdk:url>distrib/platform-tools2-linux.tar.bz2</sdk:url>
+ </sdk:archive>
+ <sdk:archive os="macosx">
+ <sdk:size>65536</sdk:size>
+ <sdk:checksum type="sha1">3822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
+ <sdk:url>distrib/platform-tools2-mac.tar.bz2</sdk:url>
+ </sdk:archive>
+ </sdk:archives>
+ </sdk:platform-tool>
+
+ <sdk:sample>
+ <sdk:api-level>14</sdk:api-level>
+ <sdk:revision>24</sdk:revision>
+ <sdk:archives>
+ <sdk:archive os="any" arch="any">
+ <sdk:size>65537</sdk:size>
+ <sdk:checksum type="sha1">3822ae37115ebf13412bbef91339ee0d9454525e</sdk:checksum>
+ <sdk:url>distrib/sample_duff.zip</sdk:url>
+ </sdk:archive>
+ </sdk:archives>
+ <sdk:description>Some sample package</sdk:description>
+ <sdk:desc-url>http://www.example.com/sample.html</sdk:desc-url>
+ <sdk:min-tools-rev>5</sdk:min-tools-rev>
+ <sdk:obsolete>This is obsolete</sdk:obsolete>
+ </sdk:sample>
+
+ <sdk:system-image>
+ <sdk:api-level>42</sdk:api-level>
+ <sdk:revision>12</sdk:revision>
+ <sdk:abi>armeabi</sdk:abi>
+ <sdk:archives>
+ <sdk:archive os="any">
+ <sdk:size>1234</sdk:size>
+ <sdk:checksum type="sha1">12345637115ebf13412bbef91339ee0d94541234</sdk:checksum>
+ <sdk:url>http://www.example.com/plat42/86/image12.zip</sdk:url>
+ </sdk:archive>
+ </sdk:archives>
+ </sdk:system-image>
+
+ <sdk:system-image>
+ <sdk:api-level>42</sdk:api-level>
+ <sdk:revision>12</sdk:revision>
+ <sdk:abi>mips</sdk:abi>
+ <sdk:archives>
+ <sdk:archive os="any">
+ <sdk:size>12345</sdk:size>
+ <sdk:checksum type="sha1">12345637115ebf13412bbef91339ee0d94541234</sdk:checksum>
+ <sdk:url>http://www.example.com/plat42/mips/image12.zip</sdk:url>
+ </sdk:archive>
+ </sdk:archives>
+ </sdk:system-image>
+
+ <sdk:source>
+ <sdk:api-level>42</sdk:api-level>
+ <sdk:revision>12</sdk:revision>
+ <sdk:archives>
+ <sdk:archive os="any">
+ <sdk:size>1234</sdk:size>
+ <sdk:checksum type="sha1">12345637115ebf13412bbef91339ee0d94541234</sdk:checksum>
+ <sdk:url>http://www.example.com/plat42/source12.zip</sdk:url>
+ </sdk:archive>
+ </sdk:archives>
+ </sdk:source>
+
+</sdk:sdk-repository>
diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SdkUpdaterChooserDialog.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SdkUpdaterChooserDialog.java
index b5ab90b..55e7db2 100755
--- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SdkUpdaterChooserDialog.java
+++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SdkUpdaterChooserDialog.java
@@ -19,7 +19,7 @@ package com.android.sdkuilib.internal.repository;
import com.android.sdklib.AndroidVersion;
import com.android.sdklib.SdkConstants;
import com.android.sdklib.internal.repository.archives.Archive;
-import com.android.sdklib.internal.repository.packages.IPackageVersion;
+import com.android.sdklib.internal.repository.packages.IAndroidVersionProvider;
import com.android.sdklib.internal.repository.packages.Package;
import com.android.sdklib.internal.repository.sources.SdkSource;
import com.android.sdkuilib.internal.repository.icons.ImageFactory;
@@ -428,9 +428,10 @@ final class SdkUpdaterChooserDialog extends GridDialog {
boolean showRev = true;
- if (pNew instanceof IPackageVersion && pOld instanceof IPackageVersion) {
- AndroidVersion vOld = ((IPackageVersion) pOld).getVersion();
- AndroidVersion vNew = ((IPackageVersion) pNew).getVersion();
+ if (pNew instanceof IAndroidVersionProvider &&
+ pOld instanceof IAndroidVersionProvider) {
+ AndroidVersion vOld = ((IAndroidVersionProvider) pOld).getAndroidVersion();
+ AndroidVersion vNew = ((IAndroidVersionProvider) pNew).getAndroidVersion();
if (!vOld.equals(vNew)) {
// Versions are different, so indicate more than just the revision.
diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SdkUpdaterLogic.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SdkUpdaterLogic.java
index 0b9f396..97de564 100755
--- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SdkUpdaterLogic.java
+++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/SdkUpdaterLogic.java
@@ -27,16 +27,16 @@ import com.android.sdklib.internal.repository.packages.IExactApiLevelDependency;
import com.android.sdklib.internal.repository.packages.IMinApiLevelDependency;
import com.android.sdklib.internal.repository.packages.IMinPlatformToolsDependency;
import com.android.sdklib.internal.repository.packages.IMinToolsDependency;
-import com.android.sdklib.internal.repository.packages.IPackageVersion;
import com.android.sdklib.internal.repository.packages.IPlatformDependency;
+import com.android.sdklib.internal.repository.packages.IAndroidVersionProvider;
import com.android.sdklib.internal.repository.packages.MinToolsPackage;
import com.android.sdklib.internal.repository.packages.Package;
+import com.android.sdklib.internal.repository.packages.Package.UpdateInfo;
import com.android.sdklib.internal.repository.packages.PlatformPackage;
import com.android.sdklib.internal.repository.packages.PlatformToolPackage;
import com.android.sdklib.internal.repository.packages.SamplePackage;
import com.android.sdklib.internal.repository.packages.SystemImagePackage;
import com.android.sdklib.internal.repository.packages.ToolPackage;
-import com.android.sdklib.internal.repository.packages.Package.UpdateInfo;
import com.android.sdklib.internal.repository.sources.SdkSource;
import com.android.sdklib.internal.repository.sources.SdkSources;
@@ -223,8 +223,8 @@ class SdkUpdaterLogic {
int rev = p.getRevision();
int api = 0;
boolean isPreview = false;
- if (p instanceof IPackageVersion) {
- AndroidVersion vers = ((IPackageVersion) p).getVersion();
+ if (p instanceof IAndroidVersionProvider) {
+ AndroidVersion vers = ((IAndroidVersionProvider) p).getAndroidVersion();
api = vers.getApiLevel();
isPreview = vers.isPreview();
}
@@ -264,8 +264,8 @@ class SdkUpdaterLogic {
int rev = p.getRevision();
int api = 0;
boolean isPreview = false;
- if (p instanceof IPackageVersion) {
- AndroidVersion vers = ((IPackageVersion) p).getVersion();
+ if (p instanceof IAndroidVersionProvider) {
+ AndroidVersion vers = ((IAndroidVersionProvider) p).getAndroidVersion();
api = vers.getApiLevel();
isPreview = vers.isPreview();
}
@@ -318,7 +318,7 @@ class SdkUpdaterLogic {
continue;
}
SystemImagePackage sip = (SystemImagePackage) p2;
- if (sip.getVersion().equals(pp.getVersion())) {
+ if (sip.getAndroidVersion().equals(pp.getAndroidVersion())) {
for (Archive a : sip.getArchives()) {
if (a.isCompatible()) {
insertArchive(a,
@@ -912,7 +912,7 @@ class SdkUpdaterLogic {
SdkSource[] remoteSources,
ArchiveInfo[] localArchives) {
// This is the requirement to match.
- AndroidVersion v = pkg.getVersion();
+ AndroidVersion v = pkg.getAndroidVersion();
// Find a platform that would satisfy the requirement.
@@ -922,7 +922,7 @@ class SdkUpdaterLogic {
if (a != null) {
Package p = a.getParentPackage();
if (p instanceof PlatformPackage) {
- if (v.equals(((PlatformPackage) p).getVersion())) {
+ if (v.equals(((PlatformPackage) p).getAndroidVersion())) {
// We found one already installed.
return null;
}
@@ -936,7 +936,7 @@ class SdkUpdaterLogic {
if (a != null) {
Package p = a.getParentPackage();
if (p instanceof PlatformPackage) {
- if (v.equals(((PlatformPackage) p).getVersion())) {
+ if (v.equals(((PlatformPackage) p).getAndroidVersion())) {
// The dependency is already scheduled for install, nothing else to do.
return ai;
}
@@ -949,7 +949,7 @@ class SdkUpdaterLogic {
for (Archive a : selectedArchives) {
Package p = a.getParentPackage();
if (p instanceof PlatformPackage) {
- if (v.equals(((PlatformPackage) p).getVersion())) {
+ if (v.equals(((PlatformPackage) p).getAndroidVersion())) {
// It's not already in the list of things to install, so add it now
return insertArchive(a,
outArchives,
@@ -967,7 +967,7 @@ class SdkUpdaterLogic {
fetchRemotePackages(remotePkgs, remoteSources);
for (Package p : remotePkgs) {
if (p instanceof PlatformPackage) {
- if (v.equals(((PlatformPackage) p).getVersion())) {
+ if (v.equals(((PlatformPackage) p).getAndroidVersion())) {
// It's not already in the list of things to install, so add the
// first compatible archive we can find.
for (Archive a : p.getArchives()) {
@@ -988,7 +988,7 @@ class SdkUpdaterLogic {
// We end up here if nothing matches. We don't have a good platform to match.
// We need to indicate this addon depends on a missing platform archive
// so that it can be impossible to install later on.
- return new MissingPlatformArchiveInfo(pkg.getVersion());
+ return new MissingPlatformArchiveInfo(pkg.getAndroidVersion());
}
/**
@@ -1025,7 +1025,7 @@ class SdkUpdaterLogic {
if (a != null) {
Package p = a.getParentPackage();
if (p instanceof PlatformPackage) {
- if (((PlatformPackage) p).getVersion().isGreaterOrEqualThan(api)) {
+ if (((PlatformPackage) p).getAndroidVersion().isGreaterOrEqualThan(api)) {
// We found one already installed.
return null;
}
@@ -1042,7 +1042,7 @@ class SdkUpdaterLogic {
if (a != null) {
Package p = a.getParentPackage();
if (p instanceof PlatformPackage) {
- if (((PlatformPackage) p).getVersion().isGreaterOrEqualThan(api)) {
+ if (((PlatformPackage) p).getAndroidVersion().isGreaterOrEqualThan(api)) {
if (api > foundApi) {
foundApi = api;
foundAi = ai;
@@ -1065,7 +1065,7 @@ class SdkUpdaterLogic {
for (Archive a : selectedArchives) {
Package p = a.getParentPackage();
if (p instanceof PlatformPackage) {
- if (((PlatformPackage) p).getVersion().isGreaterOrEqualThan(api)) {
+ if (((PlatformPackage) p).getAndroidVersion().isGreaterOrEqualThan(api)) {
if (api > foundApi) {
foundApi = api;
foundArchive = a;
@@ -1079,7 +1079,7 @@ class SdkUpdaterLogic {
fetchRemotePackages(remotePkgs, remoteSources);
for (Package p : remotePkgs) {
if (p instanceof PlatformPackage) {
- if (((PlatformPackage) p).getVersion().isGreaterOrEqualThan(api)) {
+ if (((PlatformPackage) p).getAndroidVersion().isGreaterOrEqualThan(api)) {
if (api > foundApi) {
// It's not already in the list of things to install, so add the
// first compatible archive we can find.
@@ -1140,7 +1140,7 @@ class SdkUpdaterLogic {
if (a != null) {
Package p = a.getParentPackage();
if (p instanceof PlatformPackage) {
- if (((PlatformPackage) p).getVersion().equals(api)) {
+ if (((PlatformPackage) p).getAndroidVersion().equals(api)) {
// We found one already installed.
return null;
}
@@ -1155,7 +1155,7 @@ class SdkUpdaterLogic {
if (a != null) {
Package p = a.getParentPackage();
if (p instanceof PlatformPackage) {
- if (((PlatformPackage) p).getVersion().equals(api)) {
+ if (((PlatformPackage) p).getAndroidVersion().equals(api)) {
return ai;
}
}
@@ -1167,7 +1167,7 @@ class SdkUpdaterLogic {
for (Archive a : selectedArchives) {
Package p = a.getParentPackage();
if (p instanceof PlatformPackage) {
- if (((PlatformPackage) p).getVersion().equals(api)) {
+ if (((PlatformPackage) p).getAndroidVersion().equals(api)) {
// It's not already in the list of things to install, so add it now
return insertArchive(a,
outArchives,
@@ -1185,7 +1185,7 @@ class SdkUpdaterLogic {
fetchRemotePackages(remotePkgs, remoteSources);
for (Package p : remotePkgs) {
if (p instanceof PlatformPackage) {
- if (((PlatformPackage) p).getVersion().equals(api)) {
+ if (((PlatformPackage) p).getAndroidVersion().equals(api)) {
// It's not already in the list of things to install, so add the
// first compatible archive we can find.
for (Archive a : p.getArchives()) {
diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/AdtUpdateDialog.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/AdtUpdateDialog.java
index d619ea0..f481b0a 100755
--- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/AdtUpdateDialog.java
+++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/AdtUpdateDialog.java
@@ -346,7 +346,7 @@ public class AdtUpdateDialog extends SwtBaseDialog {
boolean accept(Package pkg) {
if (pkg instanceof PlatformPackage) {
PlatformPackage pp = (PlatformPackage) pkg;
- AndroidVersion v = pp.getVersion();
+ AndroidVersion v = pp.getAndroidVersion();
return !v.isPreview() && v.getApiLevel() == mApiLevel;
}
return false;
@@ -359,7 +359,7 @@ public class AdtUpdateDialog extends SwtBaseDialog {
pkg instanceof PlatformPackage &&
!pkg.isLocal()) {
PlatformPackage pp = (PlatformPackage) pkg;
- AndroidVersion v = pp.getVersion();
+ AndroidVersion v = pp.getAndroidVersion();
if (!v.isPreview()) {
int api = v.getApiLevel();
if (api > mApiLevel) {
@@ -388,7 +388,7 @@ public class AdtUpdateDialog extends SwtBaseDialog {
if (!pkg.isLocal()) {
if (pkg instanceof PlatformPackage) {
PlatformPackage pp = (PlatformPackage) pkg;
- AndroidVersion v = pp.getVersion();
+ AndroidVersion v = pp.getAndroidVersion();
if (!v.isPreview()) {
int level = v.getApiLevel();
if ((mFindMaxApi && level == mMaxApiLevel) ||
@@ -418,7 +418,7 @@ public class AdtUpdateDialog extends SwtBaseDialog {
pkg instanceof PlatformPackage &&
!pkg.isLocal()) {
PlatformPackage pp = (PlatformPackage) pkg;
- AndroidVersion v = pp.getVersion();
+ AndroidVersion v = pp.getAndroidVersion();
if (!v.isPreview()) {
int api = v.getApiLevel();
if (api > mMaxApiLevel) {
diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PackagesDiffLogic.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PackagesDiffLogic.java
index 46b5697..687238b 100755
--- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PackagesDiffLogic.java
+++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PackagesDiffLogic.java
@@ -20,7 +20,7 @@ import com.android.sdklib.AndroidVersion;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.SdkConstants;
import com.android.sdklib.internal.repository.packages.ExtraPackage;
-import com.android.sdklib.internal.repository.packages.IPackageVersion;
+import com.android.sdklib.internal.repository.packages.IAndroidVersionProvider;
import com.android.sdklib.internal.repository.packages.Package;
import com.android.sdklib.internal.repository.packages.PlatformPackage;
import com.android.sdklib.internal.repository.packages.PlatformToolPackage;
@@ -107,8 +107,8 @@ class PackagesDiffLogic {
// since by definition they should target the same API level.
int api = 0;
Package p = item.getMainPackage();
- if (p instanceof IPackageVersion) {
- api = ((IPackageVersion) p).getVersion().getApiLevel();
+ if (p instanceof IAndroidVersionProvider) {
+ api = ((IAndroidVersionProvider) p).getAndroidVersion().getApiLevel();
}
if (selectTop && api > 0) {
@@ -607,8 +607,8 @@ class PackagesDiffLogic {
public Object getCategoryKey(Package pkg) {
// Sort by API
- if (pkg instanceof IPackageVersion) {
- return ((IPackageVersion) pkg).getVersion();
+ if (pkg instanceof IAndroidVersionProvider) {
+ return ((IAndroidVersionProvider) pkg).getAndroidVersion();
} else if (pkg instanceof ToolPackage || pkg instanceof PlatformToolPackage) {
return PkgCategoryApi.KEY_TOOLS;
diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PackagesPage.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PackagesPage.java
index 4ef7d6b..ea02e3a 100755
--- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PackagesPage.java
+++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PackagesPage.java
@@ -1313,7 +1313,7 @@ public class PackagesPage extends UpdaterPage implements ISdkChangeListener {
} else if (mColumn == mColumnRevision) {
if (element instanceof PkgItem) {
PkgItem pkg = (PkgItem) element;
- return Integer.toString(pkg.getRevision());
+ return pkg.getRevisionStr();
}
} else if (mColumn == mColumnStatus) {
diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PkgItem.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PkgItem.java
index 5b90375..ae20deb 100755
--- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PkgItem.java
+++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PkgItem.java
@@ -17,7 +17,8 @@
package com.android.sdkuilib.internal.repository.sdkman2;
import com.android.sdklib.internal.repository.archives.Archive;
-import com.android.sdklib.internal.repository.packages.IPackageVersion;
+import com.android.sdklib.internal.repository.packages.IAndroidVersionProvider;
+import com.android.sdklib.internal.repository.packages.IPreviewVersionProvider;
import com.android.sdklib.internal.repository.packages.Package;
import com.android.sdklib.internal.repository.packages.Package.UpdateInfo;
import com.android.sdklib.internal.repository.sources.SdkSource;
@@ -93,6 +94,13 @@ public class PkgItem implements Comparable<PkgItem> {
return mMainPkg.getRevision();
}
+ public String getRevisionStr() {
+ if (mMainPkg instanceof IPreviewVersionProvider) {
+ return ((IPreviewVersionProvider) mMainPkg).getPreviewVersion().toShortString();
+ }
+ return Integer.toString(mMainPkg.getRevision());
+ }
+
public String getDescription() {
return mMainPkg.getDescription();
}
@@ -110,8 +118,8 @@ public class PkgItem implements Comparable<PkgItem> {
}
public int getApi() {
- return mMainPkg instanceof IPackageVersion ?
- ((IPackageVersion) mMainPkg).getVersion().getApiLevel() :
+ return mMainPkg instanceof IAndroidVersionProvider ?
+ ((IAndroidVersionProvider) mMainPkg).getAndroidVersion().getApiLevel() :
-1;
}