diff options
author | Raphael <raphael@google.com> | 2011-09-18 11:35:52 -0700 |
---|---|---|
committer | Raphael <raphael@google.com> | 2011-09-18 14:22:06 -0700 |
commit | 1b0a26cee7812957706eae92573cc9a2f776ce23 (patch) | |
tree | f5dfdd37874c2f97f7c64bdb2f269c8f2faeeaf1 | |
parent | 9b634c7d1d288d97c25d5d38355139da5f46e0d4 (diff) | |
download | sdk-1b0a26cee7812957706eae92573cc9a2f776ce23.zip sdk-1b0a26cee7812957706eae92573cc9a2f776ce23.tar.gz sdk-1b0a26cee7812957706eae92573cc9a2f776ce23.tar.bz2 |
SDK Manager: Extract all source.properties constants.
The SDK Manager uses specific constants to save
local source.properties files in installed packages.
This moves all these constants in a common constant
class and makes it explicit that these constants
form some kind of API that can't be changed arbitrarily.
Change-Id: I005f13f53768fbcc677edf94be0b4c13e19e3ec8
21 files changed, 203 insertions, 139 deletions
diff --git a/sdkmanager/app/src/com/android/sdkmanager/internal/repository/AboutPage.java b/sdkmanager/app/src/com/android/sdkmanager/internal/repository/AboutPage.java index ac4a1ea..ba552e3 100755 --- a/sdkmanager/app/src/com/android/sdkmanager/internal/repository/AboutPage.java +++ b/sdkmanager/app/src/com/android/sdkmanager/internal/repository/AboutPage.java @@ -18,10 +18,10 @@ package com.android.sdkmanager.internal.repository; import com.android.sdklib.SdkConstants;
-import com.android.sdklib.internal.repository.Package;
+import com.android.sdklib.repository.PkgProps;
import com.android.sdklib.repository.SdkAddonConstants;
import com.android.sdklib.repository.SdkRepoConstants;
-import com.android.sdkmanager.*;
+import com.android.sdkmanager.Main;
import com.android.sdkuilib.internal.repository.UpdaterPage;
import org.eclipse.swt.SWT;
@@ -112,7 +112,7 @@ public class AboutPage extends UpdaterPage { sourceProp = new File(toolsdir, SdkConstants.FN_SOURCE_PROP);
}
p.load(new FileInputStream(sourceProp));
- String revision = p.getProperty(Package.PROP_REVISION);
+ String revision = p.getProperty(PkgProps.PKG_REVISION);
if (revision != null) {
return revision;
}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/AndroidVersion.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/AndroidVersion.java index 9109fe2..903e1ad 100644 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/AndroidVersion.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/AndroidVersion.java @@ -16,8 +16,7 @@ package com.android.sdklib; -import com.android.annotations.VisibleForTesting; -import com.android.annotations.VisibleForTesting.Visibility; +import com.android.sdklib.repository.PkgProps; import java.util.Properties; @@ -38,15 +37,9 @@ import java.util.Properties; * with {@link #getApiLevel()} and {@link #getCodename()}. * <p/> * For generic UI display of the API version, {@link #getApiString()} is to be used. - * */ public final class AndroidVersion implements Comparable<AndroidVersion> { - @VisibleForTesting(visibility=Visibility.PRIVATE) - public static final String PROP_API_LEVEL = "AndroidVersion.ApiLevel"; //$NON-NLS-1$ - @VisibleForTesting(visibility=Visibility.PRIVATE) - public static final String PROP_CODENAME = "AndroidVersion.CodeName"; //$NON-NLS-1$ - private final int mApiLevel; private final String mCodename; @@ -82,9 +75,9 @@ public final class AndroidVersion implements Comparable<AndroidVersion> { mApiLevel = defaultApiLevel; mCodename = defaultCodeName; } else { - mApiLevel = Integer.parseInt(properties.getProperty(PROP_API_LEVEL, + mApiLevel = Integer.parseInt(properties.getProperty(PkgProps.VERSION_API_LEVEL, Integer.toString(defaultApiLevel))); - mCodename = properties.getProperty(PROP_CODENAME, defaultCodeName); + mCodename = properties.getProperty(PkgProps.VERSION_CODENAME, defaultCodeName); } } @@ -98,11 +91,11 @@ public final class AndroidVersion implements Comparable<AndroidVersion> { public AndroidVersion(Properties properties) throws AndroidVersionException { Exception error = null; - String apiLevel = properties.getProperty(PROP_API_LEVEL, null /*defaultValue*/); + String apiLevel = properties.getProperty(PkgProps.VERSION_API_LEVEL, null/*defaultValue*/); if (apiLevel != null) { try { mApiLevel = Integer.parseInt(apiLevel); - mCodename = properties.getProperty(PROP_CODENAME, null /*defaultValue*/); + mCodename = properties.getProperty(PkgProps.VERSION_CODENAME, null/*defaultValue*/); return; } catch (NumberFormatException e) { error = e; @@ -110,13 +103,13 @@ public final class AndroidVersion implements Comparable<AndroidVersion> { } // reaching here means the Properties object did not contain the apiLevel which is required. - throw new AndroidVersionException(PROP_API_LEVEL + " not found!", error); + throw new AndroidVersionException(PkgProps.VERSION_API_LEVEL + " not found!", error); } public void saveProperties(Properties props) { - props.setProperty(PROP_API_LEVEL, Integer.toString(mApiLevel)); + props.setProperty(PkgProps.VERSION_API_LEVEL, Integer.toString(mApiLevel)); if (mCodename != null) { - props.setProperty(PROP_CODENAME, mCodename); + props.setProperty(PkgProps.VERSION_CODENAME, mCodename); } } diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java index 61499f4..4818853 100644 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java @@ -24,6 +24,7 @@ import com.android.prefs.AndroidLocation.AndroidLocationException; import com.android.sdklib.AndroidVersion.AndroidVersionException; import com.android.sdklib.ISystemImage.LocationType; import com.android.sdklib.internal.project.ProjectProperties; +import com.android.sdklib.repository.PkgProps; import com.android.util.Pair; import java.io.File; @@ -270,11 +271,7 @@ public class SdkManager { * version defined. * * @return The greatest {@link LayoutlibVersion} or null if none is found. - * @deprecated This helper method is provisional. I am marking it as deprecated for - * lack of a better tag (e.g. "@future"?). It's deprecated in the sense that - * we're not using it yet and should NOT be considered a stable API yet. - * We'll probably need to revisit it when the want to actually use it. - * If it's convenient as-is then this deprecation message shall be removed. + * @deprecated This does NOT solve the right problem and will be changed in Tools R15. */ @Deprecated public LayoutlibVersion getMaxLayoutlibVersion() { @@ -408,14 +405,14 @@ public class SdkManager { if (sourceProp != null) { try { - revision = Integer.parseInt(sourceProp.get("Pkg.Revision")); //$NON-NLS-1$ + revision = Integer.parseInt(sourceProp.get(PkgProps.PKG_REVISION)); } catch (NumberFormatException e) { // do nothing, we'll keep the default value of 1. } try { - String propApi = sourceProp.get("Layoutlib.Api"); //$NON-NLS-1$ - String propRev = sourceProp.get("Layoutlib.Revision"); //$NON-NLS-1$ + String propApi = sourceProp.get(PkgProps.LAYOUTLIB_API); + String propRev = sourceProp.get(PkgProps.LAYOUTLIB_REV); int llApi = propApi == null ? LayoutlibVersion.NOT_SPECIFIED : Integer.parseInt(propApi); int llRev = propRev == null ? LayoutlibVersion.NOT_SPECIFIED : diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonPackage.java index 93a6473..98c39be 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonPackage.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonPackage.java @@ -25,6 +25,7 @@ import com.android.sdklib.SdkManager; import com.android.sdklib.IAndroidTarget.IOptionalLibrary;
import com.android.sdklib.internal.repository.Archive.Arch;
import com.android.sdklib.internal.repository.Archive.Os;
+import com.android.sdklib.repository.PkgProps;
import com.android.sdklib.repository.SdkRepoConstants;
import com.android.util.Pair;
@@ -42,9 +43,6 @@ import java.util.Properties; public class AddonPackage extends Package
implements IPackageVersion, IPlatformDependency, IExactApiLevelDependency, ILayoutlibVersion {
- private static final String PROP_NAME = "Addon.Name"; //$NON-NLS-1$
- private static final String PROP_VENDOR = "Addon.Vendor"; //$NON-NLS-1$
-
private final String mVendor;
private final String mName;
private final AndroidVersion mVersion;
@@ -236,10 +234,10 @@ public class AddonPackage extends Package mLayoutlibVersion.saveProperties(props);
if (mName != null) {
- props.setProperty(PROP_NAME, mName);
+ props.setProperty(PkgProps.ADDON_NAME, mName);
}
if (mVendor != null) {
- props.setProperty(PROP_VENDOR, mVendor);
+ props.setProperty(PkgProps.ADDON_VENDOR, mVendor);
}
}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ExtraPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ExtraPackage.java index 99cfbb1..698861a 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ExtraPackage.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ExtraPackage.java @@ -23,6 +23,7 @@ import com.android.sdklib.SdkConstants; import com.android.sdklib.SdkManager;
import com.android.sdklib.internal.repository.Archive.Arch;
import com.android.sdklib.internal.repository.Archive.Os;
+import com.android.sdklib.repository.PkgProps;
import com.android.sdklib.repository.RepoConstants;
import org.w3c.dom.Node;
@@ -40,17 +41,6 @@ import java.util.regex.Pattern; public class ExtraPackage extends MinToolsPackage
implements IMinApiLevelDependency {
- @VisibleForTesting(visibility=Visibility.PRIVATE)
- public static final String PROP_PATH = "Extra.Path"; //$NON-NLS-1$
- @VisibleForTesting(visibility=Visibility.PRIVATE)
- public static final String PROP_OLD_PATHS = "Extra.OldPaths"; //$NON-NLS-1$
- @VisibleForTesting(visibility=Visibility.PRIVATE)
- public static final String PROP_VENDOR = "Extra.Vendor"; //$NON-NLS-1$
- @VisibleForTesting(visibility=Visibility.PRIVATE)
- public static final String PROP_MIN_API_LEVEL = "Extra.MinApiLevel"; //$NON-NLS-1$
- @VisibleForTesting(visibility=Visibility.PRIVATE)
- public static final String PROP_PROJECT_FILES = "Extra.ProjectFiles"; //$NON-NLS-1$
-
/**
* The vendor folder name. It must be a non-empty single-segment path.
* <p/>
@@ -202,17 +192,19 @@ public class ExtraPackage extends MinToolsPackage // exist prior to schema repo-v3 and tools r8, which means we need to cope with a
// lack of it when reading back old local repositories. In this case we allow an
// empty string.
- mVendor = vendor != null ? vendor : getProperty(props, PROP_VENDOR, "");
+ mVendor = vendor != null ? vendor : getProperty(props, PkgProps.EXTRA_VENDOR, "");
// The path argument comes before whatever could be in the properties
- mPath = path != null ? path : getProperty(props, PROP_PATH, path);
+ mPath = path != null ? path : getProperty(props, PkgProps.EXTRA_PATH, path);
- mOldPaths = getProperty(props, PROP_OLD_PATHS, null);
+ mOldPaths = getProperty(props, PkgProps.EXTRA_OLD_PATHS, null);
mMinApiLevel = Integer.parseInt(
- getProperty(props, PROP_MIN_API_LEVEL, Integer.toString(MIN_API_LEVEL_NOT_SPECIFIED)));
+ getProperty(props,
+ PkgProps.EXTRA_MIN_API_LEVEL,
+ Integer.toString(MIN_API_LEVEL_NOT_SPECIFIED)));
- String projectFiles = getProperty(props, PROP_PROJECT_FILES, null);
+ String projectFiles = getProperty(props, PkgProps.EXTRA_PROJECT_FILES, null);
ArrayList<String> filePaths = new ArrayList<String>();
if (projectFiles != null && projectFiles.length() > 0) {
for (String filePath : projectFiles.split(Pattern.quote(File.pathSeparator))) {
@@ -233,13 +225,13 @@ public class ExtraPackage extends MinToolsPackage void saveProperties(Properties props) {
super.saveProperties(props);
- props.setProperty(PROP_PATH, mPath);
+ props.setProperty(PkgProps.EXTRA_PATH, mPath);
if (mVendor != null) {
- props.setProperty(PROP_VENDOR, mVendor);
+ props.setProperty(PkgProps.EXTRA_VENDOR, mVendor);
}
if (getMinApiLevel() != MIN_API_LEVEL_NOT_SPECIFIED) {
- props.setProperty(PROP_MIN_API_LEVEL, Integer.toString(getMinApiLevel()));
+ props.setProperty(PkgProps.EXTRA_MIN_API_LEVEL, Integer.toString(getMinApiLevel()));
}
if (mProjectFiles.length > 0) {
@@ -250,11 +242,11 @@ public class ExtraPackage extends MinToolsPackage }
sb.append(mProjectFiles[i]);
}
- props.setProperty(PROP_PROJECT_FILES, sb.toString());
+ props.setProperty(PkgProps.EXTRA_PROJECT_FILES, sb.toString());
}
if (mOldPaths != null && mOldPaths.length() > 0) {
- props.setProperty(PROP_OLD_PATHS, mOldPaths);
+ props.setProperty(PkgProps.EXTRA_OLD_PATHS, mOldPaths);
}
}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ILayoutlibVersion.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ILayoutlibVersion.java index 829440d..eb57343 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ILayoutlibVersion.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ILayoutlibVersion.java @@ -23,8 +23,6 @@ import com.android.util.Pair; */
public interface ILayoutlibVersion {
- public static final String PROP_LAYOUTLIB_API = "Layoutlib.Api"; //$NON-NLS-1$
- public static final String PROP_LAYOUTLIB_REV = "Layoutlib.Revision"; //$NON-NLS-1$
public static final int LAYOUTLIB_API_NOT_SPECIFIED = 0;
public static final int LAYOUTLIB_REV_NOT_SPECIFIED = 0;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/LayoutlibVersionMixin.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/LayoutlibVersionMixin.java index 32d3ef3..6cbf789 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/LayoutlibVersionMixin.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/LayoutlibVersionMixin.java @@ -16,6 +16,7 @@ package com.android.sdklib.internal.repository;
+import com.android.sdklib.repository.PkgProps;
import com.android.sdklib.repository.RepoConstants;
import com.android.util.Pair;
@@ -64,10 +65,10 @@ public class LayoutlibVersionMixin implements ILayoutlibVersion { */
public LayoutlibVersionMixin(Properties props) {
int layoutlibApi = Integer.parseInt(
- Package.getProperty(props, PROP_LAYOUTLIB_API,
+ Package.getProperty(props, PkgProps.LAYOUTLIB_API,
Integer.toString(LAYOUTLIB_API_NOT_SPECIFIED)));
int layoutlibRev = Integer.parseInt(
- Package.getProperty(props, PROP_LAYOUTLIB_REV,
+ Package.getProperty(props, PkgProps.LAYOUTLIB_REV,
Integer.toString(LAYOUTLIB_REV_NOT_SPECIFIED)));
mLayoutlibVersion = Pair.of(layoutlibApi, layoutlibRev);
}
@@ -77,8 +78,8 @@ public class LayoutlibVersionMixin implements ILayoutlibVersion { */
void saveProperties(Properties props) {
if (mLayoutlibVersion.getFirst().intValue() != LAYOUTLIB_API_NOT_SPECIFIED) {
- props.setProperty(PROP_LAYOUTLIB_API, mLayoutlibVersion.getFirst().toString());
- props.setProperty(PROP_LAYOUTLIB_REV, mLayoutlibVersion.getSecond().toString());
+ props.setProperty(PkgProps.LAYOUTLIB_API, mLayoutlibVersion.getFirst().toString());
+ props.setProperty(PkgProps.LAYOUTLIB_REV, mLayoutlibVersion.getSecond().toString());
}
}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/MinToolsPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/MinToolsPackage.java index 56f6247..351a421 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/MinToolsPackage.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/MinToolsPackage.java @@ -18,6 +18,7 @@ package com.android.sdklib.internal.repository; import com.android.sdklib.internal.repository.Archive.Arch;
import com.android.sdklib.internal.repository.Archive.Os;
+import com.android.sdklib.repository.PkgProps;
import com.android.sdklib.repository.SdkRepoConstants;
import org.w3c.dom.Node;
@@ -30,8 +31,6 @@ import java.util.Properties; */
public abstract class MinToolsPackage extends Package implements IMinToolsDependency {
- static final String PROP_MIN_TOOLS_REV = "Platform.MinToolsRev"; //$NON-NLS-1$
-
/**
* The minimal revision of the tools package required by this extra package, if > 0,
* or {@link #MIN_TOOLS_REV_NOT_SPECIFIED} if there is no such requirement.
@@ -79,7 +78,9 @@ public abstract class MinToolsPackage extends Package implements IMinToolsDepend archiveOs, archiveArch, archiveOsPath);
mMinToolsRevision = Integer.parseInt(
- getProperty(props, PROP_MIN_TOOLS_REV, Integer.toString(MIN_TOOLS_REV_NOT_SPECIFIED)));
+ getProperty(props,
+ PkgProps.MIN_TOOLS_REV,
+ Integer.toString(MIN_TOOLS_REV_NOT_SPECIFIED)));
}
/**
@@ -95,7 +96,8 @@ public abstract class MinToolsPackage extends Package implements IMinToolsDepend super.saveProperties(props);
if (getMinToolsRevision() != MIN_TOOLS_REV_NOT_SPECIFIED) {
- props.setProperty(PROP_MIN_TOOLS_REV, Integer.toString(getMinToolsRevision()));
+ props.setProperty(PkgProps.MIN_TOOLS_REV,
+ Integer.toString(getMinToolsRevision()));
}
}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Package.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Package.java index 0e46a76..c5a176f 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Package.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Package.java @@ -22,6 +22,7 @@ import com.android.sdklib.AndroidVersion; import com.android.sdklib.SdkManager;
import com.android.sdklib.internal.repository.Archive.Arch;
import com.android.sdklib.internal.repository.Archive.Os;
+import com.android.sdklib.repository.PkgProps;
import com.android.sdklib.repository.SdkRepoConstants;
import org.w3c.dom.Node;
@@ -45,15 +46,6 @@ import java.util.Properties; */
public abstract class Package implements IDescription, Comparable<Package> {
- public static final String PROP_REVISION = "Pkg.Revision"; //$NON-NLS-1$
- public static final String PROP_LICENSE = "Pkg.License"; //$NON-NLS-1$
- public static final String PROP_DESC = "Pkg.Desc"; //$NON-NLS-1$
- public static final String PROP_DESC_URL = "Pkg.DescUrl"; //$NON-NLS-1$
- public static final String PROP_RELEASE_NOTE = "Pkg.RelNote"; //$NON-NLS-1$
- public static final String PROP_RELEASE_URL = "Pkg.RelNoteUrl"; //$NON-NLS-1$
- public static final String PROP_SOURCE_URL = "Pkg.SourceUrl"; //$NON-NLS-1$
- public static final String PROP_OBSOLETE = "Pkg.Obsolete"; //$NON-NLS-1$
-
private final int mRevision;
private final String mObsolete;
private final String mLicense;
@@ -133,18 +125,19 @@ public abstract class Package implements IDescription, Comparable<Package> { descUrl = "";
}
- mRevision = Integer.parseInt(getProperty(props, PROP_REVISION, Integer.toString(revision)));
- mLicense = getProperty(props, PROP_LICENSE, license);
- mDescription = getProperty(props, PROP_DESC, description);
- mDescUrl = getProperty(props, PROP_DESC_URL, descUrl);
- mReleaseNote = getProperty(props, PROP_RELEASE_NOTE, "");
- mReleaseUrl = getProperty(props, PROP_RELEASE_URL, "");
- mObsolete = getProperty(props, PROP_OBSOLETE, null);
+ mRevision = Integer.parseInt(
+ getProperty(props, PkgProps.PKG_REVISION, Integer.toString(revision)));
+ mLicense = getProperty(props, PkgProps.PKG_LICENSE, license);
+ mDescription = getProperty(props, PkgProps.PKG_DESC, description);
+ mDescUrl = getProperty(props, PkgProps.PKG_DESC_URL, descUrl);
+ mReleaseNote = getProperty(props, PkgProps.PKG_RELEASE_NOTE, "");
+ mReleaseUrl = getProperty(props, PkgProps.PKG_RELEASE_URL, "");
+ mObsolete = getProperty(props, PkgProps.PKG_OBSOLETE, null);
// If source is null and we can find a source URL in the properties, generate
// a dummy source just to store the URL. This allows us to easily remember where
// a package comes from.
- String srcUrl = getProperty(props, PROP_SOURCE_URL, null);
+ String srcUrl = getProperty(props, PkgProps.PKG_SOURCE_URL, null);
if (props != null && source == null && srcUrl != null) {
if (this instanceof AddonPackage) {
source = new SdkAddonSource(srcUrl, null /*uiName*/);
@@ -205,30 +198,30 @@ public abstract class Package implements IDescription, Comparable<Package> { * These properties will later be give the constructor that takes a {@link Properties} object.
*/
void saveProperties(Properties props) {
- props.setProperty(PROP_REVISION, Integer.toString(mRevision));
+ props.setProperty(PkgProps.PKG_REVISION, Integer.toString(mRevision));
if (mLicense != null && mLicense.length() > 0) {
- props.setProperty(PROP_LICENSE, mLicense);
+ props.setProperty(PkgProps.PKG_LICENSE, mLicense);
}
if (mDescription != null && mDescription.length() > 0) {
- props.setProperty(PROP_DESC, mDescription);
+ props.setProperty(PkgProps.PKG_DESC, mDescription);
}
if (mDescUrl != null && mDescUrl.length() > 0) {
- props.setProperty(PROP_DESC_URL, mDescUrl);
+ props.setProperty(PkgProps.PKG_DESC_URL, mDescUrl);
}
if (mReleaseNote != null && mReleaseNote.length() > 0) {
- props.setProperty(PROP_RELEASE_NOTE, mReleaseNote);
+ props.setProperty(PkgProps.PKG_RELEASE_NOTE, mReleaseNote);
}
if (mReleaseUrl != null && mReleaseUrl.length() > 0) {
- props.setProperty(PROP_RELEASE_URL, mReleaseUrl);
+ props.setProperty(PkgProps.PKG_RELEASE_URL, mReleaseUrl);
}
if (mObsolete != null) {
- props.setProperty(PROP_OBSOLETE, mObsolete);
+ props.setProperty(PkgProps.PKG_OBSOLETE, mObsolete);
}
if (mSource != null) {
- props.setProperty(PROP_SOURCE_URL, mSource.getUrl());
+ props.setProperty(PkgProps.PKG_SOURCE_URL, mSource.getUrl());
}
}
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 606682d..54d6054 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 @@ -24,6 +24,7 @@ import com.android.sdklib.SdkConstants; import com.android.sdklib.SdkManager;
import com.android.sdklib.internal.repository.Archive.Arch;
import com.android.sdklib.internal.repository.Archive.Os;
+import com.android.sdklib.repository.PkgProps;
import com.android.sdklib.repository.SdkRepoConstants;
import com.android.util.Pair;
@@ -38,9 +39,6 @@ import java.util.Properties; */
public class PlatformPackage extends MinToolsPackage implements IPackageVersion, ILayoutlibVersion {
- public static final String PROP_VERSION = "Platform.Version"; //$NON-NLS-1$
- public static final String PROP_INCLUDED_ABI = "Platform.Included.Abi"; //$NON-NLS-1$
-
/** The package version, for platform, add-on and doc packages. */
private final AndroidVersion mVersion;
@@ -114,7 +112,7 @@ public class PlatformPackage extends MinToolsPackage implements IPackageVersion, mVersion = target.getVersion();
mVersionName = target.getVersionName();
mLayoutlibVersion = new LayoutlibVersionMixin(props);
- mIncludedAbi = props == null ? null : props.getProperty(PROP_INCLUDED_ABI);
+ mIncludedAbi = props == null ? null : props.getProperty(PkgProps.PLATFORM_INCLUDED_ABI);
}
/**
@@ -129,11 +127,11 @@ public class PlatformPackage extends MinToolsPackage implements IPackageVersion, mLayoutlibVersion.saveProperties(props);
if (mVersionName != null) {
- props.setProperty(PROP_VERSION, mVersionName);
+ props.setProperty(PkgProps.PLATFORM_VERSION, mVersionName);
}
if (mIncludedAbi != null) {
- props.setProperty(PROP_INCLUDED_ABI, mIncludedAbi);
+ props.setProperty(PkgProps.PLATFORM_INCLUDED_ABI, mIncludedAbi);
}
}
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 e2144af..822a275 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 @@ -23,6 +23,7 @@ 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.PkgProps;
import com.android.sdklib.repository.SdkRepoConstants;
import org.w3c.dom.Node;
@@ -43,8 +44,6 @@ import java.util.Properties; public class SamplePackage extends MinToolsPackage
implements IPackageVersion, IMinApiLevelDependency {
- private static final String PROP_MIN_API_LEVEL = "Sample.MinApiLevel"; //$NON-NLS-1$
-
/** The matching platform version. */
private final AndroidVersion mVersion;
@@ -110,7 +109,9 @@ public class SamplePackage extends MinToolsPackage mVersion = target.getVersion();
mMinApiLevel = Integer.parseInt(
- getProperty(props, PROP_MIN_API_LEVEL, Integer.toString(MIN_API_LEVEL_NOT_SPECIFIED)));
+ getProperty(props,
+ PkgProps.SAMPLE_MIN_API_LEVEL,
+ Integer.toString(MIN_API_LEVEL_NOT_SPECIFIED)));
}
/**
@@ -144,7 +145,9 @@ public class SamplePackage extends MinToolsPackage mVersion = new AndroidVersion(props);
mMinApiLevel = Integer.parseInt(
- getProperty(props, PROP_MIN_API_LEVEL, Integer.toString(MIN_API_LEVEL_NOT_SPECIFIED)));
+ getProperty(props,
+ PkgProps.SAMPLE_MIN_API_LEVEL,
+ Integer.toString(MIN_API_LEVEL_NOT_SPECIFIED)));
}
/**
@@ -158,7 +161,7 @@ public class SamplePackage extends MinToolsPackage mVersion.saveProperties(props);
if (getMinApiLevel() != MIN_API_LEVEL_NOT_SPECIFIED) {
- props.setProperty(PROP_MIN_API_LEVEL, Integer.toString(getMinApiLevel()));
+ props.setProperty(PkgProps.SAMPLE_MIN_API_LEVEL, Integer.toString(getMinApiLevel()));
}
}
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 c81dd45..3ec6c27 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 @@ -24,6 +24,7 @@ import com.android.sdklib.SdkManager; import com.android.sdklib.SystemImage;
import com.android.sdklib.internal.repository.Archive.Arch;
import com.android.sdklib.internal.repository.Archive.Os;
+import com.android.sdklib.repository.PkgProps;
import com.android.sdklib.repository.SdkRepoConstants;
import org.w3c.dom.Node;
@@ -38,9 +39,6 @@ import java.util.Properties; public class SystemImagePackage extends Package
implements IPackageVersion, IPlatformDependency {
- @VisibleForTesting(visibility=Visibility.PRIVATE)
- static final String PROP_ABI = "SystemImage.Abi"; //$NON-NLS-1$
-
/** The package version, for platform, add-on and doc packages. */
private final AndroidVersion mVersion;
@@ -101,7 +99,7 @@ public class SystemImagePackage extends Package );
mVersion = platformVersion;
if (abi == null && props != null) {
- abi = props.getProperty(PROP_ABI);
+ abi = props.getProperty(PkgProps.SYS_IMG_ABI);
}
assert abi != null : "To use this SystemImagePackage constructor you must pass an ABI as a parameter or as a PROP_ABI property";
mAbi = abi;
@@ -155,7 +153,7 @@ public class SystemImagePackage extends Package super.saveProperties(props);
mVersion.saveProperties(props);
- props.setProperty(PROP_ABI, mAbi);
+ props.setProperty(PkgProps.SYS_IMG_ABI, mAbi);
}
/** Returns the ABI of the system-image. Cannot be null nor empty. */
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/PkgProps.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/PkgProps.java new file mode 100755 index 0000000..d16a35f --- /dev/null +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/PkgProps.java @@ -0,0 +1,85 @@ +/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.sdklib.repository;
+
+
+
+/**
+ * Public constants used by the repository when saving {@code source.properties}
+ * files in local packages.
+ * <p/>
+ * These constants are public and part of the SDK Manager public API.
+ * Once published we can't change them arbitrarily since various parts
+ * of our build process depend on them.
+ */
+public class PkgProps {
+
+ // Base Package
+
+ public static final String PKG_REVISION = "Pkg.Revision"; //$NON-NLS-1$
+ public static final String PKG_LICENSE = "Pkg.License"; //$NON-NLS-1$
+ public static final String PKG_DESC = "Pkg.Desc"; //$NON-NLS-1$
+ public static final String PKG_DESC_URL = "Pkg.DescUrl"; //$NON-NLS-1$
+ public static final String PKG_RELEASE_NOTE = "Pkg.RelNote"; //$NON-NLS-1$
+ public static final String PKG_RELEASE_URL = "Pkg.RelNoteUrl"; //$NON-NLS-1$
+ public static final String PKG_SOURCE_URL = "Pkg.SourceUrl"; //$NON-NLS-1$
+ public static final String PKG_OBSOLETE = "Pkg.Obsolete"; //$NON-NLS-1$
+
+ // AndroidVersion
+
+ public static final String VERSION_API_LEVEL = "AndroidVersion.ApiLevel";//$NON-NLS-1$
+ public static final String VERSION_CODENAME = "AndroidVersion.CodeName";//$NON-NLS-1$
+
+ // AddonPackage
+
+ public static final String ADDON_NAME = "Addon.Name"; //$NON-NLS-1$
+ public static final String ADDON_VENDOR = "Addon.Vendor"; //$NON-NLS-1$
+
+ // DocPackage
+
+ // ExtraPackage
+
+ public static final String EXTRA_PATH = "Extra.Path"; //$NON-NLS-1$
+ public static final String EXTRA_OLD_PATHS = "Extra.OldPaths"; //$NON-NLS-1$
+ public static final String EXTRA_VENDOR = "Extra.Vendor"; //$NON-NLS-1$
+ public static final String EXTRA_MIN_API_LEVEL = "Extra.MinApiLevel"; //$NON-NLS-1$
+ public static final String EXTRA_PROJECT_FILES = "Extra.ProjectFiles"; //$NON-NLS-1$
+
+ // ILayoutlibVersion
+
+ public static final String LAYOUTLIB_API = "Layoutlib.Api"; //$NON-NLS-1$
+ public static final String LAYOUTLIB_REV = "Layoutlib.Revision"; //$NON-NLS-1$
+
+ // MinToolsPackage
+
+ public static final String MIN_TOOLS_REV = "Platform.MinToolsRev"; //$NON-NLS-1$
+
+ // PlatformPackage
+
+ 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
+
+ // SamplePackage
+
+ public static final String SAMPLE_MIN_API_LEVEL = "Sample.MinApiLevel"; //$NON-NLS-1$
+
+ // SystemImagePackage
+
+ public static final String SYS_IMG_ABI = "SystemImage.Abi"; //$NON-NLS-1$
+}
diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/ArchiveInstallerTest.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/ArchiveInstallerTest.java index 36209cc..6b7ff11 100755 --- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/ArchiveInstallerTest.java +++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/ArchiveInstallerTest.java @@ -20,6 +20,7 @@ import com.android.sdklib.internal.repository.Archive.Arch; import com.android.sdklib.internal.repository.Archive.Os; import com.android.sdklib.io.IFileOp; import com.android.sdklib.io.MockFileOp; +import com.android.sdklib.repository.PkgProps; import java.io.File; import java.util.Arrays; @@ -344,7 +345,7 @@ public class ArchiveInstallerTest extends TestCase { int revision, int min_platform_tools_rev) { Properties props = new Properties(); - props.setProperty(ExtraPackage.PROP_OLD_PATHS, oldPaths); + props.setProperty(PkgProps.EXTRA_OLD_PATHS, oldPaths); props.setProperty(ToolPackage.PROP_MIN_PLATFORM_TOOLS_REV, Integer.toString((min_platform_tools_rev))); return new MockExtraPackage(source, props, vendor, newPath, revision) { diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/ExtraPackageTest.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/ExtraPackageTest.java index 4f75f63..230e366 100755 --- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/ExtraPackageTest.java +++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/ExtraPackageTest.java @@ -18,6 +18,7 @@ package com.android.sdklib.internal.repository; import com.android.sdklib.internal.repository.Archive.Arch; import com.android.sdklib.internal.repository.Archive.Os; +import com.android.sdklib.repository.PkgProps; import java.io.File; import java.util.Arrays; @@ -49,11 +50,11 @@ public class ExtraPackageTest extends MinToolsPackageTest { Properties props = super.createProps(); // ExtraPackage properties - props.setProperty(ExtraPackage.PROP_VENDOR, "vendor"); - props.setProperty(ExtraPackage.PROP_PATH, "the_path"); - props.setProperty(ExtraPackage.PROP_OLD_PATHS, "old_path1;oldpath2"); - props.setProperty(ExtraPackage.PROP_MIN_API_LEVEL, "11"); - props.setProperty(ExtraPackage.PROP_PROJECT_FILES, + props.setProperty(PkgProps.EXTRA_VENDOR, "vendor"); + props.setProperty(PkgProps.EXTRA_PATH, "the_path"); + props.setProperty(PkgProps.EXTRA_OLD_PATHS, "old_path1;oldpath2"); + props.setProperty(PkgProps.EXTRA_MIN_API_LEVEL, "11"); + props.setProperty(PkgProps.EXTRA_PROJECT_FILES, "path1.jar" + PS + "dir2/jar 2.jar" + PS + "dir/3/path"); return props; @@ -100,34 +101,34 @@ public class ExtraPackageTest extends MinToolsPackageTest { // different vendor, same path Properties props2 = new Properties(props1); - props2.setProperty(ExtraPackage.PROP_VENDOR, "vendor2"); + props2.setProperty(PkgProps.EXTRA_VENDOR, "vendor2"); ExtraPackage p2 = createExtraPackage(props2); assertFalse(p1.sameItemAs(p2)); assertFalse(p2.sameItemAs(p1)); // different vendor, different path - props2.setProperty(ExtraPackage.PROP_PATH, "new_path2"); + props2.setProperty(PkgProps.EXTRA_PATH, "new_path2"); p2 = createExtraPackage(props2); assertFalse(p1.sameItemAs(p2)); assertFalse(p2.sameItemAs(p1)); // same vendor, but single path using the old paths from p1 Properties props3 = new Properties(props1); - props3.setProperty(ExtraPackage.PROP_OLD_PATHS, ""); - props3.setProperty(ExtraPackage.PROP_PATH, "old_path1"); + props3.setProperty(PkgProps.EXTRA_OLD_PATHS, ""); + props3.setProperty(PkgProps.EXTRA_PATH, "old_path1"); ExtraPackage p3 = createExtraPackage(props3); assertTrue(p1.sameItemAs(p3)); assertTrue(p3.sameItemAs(p1)); - props3.setProperty(ExtraPackage.PROP_PATH, "oldpath2"); + props3.setProperty(PkgProps.EXTRA_PATH, "oldpath2"); p3 = createExtraPackage(props3); assertTrue(p1.sameItemAs(p3)); assertTrue(p3.sameItemAs(p1)); // same vendor, different old paths but there's a path=>old_path match Properties props4 = new Properties(props1); - props4.setProperty(ExtraPackage.PROP_OLD_PATHS, "new_path4;new_path5"); - props4.setProperty(ExtraPackage.PROP_PATH, "old_path1"); + props4.setProperty(PkgProps.EXTRA_OLD_PATHS, "new_path4;new_path5"); + props4.setProperty(PkgProps.EXTRA_PATH, "old_path1"); ExtraPackage p4 = createExtraPackage(props4); assertTrue(p1.sameItemAs(p4)); assertTrue(p4.sameItemAs(p1)); @@ -135,8 +136,8 @@ public class ExtraPackageTest extends MinToolsPackageTest { // same vendor, incompatible paths Properties props5 = new Properties(props1); // and the only match is between old_paths, which doesn't count. - props5.setProperty(ExtraPackage.PROP_OLD_PATHS, "old_path1;new_path5"); - props5.setProperty(ExtraPackage.PROP_PATH, "new_path4"); + props5.setProperty(PkgProps.EXTRA_OLD_PATHS, "old_path1;new_path5"); + props5.setProperty(PkgProps.EXTRA_PATH, "new_path4"); ExtraPackage p5 = createExtraPackage(props5); assertFalse(p1.sameItemAs(p5)); assertFalse(p5.sameItemAs(p1)); diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/MinToolsPackageTest.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/MinToolsPackageTest.java index 3426d3a..451bdb2 100755 --- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/MinToolsPackageTest.java +++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/MinToolsPackageTest.java @@ -19,6 +19,7 @@ package com.android.sdklib.internal.repository; import com.android.sdklib.SdkManager; import com.android.sdklib.internal.repository.Archive.Arch; import com.android.sdklib.internal.repository.Archive.Os; +import com.android.sdklib.repository.PkgProps; import java.io.File; import java.util.Properties; @@ -120,7 +121,7 @@ public class MinToolsPackageTest extends PackageTest { Properties props = super.createProps(); // MinToolsPackage properties - props.setProperty(ExtraPackage.PROP_MIN_TOOLS_REV, "3"); + props.setProperty(PkgProps.MIN_TOOLS_REV, "3"); return props; } diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/MockPlatformPackage.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/MockPlatformPackage.java index d358dd4..8313b8a 100755 --- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/MockPlatformPackage.java +++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/MockPlatformPackage.java @@ -17,6 +17,7 @@ package com.android.sdklib.internal.repository;
import com.android.sdklib.IAndroidTarget;
+import com.android.sdklib.repository.PkgProps;
import java.util.Properties;
@@ -65,7 +66,7 @@ public class MockPlatformPackage extends PlatformPackage { private static Properties createProps(int min_tools_rev) {
Properties props = new Properties();
- props.setProperty(PlatformPackage.PROP_MIN_TOOLS_REV, Integer.toString((min_tools_rev)));
+ props.setProperty(PkgProps.MIN_TOOLS_REV, Integer.toString((min_tools_rev)));
return 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 652e154..ab5947e 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 @@ -19,6 +19,7 @@ package com.android.sdklib.internal.repository; import com.android.sdklib.SdkManager; import com.android.sdklib.internal.repository.Archive.Arch; import com.android.sdklib.internal.repository.Archive.Os; +import com.android.sdklib.repository.PkgProps; import java.io.File; import java.util.ArrayList; @@ -130,14 +131,14 @@ public class PackageTest extends TestCase { Properties props = new Properties(); // Package properties - props.setProperty(ExtraPackage.PROP_REVISION, "42"); - props.setProperty(ExtraPackage.PROP_LICENSE, "The License"); - props.setProperty(ExtraPackage.PROP_DESC, "Some description."); - props.setProperty(ExtraPackage.PROP_DESC_URL, "http://description/url"); - props.setProperty(ExtraPackage.PROP_RELEASE_NOTE, "Release Note"); - props.setProperty(ExtraPackage.PROP_RELEASE_URL, "http://release/note"); - props.setProperty(ExtraPackage.PROP_SOURCE_URL, "http://source/url"); - props.setProperty(ExtraPackage.PROP_OBSOLETE, "true"); + props.setProperty(PkgProps.PKG_REVISION, "42"); + props.setProperty(PkgProps.PKG_LICENSE, "The License"); + props.setProperty(PkgProps.PKG_DESC, "Some description."); + props.setProperty(PkgProps.PKG_DESC_URL, "http://description/url"); + props.setProperty(PkgProps.PKG_RELEASE_NOTE, "Release Note"); + props.setProperty(PkgProps.PKG_RELEASE_URL, "http://release/note"); + props.setProperty(PkgProps.PKG_SOURCE_URL, "http://source/url"); + props.setProperty(PkgProps.PKG_OBSOLETE, "true"); return props; } diff --git a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/PlatformPackageTest.java b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/PlatformPackageTest.java index f0d82d6..e657425 100755 --- a/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/PlatformPackageTest.java +++ b/sdkmanager/libs/sdklib/tests/src/com/android/sdklib/internal/repository/PlatformPackageTest.java @@ -16,10 +16,10 @@ package com.android.sdklib.internal.repository; -import com.android.sdklib.AndroidVersion; import com.android.sdklib.IAndroidTarget; 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; @@ -61,9 +61,9 @@ public class PlatformPackageTest extends MinToolsPackageTest { Properties props = super.createProps(); // PlatformPackage properties - props.setProperty(AndroidVersion.PROP_API_LEVEL, "5"); - props.setProperty(PlatformPackage.PROP_VERSION, "android-5"); - props.setProperty(PlatformPackage.PROP_INCLUDED_ABI, "armeabi"); + props.setProperty(PkgProps.VERSION_API_LEVEL, "5"); + props.setProperty(PkgProps.PLATFORM_VERSION, "android-5"); + props.setProperty(PkgProps.PLATFORM_INCLUDED_ABI, "armeabi"); return props; } 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 e40bb7b..9bc47d3 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 @@ -19,6 +19,7 @@ package com.android.sdklib.internal.repository; import com.android.sdklib.AndroidVersion; 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; @@ -65,8 +66,8 @@ public class SystemImagePackageTest extends PackageTest { Properties props = super.createProps(); // SystemImagePackage properties - props.setProperty(AndroidVersion.PROP_API_LEVEL, "5"); - props.setProperty(SystemImagePackage.PROP_ABI, "armeabi-v7a"); + props.setProperty(PkgProps.VERSION_API_LEVEL, "5"); + props.setProperty(PkgProps.SYS_IMG_ABI, "armeabi-v7a"); return props; } @@ -107,20 +108,20 @@ public class SystemImagePackageTest extends PackageTest { // different abi, same version Properties props2 = new Properties(props1); - props2.setProperty(SystemImagePackage.PROP_ABI, "x86"); + props2.setProperty(PkgProps.SYS_IMG_ABI, "x86"); SystemImagePackage p2 = createSystemImagePackage(props2); assertFalse(p1.sameItemAs(p2)); assertFalse(p2.sameItemAs(p1)); // different vendor, different version - props2.setProperty(AndroidVersion.PROP_API_LEVEL, "6"); + props2.setProperty(PkgProps.VERSION_API_LEVEL, "6"); p2 = createSystemImagePackage(props2); assertFalse(p1.sameItemAs(p2)); assertFalse(p2.sameItemAs(p1)); // same abi, different version Properties props3 = new Properties(props1); - props3.setProperty(AndroidVersion.PROP_API_LEVEL, "6"); + props3.setProperty(PkgProps.VERSION_API_LEVEL, "6"); SystemImagePackage p3 = createSystemImagePackage(props3); assertTrue(p1.sameItemAs(p3)); assertTrue(p3.sameItemAs(p1)); diff --git a/sdkmanager/libs/sdkuilib/tests/com/android/sdkuilib/internal/repository/sdkman2/PackagesDiffLogicTest.java b/sdkmanager/libs/sdkuilib/tests/com/android/sdkuilib/internal/repository/sdkman2/PackagesDiffLogicTest.java index 8ce6cc5..5444dff 100755 --- a/sdkmanager/libs/sdkuilib/tests/com/android/sdkuilib/internal/repository/sdkman2/PackagesDiffLogicTest.java +++ b/sdkmanager/libs/sdkuilib/tests/com/android/sdkuilib/internal/repository/sdkman2/PackagesDiffLogicTest.java @@ -17,7 +17,6 @@ package com.android.sdkuilib.internal.repository.sdkman2; import com.android.sdklib.internal.repository.BrokenPackage; -import com.android.sdklib.internal.repository.ExtraPackage; import com.android.sdklib.internal.repository.MockAddonPackage; import com.android.sdklib.internal.repository.MockBrokenPackage; import com.android.sdklib.internal.repository.MockEmptyPackage; @@ -28,6 +27,7 @@ import com.android.sdklib.internal.repository.MockToolPackage; import com.android.sdklib.internal.repository.Package; import com.android.sdklib.internal.repository.SdkRepoSource; import com.android.sdklib.internal.repository.SdkSource; +import com.android.sdklib.repository.PkgProps; import com.android.sdkuilib.internal.repository.MockUpdaterData; import java.util.Properties; @@ -1167,7 +1167,7 @@ public class PackagesDiffLogicTest extends TestCase { // Now, start again, but this time the new package uses the old-path attribute Properties props = new Properties(); - props.setProperty(ExtraPackage.PROP_OLD_PATHS, "old_path1;oldpath2"); + props.setProperty(PkgProps.EXTRA_OLD_PATHS, "old_path1;oldpath2"); m.clear(); m.updateStart(); |