diff options
author | Raphael <raphael@google.com> | 2011-09-27 18:27:32 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-09-27 18:27:32 -0700 |
commit | 794cb8d02a94610dda1ebef5f0d72fef345b3894 (patch) | |
tree | 3563dcf56fe294ad9c0f19b6c0dbaee9f909ab65 /sdkmanager | |
parent | a1760eb02098b21f1aa37a293a488a1ab4bdb823 (diff) | |
parent | 307eedaa75ab11df7076815d10b39c23ab610e36 (diff) | |
download | sdk-794cb8d02a94610dda1ebef5f0d72fef345b3894.zip sdk-794cb8d02a94610dda1ebef5f0d72fef345b3894.tar.gz sdk-794cb8d02a94610dda1ebef5f0d72fef345b3894.tar.bz2 |
Merge "SDK repository: support for source packages. Do not merge." into tools_r14
Diffstat (limited to 'sdkmanager')
20 files changed, 750 insertions, 66 deletions
diff --git a/sdkmanager/app/tests/com/android/sdkmanager/MainTest.java b/sdkmanager/app/tests/com/android/sdkmanager/MainTest.java index 19056b7..c0a75c1 100644 --- a/sdkmanager/app/tests/com/android/sdkmanager/MainTest.java +++ b/sdkmanager/app/tests/com/android/sdkmanager/MainTest.java @@ -127,7 +127,8 @@ public class MainTest extends SdkManagerTestCase { "doc", "sample", "add-on", - "extra" + "extra", + "source" }; Set<String> expectedSet = new TreeSet<String>(Arrays.asList(expectedValues)); diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java index bb7619f..c33fba9 100644 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java @@ -168,7 +168,10 @@ public final class SdkConstants { public final static String FD_RESOURCES = "res"; //$NON-NLS-1$ /** Assets folder name, i.e. "assets" */ public final static String FD_ASSETS = "assets"; //$NON-NLS-1$ - /** Default source folder name, i.e. "src" */ + /** Default source folder name in an SDK project, i.e. "src". + * <p/> + * Note: this is not the same as {@link #FD_PKG_SOURCES} + * which is an SDK sources folder for packages. */ public final static String FD_SOURCES = "src"; //$NON-NLS-1$ /** Default generated source folder name, i.e. "gen" */ public final static String FD_GEN_SOURCES = "gen"; //$NON-NLS-1$ @@ -194,6 +197,11 @@ public final class SdkConstants { public final static String FD_ADDONS = "add-ons"; //$NON-NLS-1$ /** Name of the SDK system-images folder. */ public final static String FD_SYSTEM_IMAGES = "system-images"; //$NON-NLS-1$ + /** Name of the SDK sources folder where source packages are installed. + * <p/> + * Note this is not the same as {@link #FD_SOURCES} which is the folder name where sources + * are installed inside a project. */ + public final static String FD_PKG_SOURCES = "sources"; //$NON-NLS-1$ /** Name of the SDK tools folder. */ public final static String FD_TOOLS = "tools"; //$NON-NLS-1$ /** Name of the SDK platform tools folder. */ diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DocPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DocPackage.java index 2c9317a..ee24d6e 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DocPackage.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/DocPackage.java @@ -211,7 +211,8 @@ public class DocPackage extends Package implements IPackageVersion { @Override
public boolean sameItemAs(Package pkg) {
- // only one doc package so any doc package is the same item.
+ // only one doc package so any doc package is the same item
+ // and we explicitly don't check whether the version is the same.
return pkg instanceof DocPackage;
}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/LocalSdkParser.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/LocalSdkParser.java index 0e7cb3a..4324623 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/LocalSdkParser.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/LocalSdkParser.java @@ -83,7 +83,7 @@ public class LocalSdkParser { ArrayList<Package> packages = new ArrayList<Package>();
HashSet<File> visited = new HashSet<File>();
- monitor.setProgressMax(9);
+ monitor.setProgressMax(10);
File dir = new File(osSdkRoot, SdkConstants.FD_DOCS);
Package pkg = scanDoc(dir, monitor);
@@ -171,12 +171,14 @@ public class LocalSdkParser { monitor.incProgress(1);
scanMissingAddons(sdkManager, visited, packages, monitor);
monitor.incProgress(1);
- scanMissingSamples(osSdkRoot, visited, packages, monitor);
+ scanMissingSamples(sdkManager, visited, packages, monitor);
monitor.incProgress(1);
- scanExtras(osSdkRoot, visited, packages, monitor);
+ scanExtras(sdkManager, visited, packages, monitor);
monitor.incProgress(1);
scanExtrasDirectory(osSdkRoot, visited, packages, monitor);
monitor.incProgress(1);
+ scanSources(sdkManager, visited, packages, monitor);
+ monitor.incProgress(1);
Collections.sort(packages);
@@ -188,11 +190,11 @@ public class LocalSdkParser { * Find any directory in the /extras/vendors/path folders for extra packages.
* This isn't a recursive search.
*/
- private void scanExtras(String osSdkRoot,
+ private void scanExtras(SdkManager sdkManager,
HashSet<File> visited,
ArrayList<Package> packages,
ISdkLog log) {
- File root = new File(osSdkRoot, SdkConstants.FD_EXTRAS);
+ File root = new File(sdkManager.getLocation(), SdkConstants.FD_EXTRAS);
if (!root.isDirectory()) {
// This should not happen. It makes listFiles() return null so let's avoid it.
@@ -256,11 +258,11 @@ public class LocalSdkParser { * <p/>
* The use case is to find samples dirs under /samples when their target isn't loaded.
*/
- private void scanMissingSamples(String osSdkRoot,
+ private void scanMissingSamples(SdkManager sdkManager,
HashSet<File> visited,
ArrayList<Package> packages,
ISdkLog log) {
- File root = new File(osSdkRoot);
+ File root = new File(sdkManager.getLocation());
root = new File(root, SdkConstants.FD_SAMPLES);
if (!root.isDirectory()) {
@@ -369,6 +371,42 @@ public class LocalSdkParser { }
/**
+ * Scan the sources/folders and register valid as well as broken source packages.
+ */
+ private void scanSources(SdkManager sdkManager,
+ HashSet<File> visited,
+ ArrayList<Package> packages,
+ ISdkLog log) {
+ File srcRoot = new File(sdkManager.getLocation(), SdkConstants.FD_PKG_SOURCES);
+
+ File[] subDirs = srcRoot.listFiles();
+ if (subDirs == null) {
+ return;
+ }
+
+ // The sources folder contains a list of platform folders.
+ for (File platformDir : subDirs) {
+ if (platformDir.isDirectory() && !visited.contains(platformDir)) {
+ visited.add(platformDir);
+
+ // Ignore empty directories
+ File[] srcFiles = platformDir.listFiles();
+ if (srcFiles != null && srcFiles.length > 0) {
+ Properties props =
+ parseProperties(new File(platformDir, SdkConstants.FN_SOURCE_PROP));
+
+ try {
+ Package pkg = SourcePackage.create(platformDir, props);
+ packages.add(pkg);
+ } catch (Exception e) {
+ log.error(e, null);
+ }
+ }
+ }
+ }
+ }
+
+ /**
* Try to find a tools package at the given location.
* Returns null if not found.
*/
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/PlatformPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/PlatformPackage.java index 54d6054..270007e 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/PlatformPackage.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/PlatformPackage.java @@ -284,7 +284,7 @@ public class PlatformPackage extends MinToolsPackage implements IPackageVersion, if (pkg instanceof PlatformPackage) {
PlatformPackage newPkg = (PlatformPackage)pkg;
- // check they are the same platform.
+ // check they are the same version.
return newPkg.getVersion().equals(this.getVersion());
}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SamplePackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SamplePackage.java index 822a275..002561e 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SamplePackage.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SamplePackage.java @@ -291,7 +291,7 @@ public class SamplePackage extends MinToolsPackage if (pkg instanceof SamplePackage) {
SamplePackage newPkg = (SamplePackage)pkg;
- // check they are the same platform.
+ // check they are the same version.
return newPkg.getVersion().equals(this.getVersion());
}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkSource.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkSource.java index aeb5cc8..5cc2cce 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkSource.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkSource.java @@ -750,6 +750,8 @@ public abstract class SdkSource implements IDescription, Comparable<SdkSource> { p = new SamplePackage(this, child, nsUri, licenses);
} else if (SdkRepoConstants.NODE_SYSTEM_IMAGE.equals(name)) {
p = new SystemImagePackage(this, child, nsUri, licenses);
+ } else if (SdkRepoConstants.NODE_SOURCE.equals(name)) {
+ p = new SourcePackage(this, child, nsUri, licenses);
}
}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SourcePackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SourcePackage.java new file mode 100755 index 0000000..8b928c7 --- /dev/null +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SourcePackage.java @@ -0,0 +1,309 @@ +/*
+ * 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.
+ */
+
+package com.android.sdklib.internal.repository;
+
+import com.android.annotations.VisibleForTesting;
+import com.android.annotations.VisibleForTesting.Visibility;
+import com.android.sdklib.AndroidVersion;
+import com.android.sdklib.SdkConstants;
+import com.android.sdklib.SdkManager;
+import com.android.sdklib.AndroidVersion.AndroidVersionException;
+import com.android.sdklib.internal.repository.Archive.Arch;
+import com.android.sdklib.internal.repository.Archive.Os;
+import com.android.sdklib.repository.SdkRepoConstants;
+
+import org.w3c.dom.Node;
+
+import java.io.File;
+import java.util.Map;
+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}.
+ * However there is no mandatory dependency that limits installation so this does not
+ * implement {@link IPlatformDependency}.
+ */
+public class SourcePackage extends Package implements IPackageVersion {
+
+ /** The package version, for platform, add-on and doc packages. */
+ private final AndroidVersion mVersion;
+
+ /**
+ * Creates a new source 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.
+ */
+ SourcePackage(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);
+ String codeName = XmlParserUtils.getXmlString(packageNode, SdkRepoConstants.NODE_CODENAME);
+ if (codeName.length() == 0) {
+ codeName = null;
+ }
+ mVersion = new AndroidVersion(apiLevel, codeName);
+ }
+
+ @VisibleForTesting(visibility=Visibility.PRIVATE)
+ protected SourcePackage(
+ AndroidVersion platformVersion,
+ int revision,
+ Properties props) {
+ this(null /*source*/, platformVersion, revision, props);
+ }
+
+ @VisibleForTesting(visibility=Visibility.PRIVATE)
+ protected SourcePackage(
+ SdkSource source,
+ AndroidVersion platformVersion,
+ int revision,
+ Properties props) {
+ super( source, //source
+ props, //properties
+ revision, //revision
+ null, //license
+ null, //description
+ null, //descUrl
+ Os.getCurrentOs(), //archiveOs
+ Arch.getCurrentArch(), //archiveArch
+ null //archiveOsPath
+ );
+ mVersion = platformVersion;
+ }
+
+ /**
+ * Creates either a valid {@link SourcePackage} or a {@link BrokenPackage}.
+ * <p/>
+ * If the source directory contains valid properties, this creates a new {@link SourcePackage}
+ * with the android version listed in the properties.
+ * Otherwise returns a new {@link BrokenPackage} with some explanation on what failed.
+ *
+ * @param srcDir The SDK/sources/android-N folder
+ * @param props The properties located in {@code srcDir} or null if not found.
+ * @return A new {@link SourcePackage} or a new {@link BrokenPackage}.
+ */
+ public static Package create(File srcDir, Properties props) {
+ AndroidVersion version = null;
+ String error = null;
+
+ // Try to load the android version from the sources.props.
+ // If we don't find them, it would explain why this package is broken.
+ if (props == null) {
+ error = String.format("Missing file %1$s", SdkConstants.FN_SOURCE_PROP);
+ } else {
+ try {
+ version = new AndroidVersion(props);
+ // The constructor will extract the revision from the properties
+ // and it will not consider a missing revision as being fatal.
+ return new SourcePackage(version, 0 /*revision*/, props);
+ } catch (AndroidVersionException e) {
+ error = String.format("Invalid file %1$s: %2$s",
+ SdkConstants.FN_SOURCE_PROP,
+ e.getMessage());
+ }
+ }
+
+ if (version == null) {
+ try {
+ // Try to parse the first number out of the platform folder name.
+ // This is just a wild guess in case we can create a broken package using that info.
+ String platform = srcDir.getParentFile().getName();
+ platform = platform.replaceAll("[^0-9]+", " ").trim(); //$NON-NLS-1$ //$NON-NLS-2$
+ int pos = platform.indexOf(' ');
+ if (pos >= 0) {
+ platform = platform.substring(0, pos);
+ }
+ int apiLevel = Integer.parseInt(platform);
+ version = new AndroidVersion(apiLevel, null /*codename*/);
+ } catch (Exception ignore) {
+ }
+ }
+
+ StringBuilder sb = new StringBuilder("Broken Source Package");
+ if (version != null) {
+ sb.append(String.format(", API %1$s", version.getApiString()));
+ }
+
+ String shortDesc = sb.toString();
+
+ if (error != null) {
+ sb.append('\n').append(error);
+ }
+
+ String longDesc = sb.toString();
+
+ return new BrokenPackage(props, shortDesc, longDesc,
+ IMinApiLevelDependency.MIN_API_LEVEL_NOT_SPECIFIED,
+ version==null ? IExactApiLevelDependency.API_LEVEL_INVALID : version.getApiLevel(),
+ srcDir.getAbsolutePath());
+ }
+
+ /**
+ * Save the properties of the current packages in the given {@link Properties} object.
+ * These properties will later be given to a constructor that takes a {@link Properties} object.
+ */
+ @Override
+ void saveProperties(Properties props) {
+ super.saveProperties(props);
+ mVersion.saveProperties(props);
+ }
+
+ /**
+ * Returns the android version of this package.
+ */
+ public AndroidVersion getVersion() {
+ return mVersion;
+ }
+
+ /**
+ * Returns a string identifier to install this package from the command line.
+ * For sources, we use "source-N" where N is the API or the preview codename.
+ * <p/>
+ * {@inheritDoc}
+ */
+ @Override
+ public String installId() {
+ return "source-" + mVersion.getApiString(); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns a description of this package that is suitable for a list display.
+ * <p/>
+ * {@inheritDoc}
+ */
+ @Override
+ public String getListDescription() {
+ if (mVersion.isPreview()) {
+ return String.format("Sources for Android '%1$s' Preview SDK%2$s",
+ mVersion.getCodename(),
+ isObsolete() ? " (Obsolete)" : "");
+ } else {
+ return String.format("Sources for Android SDK%2$s",
+ mVersion.getApiLevel(),
+ isObsolete() ? " (Obsolete)" : "");
+ }
+ }
+
+ /**
+ * Returns a short description for an {@link IDescription}.
+ */
+ @Override
+ public String getShortDescription() {
+ if (mVersion.isPreview()) {
+ return String.format("Sources for Android '%1$s' Preview SDK, revision %2$s%3$s",
+ mVersion.getCodename(),
+ getRevision(),
+ isObsolete() ? " (Obsolete)" : "");
+ } else {
+ return String.format("Sources for Android SDK, API %1$d, revision %2$s%3$s",
+ mVersion.getApiLevel(),
+ getRevision(),
+ isObsolete() ? " (Obsolete)" : "");
+ }
+ }
+
+ /**
+ * Returns a long description for an {@link IDescription}.
+ *
+ * The long description is whatever the XML contains for the {@code description} field,
+ * or the short description if the former is empty.
+ */
+ @Override
+ public String getLongDescription() {
+ String s = getDescription();
+ if (s == null || s.length() == 0) {
+ s = getShortDescription();
+ }
+
+ if (s.indexOf("revision") == -1) {
+ s += String.format("\nRevision %1$d%2$s",
+ getRevision(),
+ isObsolete() ? " (Obsolete)" : "");
+ }
+
+ return s;
+ }
+
+ /**
+ * Computes a potential installation folder if an archive of this package were
+ * to be installed right away in the given SDK root.
+ * <p/>
+ * A sources package is typically installed in SDK/sources/platform.
+ *
+ * @param osSdkRoot The OS path of the SDK root folder.
+ * @param sdkManager An existing SDK manager to list current platforms and addons.
+ * @return A new {@link File} corresponding to the directory to use to install this package.
+ */
+ @Override
+ public File getInstallFolder(String osSdkRoot, SdkManager sdkManager) {
+ File folder = new File(osSdkRoot, SdkConstants.FD_PKG_SOURCES);
+ folder = new File(folder, "android-" + mVersion.getApiString()); //$NON-NLS-1$
+ return folder;
+ }
+
+ @Override
+ public boolean sameItemAs(Package pkg) {
+ if (pkg instanceof SourcePackage) {
+ SourcePackage newPkg = (SourcePackage)pkg;
+
+ // check they are the same version.
+ return getVersion().equals(newPkg.getVersion());
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((mVersion == null) ? 0 : mVersion.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (!(obj instanceof SourcePackage)) {
+ return false;
+ }
+ SourcePackage other = (SourcePackage) obj;
+ if (mVersion == null) {
+ if (other.mVersion != null) {
+ return false;
+ }
+ } else if (!mVersion.equals(other.mVersion)) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SystemImagePackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SystemImagePackage.java index 54775cb..63d7732 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SystemImagePackage.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SystemImagePackage.java @@ -304,7 +304,7 @@ public class SystemImagePackage extends Package if (pkg instanceof SystemImagePackage) {
SystemImagePackage newPkg = (SystemImagePackage)pkg;
- // check they are the same system-image.
+ // check they are the same abi and version.
return getAbi().equals(newPkg.getAbi()) &&
getVersion().equals(newPkg.getVersion());
}
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 015c53a..b7701fe 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/SdkRepoConstants.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/SdkRepoConstants.java @@ -66,6 +66,8 @@ public class SdkRepoConstants extends RepoConstants { public static final String NODE_SAMPLE = "sample"; //$NON-NLS-1$
/** A system-image package. */
public static final String NODE_SYSTEM_IMAGE = "system-image"; //$NON-NLS-1$
+ /** A source package. */
+ public static final String NODE_SOURCE = "source"; //$NON-NLS-1$
/* An included-ABI element for a system-image package. */
public static final String NODE_ABI_INCLUDED = "included-abi"; //$NON-NLS-1$
@@ -84,7 +86,8 @@ public class SdkRepoConstants extends RepoConstants { NODE_PLATFORM_TOOL,
NODE_DOC,
NODE_SAMPLE,
- NODE_EXTRA
+ NODE_EXTRA,
+ NODE_SOURCE,
};
/**
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository-5.xsd b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository-5.xsd index f473ce5..ae8275f 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository-5.xsd +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository-5.xsd @@ -61,6 +61,7 @@ - <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. --> <xsd:element name="sdk-repository" type="sdk:repositoryType" /> @@ -74,6 +75,7 @@ <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" /> @@ -208,6 +210,44 @@ </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" /> + </xsd:all> + </xsd:complexType> + + <!-- The definition of an SDK tool package. --> <xsd:complexType name="toolType" > diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/SdkManagerTestCase.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/SdkManagerTestCase.java index 90a9f9a..3a5de9a 100755 --- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/SdkManagerTestCase.java +++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/SdkManagerTestCase.java @@ -23,6 +23,7 @@ import com.android.sdklib.ISdkLog; import com.android.sdklib.SdkConstants; import com.android.sdklib.SdkManager; import com.android.sdklib.internal.avd.AvdManager; +import com.android.sdklib.io.FileOp; import com.android.sdklib.mock.MockLog; import com.android.sdklib.repository.PkgProps; @@ -134,22 +135,49 @@ public class SdkManagerTestCase extends TestCase { */ private File makeFakeSdk() throws IOException { // First we create a temp file to "reserve" the temp directory name we want to use. - File tmpFile = File.createTempFile( + File sdkDir = File.createTempFile( this.getClass().getSimpleName() + '_' + this.getName(), null); // Then erase the file and make the directory - tmpFile.delete(); - tmpFile.mkdirs(); + sdkDir.delete(); + sdkDir.mkdirs(); AndroidLocation.resetFolder(); - System.setProperty("user.home", tmpFile.getAbsolutePath()); - File addonsDir = new File(tmpFile, SdkConstants.FD_ADDONS); + System.setProperty("user.home", sdkDir.getAbsolutePath()); + File addonsDir = new File(sdkDir, SdkConstants.FD_ADDONS); addonsDir.mkdir(); - File toolsLibEmuDir = new File(tmpFile, SdkConstants.OS_SDK_TOOLS_LIB_FOLDER + "emulator"); + File toolsLibEmuDir = new File(sdkDir, SdkConstants.OS_SDK_TOOLS_LIB_FOLDER + "emulator"); toolsLibEmuDir.mkdirs(); new File(toolsLibEmuDir, "snapshots.img").createNewFile(); - File platformsDir = new File(tmpFile, SdkConstants.FD_PLATFORMS); + File platformsDir = new File(sdkDir, SdkConstants.FD_PLATFORMS); // Creating a fake target here on down + File targetDir = makeFakeTargetInternal(platformsDir); + + File imagesDir = new File(targetDir, "images"); + makeFakeSysImgInternal(imagesDir, SdkConstants.ABI_ARMEABI); + + makeFakeSkinInternal(targetDir); + makeFakeSourceInternal(sdkDir); + return sdkDir; + } + + /** + * Creates the system image folder and places a fake userdata.img in it. + * + * @param systemImage A system image with a valid location. + * @throws IOException if the file fails to be created. + */ + protected void makeSystemImageFolder(ISystemImage systemImage) throws IOException { + File imagesDir = systemImage.getLocation(); + imagesDir.mkdirs(); + + makeFakeSysImgInternal(imagesDir, systemImage.getAbiType()); + } + + //---- + + /** Utility used by {@link #makeFakeSdk()} to create a fake target with API 0, rev 0. */ + private File makeFakeTargetInternal(File platformsDir) throws IOException { File targetDir = new File(platformsDir, "v0_0"); targetDir.mkdirs(); new File(targetDir, SdkConstants.FN_FRAMEWORK_LIBRARY).createNewFile(); @@ -168,35 +196,45 @@ public class SdkManagerTestCase extends TestCase { out.write(SdkManager.PROP_VERSION_SDK + "=0\n"); out.write(SdkManager.PROP_VERSION_CODENAME + "=REL\n"); out.close(); + return targetDir; + } - File imagesDir = new File(targetDir, "images"); + /** Utility to create a fake sys image in the given folder. */ + private void makeFakeSysImgInternal(File imagesDir, String abiType) throws IOException { imagesDir.mkdirs(); new File(imagesDir, "userdata.img").createNewFile(); - File skinsDir = new File(targetDir, "skins"); - File hvgaDir = new File(skinsDir, "HVGA"); - hvgaDir.mkdirs(); - return tmpFile; + File sourceProp = new File(imagesDir, SdkConstants.FN_SOURCE_PROP); + sourceProp.createNewFile(); + FileWriter out = new FileWriter(sourceProp); + out.write(PkgProps.VERSION_API_LEVEL + "=0\n"); + out.write(PkgProps.SYS_IMG_ABI + "=" + abiType + "\n"); + out.close(); } - /** - * Creates the system image folder and places a fake userdata.img in it. - * - * @param systemImage A system image with a valid location. - * @throws IOException if the file fails to be created. - */ - protected void makeSystemImageFolder(ISystemImage systemImage) throws IOException { - File imagesDir = systemImage.getLocation(); - imagesDir.mkdirs(); + /** Utility to make a fake skin for the given target */ + private void makeFakeSkinInternal(File targetDir) { + FileOp.append(targetDir, "skins", "HVGA").mkdirs(); + } - new File(imagesDir, "userdata.img").createNewFile(); + /** Utility to create a fake source with a few files in the given sdk folder. */ + private void makeFakeSourceInternal(File sdkDir) throws IOException { + File sourcesDir = FileOp.append(sdkDir, SdkConstants.FD_PKG_SOURCES, "android-0"); + sourcesDir.mkdirs(); - File sourceProp = new File(imagesDir, SdkConstants.FN_SOURCE_PROP); + File sourceProp = new File(sourcesDir, SdkConstants.FN_SOURCE_PROP); sourceProp.createNewFile(); FileWriter out = new FileWriter(sourceProp); out.write(PkgProps.VERSION_API_LEVEL + "=0\n"); - out.write(PkgProps.SYS_IMG_ABI + "=" + systemImage.getAbiType() + "\n"); out.close(); + + File dir1 = FileOp.append(sourcesDir, "src", "com", "android"); + dir1.mkdirs(); + FileOp.append(dir1, "File1.java").createNewFile(); + FileOp.append(dir1, "File2.java").createNewFile(); + + FileOp.append(sourcesDir, "res", "values").mkdirs(); + FileOp.append(sourcesDir, "res", "values", "styles.xml").createNewFile(); } /** diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/LocalSdkParserTest.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/LocalSdkParserTest.java index 35b56c5..aa503cd 100755 --- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/LocalSdkParserTest.java +++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/LocalSdkParserTest.java @@ -36,7 +36,8 @@ public class LocalSdkParserTest extends SdkManagerTestCase { // a legacy armeabi system image (this is not a separate system image package) assertEquals( - "[SDK Platform Android 0.0, API 0, revision 1]", + "[SDK Platform Android 0.0, API 0, revision 1, " + + "Sources for Android SDK, API 0, revision 0]", Arrays.toString(parser.parseSdk(sdkman.getLocation(), sdkman, monitor))); // Now add a few "platform subfolders" system images and reload the SDK. @@ -52,7 +53,8 @@ public class LocalSdkParserTest extends SdkManagerTestCase { t = sdkman.getTargets()[0]; assertEquals( - "[SDK Platform Android 0.0, API 0, revision 1]", + "[SDK Platform Android 0.0, API 0, revision 1, " + + "Sources for Android SDK, API 0, revision 0]", Arrays.toString(parser.parseSdk(sdkman.getLocation(), sdkman, monitor))); // Now add arm + arm v7a images using the new SDK/system-images. @@ -69,7 +71,8 @@ public class LocalSdkParserTest extends SdkManagerTestCase { assertEquals( "[SDK Platform Android 0.0, API 0, revision 1, " + "ARM EABI System Image, Android API 0, revision 0, " + - "ARM EABI v7a System Image, Android API 0, revision 0]", + "ARM EABI v7a System Image, Android API 0, revision 0, " + + "Sources for Android SDK, API 0, revision 0]", Arrays.toString(parser.parseSdk(sdkman.getLocation(), sdkman, monitor))); // Now add an x86 image using the new SDK/system-images. @@ -83,6 +86,7 @@ public class LocalSdkParserTest extends SdkManagerTestCase { "[SDK Platform Android 0.0, API 0, revision 1, " + "ARM EABI System Image, Android API 0, revision 0, " + "ARM EABI v7a System Image, Android API 0, revision 0, " + + "Sources for Android SDK, API 0, revision 0, " + "Broken Intel x86 Atom System Image, API 0]", Arrays.toString(parser.parseSdk(sdkman.getLocation(), sdkman, monitor))); } diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/MockSourcePackage.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/MockSourcePackage.java new file mode 100755 index 0000000..f45e79a --- /dev/null +++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/MockSourcePackage.java @@ -0,0 +1,50 @@ +/*
+ * 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.
+ */
+
+package com.android.sdklib.internal.repository;
+
+import com.android.sdklib.AndroidVersion;
+
+
+/**
+ * A mock {@link SystemImagePackage} for testing.
+ *
+ * By design, this package contains one and only one archive.
+ */
+public class MockSourcePackage extends SourcePackage {
+ /**
+ * Creates a {@link MockSourcePackage} using the given base platform version
+ * and package revision.
+ *
+ * By design, this package contains one and only one archive.
+ */
+ public MockSourcePackage(AndroidVersion version, int revision) {
+ super(version, revision, null /*props*/);
+ }
+
+ /**
+ * Creates a {@link MockSourcePackage} using the given version,
+ * sdk source and package revision.
+ *
+ * By design, this package contains one and only one archive.
+ */
+ public MockSourcePackage(
+ SdkSource source,
+ AndroidVersion version,
+ int revision) {
+ super(source, version, revision, null /*props*/);
+ }
+}
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/PackageTest.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/PackageTest.java index ab5947e..ab560f6 100755 --- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/PackageTest.java +++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/PackageTest.java @@ -82,7 +82,7 @@ public class PackageTest extends TestCase { } } - public void testCreate() { + public void testCreate() throws Exception { Properties props = createProps(); Package p = new MockPackage( @@ -100,7 +100,7 @@ public class PackageTest extends TestCase { testCreatedPackage(p); } - public void testSaveProperties() { + public void testSaveProperties() throws Exception { Properties props = createProps(); Package p = new MockPackage( diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/SdkRepoSourceTest.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/SdkRepoSourceTest.java index 0db9b31..10330bc 100755 --- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/SdkRepoSourceTest.java +++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/SdkRepoSourceTest.java @@ -561,19 +561,22 @@ public class SdkRepoSourceTest extends TestCase { 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 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 SDK Platform Android Pastry Preview, revision 3\n" +
- "Found Android SDK Tools, revision 1\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\n" +
- "Found A USB Driver package, revision 43 (Obsolete)\n" +
- "Found Android Vendor Extra API Dep package, revision 2 (Obsolete)\n" +
- "Found Samples for SDK API 14, revision 24 (Obsolete)\n" +
- "Found ARM EABI System Image, Android API 42, revision 12\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\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\n" +
+ "Found A USB Driver package, revision 43 (Obsolete)\n" +
+ "Found Android Vendor Extra API Dep package, revision 2 (Obsolete)\n" +
+ "Found Samples for SDK API 14, revision 24 (Obsolete)\n" +
+ "Found ARM EABI 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());
@@ -585,7 +588,7 @@ public class SdkRepoSourceTest extends TestCase { // Packages' sorting order, e.g. all platforms are sorted by descending API level, etc.
Package[] pkgs = mSource.getPackages();
- assertEquals(14, pkgs.length);
+ assertEquals(17, pkgs.length);
for (Package p : pkgs) {
assertTrue(p.getArchives().length >= 1);
}
@@ -651,6 +654,35 @@ public class SdkRepoSourceTest extends TestCase { "[[v8/veggies_8.jar, readme.txt, dir1/dir 2 with space/mylib.jar], " +
"[]]",
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.getVersion().getApiString();
+ String a = sip.getAbi();
+ sysImgVersionAbi.add(String.format("%1$s %2$s", v, a)); //$NON-NLS-1$
+ }
+ }
+ assertEquals(
+ "[42 armeabi, " +
+ "2 x86, " +
+ "2 armeabi-v7a]",
+ 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.getVersion().getApiString();
+ sourceVersion.add(v);
+ }
+ }
+ assertEquals(
+ "[42, 2, 1]",
+ Arrays.toString(sourceVersion.toArray()));
}
/**
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/SourcePackageTest.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/SourcePackageTest.java new file mode 100755 index 0000000..2558546 --- /dev/null +++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/SourcePackageTest.java @@ -0,0 +1,120 @@ +/* + * 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. + */ + +package com.android.sdklib.internal.repository; + +import com.android.sdklib.AndroidVersion; +import com.android.sdklib.AndroidVersion.AndroidVersionException; +import com.android.sdklib.internal.repository.Archive.Arch; +import com.android.sdklib.internal.repository.Archive.Os; +import com.android.sdklib.repository.PkgProps; + +import java.util.Properties; + +public class SourcePackageTest extends PackageTest { + + /** + * SourcePackageTest implicitly generates a local archive wrapper + * that matches the current platform OS and architecture. Since this + * is not convenient for testing, this class overrides it to always + * create archives for any OS and any architecture. + */ + private static class SourcePackageFakeArchive extends SourcePackage { + protected SourcePackageFakeArchive( + AndroidVersion platformVersion, + int revision, + Properties props) { + super(platformVersion, revision, props); + } + + @Override + protected Archive[] initializeArchives( + Properties props, + Os archiveOs, + Arch archiveArch, + String archiveOsPath) { + assert archiveOs == Os.getCurrentOs(); + assert archiveArch == Arch.getCurrentArch(); + return super.initializeArchives(props, Os.ANY, Arch.ANY, LOCAL_ARCHIVE_PATH); + } + } + + private SourcePackage createSourcePackageTest(Properties props) throws AndroidVersionException { + SourcePackage p = new SourcePackageFakeArchive( + new AndroidVersion(props), + 1 /*revision*/, + props); + return p; + } + + @Override + protected Properties createProps() { + Properties props = super.createProps(); + + // SourcePackageTest properties + props.setProperty(PkgProps.VERSION_API_LEVEL, "5"); + + return props; + } + + protected void testCreatedSourcePackageTest(SourcePackage p) { + super.testCreatedPackage(p); + + // SourcePackageTest properties + assertEquals("API 5", p.getVersion().toString()); + } + + // ---- + + @Override + public final void testCreate() throws Exception { + Properties props = createProps(); + SourcePackage p = createSourcePackageTest(props); + + testCreatedSourcePackageTest(p); + } + + @Override + public void testSaveProperties() throws Exception { + Properties props = createProps(); + SourcePackage p = createSourcePackageTest(props); + + Properties props2 = new Properties(); + p.saveProperties(props2); + + assertEquals(props2, props); + } + + public void testSameItemAs() throws Exception { + Properties props1 = createProps(); + SourcePackage p1 = createSourcePackageTest(props1); + assertTrue(p1.sameItemAs(p1)); + + // different version + Properties props2 = new Properties(props1); + props2.setProperty(PkgProps.VERSION_API_LEVEL, "6"); + SourcePackage p2 = createSourcePackageTest(props2); + assertFalse(p1.sameItemAs(p2)); + assertFalse(p2.sameItemAs(p1)); + } + + public void testInstallId() throws Exception { + Properties props = createProps(); + SourcePackage p = createSourcePackageTest(props); + + assertEquals("source-5", p.installId()); + } +} diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/SystemImagePackageTest.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/SystemImagePackageTest.java index 9bc47d3..14a8c3b 100755 --- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/SystemImagePackageTest.java +++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/SystemImagePackageTest.java @@ -17,6 +17,7 @@ package com.android.sdklib.internal.repository; import com.android.sdklib.AndroidVersion; +import com.android.sdklib.AndroidVersion.AndroidVersionException; import com.android.sdklib.internal.repository.Archive.Arch; import com.android.sdklib.internal.repository.Archive.Os; import com.android.sdklib.repository.PkgProps; @@ -52,9 +53,10 @@ public class SystemImagePackageTest extends PackageTest { } } - private SystemImagePackage createSystemImagePackage(Properties props) { + private SystemImagePackage createSystemImagePackage(Properties props) + throws AndroidVersionException { SystemImagePackage p = new SysImgPackageFakeArchive( - new AndroidVersion(5 /*apiLevel*/, null /*codename*/), + new AndroidVersion(props), 1 /*revision*/, null /*abi*/, props); @@ -83,7 +85,7 @@ public class SystemImagePackageTest extends PackageTest { // ---- @Override - public final void testCreate() { + public final void testCreate() throws Exception { Properties props = createProps(); SystemImagePackage p = createSystemImagePackage(props); @@ -91,7 +93,7 @@ public class SystemImagePackageTest extends PackageTest { } @Override - public void testSaveProperties() { + public void testSaveProperties() throws Exception { Properties props = createProps(); SystemImagePackage p = createSystemImagePackage(props); @@ -101,7 +103,7 @@ public class SystemImagePackageTest extends PackageTest { assertEquals(props2, props); } - public void testSameItemAs() { + public void testSameItemAs() throws Exception { Properties props1 = createProps(); SystemImagePackage p1 = createSystemImagePackage(props1); assertTrue(p1.sameItemAs(p1)); @@ -113,7 +115,7 @@ public class SystemImagePackageTest extends PackageTest { assertFalse(p1.sameItemAs(p2)); assertFalse(p2.sameItemAs(p1)); - // different vendor, different version + // different abi, different version props2.setProperty(PkgProps.VERSION_API_LEVEL, "6"); p2 = createSystemImagePackage(props2); assertFalse(p1.sameItemAs(p2)); @@ -123,11 +125,11 @@ public class SystemImagePackageTest extends PackageTest { Properties props3 = new Properties(props1); props3.setProperty(PkgProps.VERSION_API_LEVEL, "6"); SystemImagePackage p3 = createSystemImagePackage(props3); - assertTrue(p1.sameItemAs(p3)); - assertTrue(p3.sameItemAs(p1)); + assertFalse(p1.sameItemAs(p3)); + assertFalse(p3.sameItemAs(p1)); } - public void testInstallId() { + public void testInstallId() throws Exception { Properties props = createProps(); SystemImagePackage p = createSystemImagePackage(props); 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 a32751e..4db8b33 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 @@ -73,6 +73,18 @@ </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> @@ -140,6 +152,18 @@ </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> @@ -317,4 +341,16 @@ </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/icons/source_pkg_16.png b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/icons/source_pkg_16.png Binary files differnew file mode 100755 index 0000000..9992cda --- /dev/null +++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/icons/source_pkg_16.png |