\r
\r
import com.android.sdklib.SdkConstants;\r
-import com.android.sdklib.internal.repository.Package;\r
+import com.android.sdklib.repository.PkgProps;\r
import com.android.sdklib.repository.SdkAddonConstants;\r
import com.android.sdklib.repository.SdkRepoConstants;\r
-import com.android.sdkmanager.*;\r
+import com.android.sdkmanager.Main;\r
import com.android.sdkuilib.internal.repository.UpdaterPage;\r
\r
import org.eclipse.swt.SWT;\r
sourceProp = new File(toolsdir, SdkConstants.FN_SOURCE_PROP);\r
}\r
p.load(new FileInputStream(sourceProp));\r
- String revision = p.getProperty(Package.PROP_REVISION);\r
+ String revision = p.getProperty(PkgProps.PKG_REVISION);\r
if (revision != null) {\r
return revision;\r
}\r
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;
* 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;
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);
}
}
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;
}
// 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);
}
}
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;
* 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() {
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 :
import com.android.sdklib.IAndroidTarget.IOptionalLibrary;\r
import com.android.sdklib.internal.repository.Archive.Arch;\r
import com.android.sdklib.internal.repository.Archive.Os;\r
+import com.android.sdklib.repository.PkgProps;\r
import com.android.sdklib.repository.SdkRepoConstants;\r
import com.android.util.Pair;\r
\r
public class AddonPackage extends Package\r
implements IPackageVersion, IPlatformDependency, IExactApiLevelDependency, ILayoutlibVersion {\r
\r
- private static final String PROP_NAME = "Addon.Name"; //$NON-NLS-1$\r
- private static final String PROP_VENDOR = "Addon.Vendor"; //$NON-NLS-1$\r
-\r
private final String mVendor;\r
private final String mName;\r
private final AndroidVersion mVersion;\r
mLayoutlibVersion.saveProperties(props);\r
\r
if (mName != null) {\r
- props.setProperty(PROP_NAME, mName);\r
+ props.setProperty(PkgProps.ADDON_NAME, mName);\r
}\r
if (mVendor != null) {\r
- props.setProperty(PROP_VENDOR, mVendor);\r
+ props.setProperty(PkgProps.ADDON_VENDOR, mVendor);\r
}\r
}\r
\r
import com.android.sdklib.SdkManager;\r
import com.android.sdklib.internal.repository.Archive.Arch;\r
import com.android.sdklib.internal.repository.Archive.Os;\r
+import com.android.sdklib.repository.PkgProps;\r
import com.android.sdklib.repository.RepoConstants;\r
\r
import org.w3c.dom.Node;\r
public class ExtraPackage extends MinToolsPackage\r
implements IMinApiLevelDependency {\r
\r
- @VisibleForTesting(visibility=Visibility.PRIVATE)\r
- public static final String PROP_PATH = "Extra.Path"; //$NON-NLS-1$\r
- @VisibleForTesting(visibility=Visibility.PRIVATE)\r
- public static final String PROP_OLD_PATHS = "Extra.OldPaths"; //$NON-NLS-1$\r
- @VisibleForTesting(visibility=Visibility.PRIVATE)\r
- public static final String PROP_VENDOR = "Extra.Vendor"; //$NON-NLS-1$\r
- @VisibleForTesting(visibility=Visibility.PRIVATE)\r
- public static final String PROP_MIN_API_LEVEL = "Extra.MinApiLevel"; //$NON-NLS-1$\r
- @VisibleForTesting(visibility=Visibility.PRIVATE)\r
- public static final String PROP_PROJECT_FILES = "Extra.ProjectFiles"; //$NON-NLS-1$\r
-\r
/**\r
* The vendor folder name. It must be a non-empty single-segment path.\r
* <p/>\r
// exist prior to schema repo-v3 and tools r8, which means we need to cope with a\r
// lack of it when reading back old local repositories. In this case we allow an\r
// empty string.\r
- mVendor = vendor != null ? vendor : getProperty(props, PROP_VENDOR, "");\r
+ mVendor = vendor != null ? vendor : getProperty(props, PkgProps.EXTRA_VENDOR, "");\r
\r
// The path argument comes before whatever could be in the properties\r
- mPath = path != null ? path : getProperty(props, PROP_PATH, path);\r
+ mPath = path != null ? path : getProperty(props, PkgProps.EXTRA_PATH, path);\r
\r
- mOldPaths = getProperty(props, PROP_OLD_PATHS, null);\r
+ mOldPaths = getProperty(props, PkgProps.EXTRA_OLD_PATHS, null);\r
\r
mMinApiLevel = Integer.parseInt(\r
- getProperty(props, PROP_MIN_API_LEVEL, Integer.toString(MIN_API_LEVEL_NOT_SPECIFIED)));\r
+ getProperty(props,\r
+ PkgProps.EXTRA_MIN_API_LEVEL,\r
+ Integer.toString(MIN_API_LEVEL_NOT_SPECIFIED)));\r
\r
- String projectFiles = getProperty(props, PROP_PROJECT_FILES, null);\r
+ String projectFiles = getProperty(props, PkgProps.EXTRA_PROJECT_FILES, null);\r
ArrayList<String> filePaths = new ArrayList<String>();\r
if (projectFiles != null && projectFiles.length() > 0) {\r
for (String filePath : projectFiles.split(Pattern.quote(File.pathSeparator))) {\r
void saveProperties(Properties props) {\r
super.saveProperties(props);\r
\r
- props.setProperty(PROP_PATH, mPath);\r
+ props.setProperty(PkgProps.EXTRA_PATH, mPath);\r
if (mVendor != null) {\r
- props.setProperty(PROP_VENDOR, mVendor);\r
+ props.setProperty(PkgProps.EXTRA_VENDOR, mVendor);\r
}\r
\r
if (getMinApiLevel() != MIN_API_LEVEL_NOT_SPECIFIED) {\r
- props.setProperty(PROP_MIN_API_LEVEL, Integer.toString(getMinApiLevel()));\r
+ props.setProperty(PkgProps.EXTRA_MIN_API_LEVEL, Integer.toString(getMinApiLevel()));\r
}\r
\r
if (mProjectFiles.length > 0) {\r
}\r
sb.append(mProjectFiles[i]);\r
}\r
- props.setProperty(PROP_PROJECT_FILES, sb.toString());\r
+ props.setProperty(PkgProps.EXTRA_PROJECT_FILES, sb.toString());\r
}\r
\r
if (mOldPaths != null && mOldPaths.length() > 0) {\r
- props.setProperty(PROP_OLD_PATHS, mOldPaths);\r
+ props.setProperty(PkgProps.EXTRA_OLD_PATHS, mOldPaths);\r
}\r
}\r
\r
*/\r
public interface ILayoutlibVersion {\r
\r
- public static final String PROP_LAYOUTLIB_API = "Layoutlib.Api"; //$NON-NLS-1$\r
- public static final String PROP_LAYOUTLIB_REV = "Layoutlib.Revision"; //$NON-NLS-1$\r
public static final int LAYOUTLIB_API_NOT_SPECIFIED = 0;\r
public static final int LAYOUTLIB_REV_NOT_SPECIFIED = 0;\r
\r
\r
package com.android.sdklib.internal.repository;\r
\r
+import com.android.sdklib.repository.PkgProps;\r
import com.android.sdklib.repository.RepoConstants;\r
import com.android.util.Pair;\r
\r
*/\r
public LayoutlibVersionMixin(Properties props) {\r
int layoutlibApi = Integer.parseInt(\r
- Package.getProperty(props, PROP_LAYOUTLIB_API,\r
+ Package.getProperty(props, PkgProps.LAYOUTLIB_API,\r
Integer.toString(LAYOUTLIB_API_NOT_SPECIFIED)));\r
int layoutlibRev = Integer.parseInt(\r
- Package.getProperty(props, PROP_LAYOUTLIB_REV,\r
+ Package.getProperty(props, PkgProps.LAYOUTLIB_REV,\r
Integer.toString(LAYOUTLIB_REV_NOT_SPECIFIED)));\r
mLayoutlibVersion = Pair.of(layoutlibApi, layoutlibRev);\r
}\r
*/\r
void saveProperties(Properties props) {\r
if (mLayoutlibVersion.getFirst().intValue() != LAYOUTLIB_API_NOT_SPECIFIED) {\r
- props.setProperty(PROP_LAYOUTLIB_API, mLayoutlibVersion.getFirst().toString());\r
- props.setProperty(PROP_LAYOUTLIB_REV, mLayoutlibVersion.getSecond().toString());\r
+ props.setProperty(PkgProps.LAYOUTLIB_API, mLayoutlibVersion.getFirst().toString());\r
+ props.setProperty(PkgProps.LAYOUTLIB_REV, mLayoutlibVersion.getSecond().toString());\r
}\r
}\r
\r
\r
import com.android.sdklib.internal.repository.Archive.Arch;\r
import com.android.sdklib.internal.repository.Archive.Os;\r
+import com.android.sdklib.repository.PkgProps;\r
import com.android.sdklib.repository.SdkRepoConstants;\r
\r
import org.w3c.dom.Node;\r
*/\r
public abstract class MinToolsPackage extends Package implements IMinToolsDependency {\r
\r
- static final String PROP_MIN_TOOLS_REV = "Platform.MinToolsRev"; //$NON-NLS-1$\r
-\r
/**\r
* The minimal revision of the tools package required by this extra package, if > 0,\r
* or {@link #MIN_TOOLS_REV_NOT_SPECIFIED} if there is no such requirement.\r
archiveOs, archiveArch, archiveOsPath);\r
\r
mMinToolsRevision = Integer.parseInt(\r
- getProperty(props, PROP_MIN_TOOLS_REV, Integer.toString(MIN_TOOLS_REV_NOT_SPECIFIED)));\r
+ getProperty(props,\r
+ PkgProps.MIN_TOOLS_REV,\r
+ Integer.toString(MIN_TOOLS_REV_NOT_SPECIFIED)));\r
}\r
\r
/**\r
super.saveProperties(props);\r
\r
if (getMinToolsRevision() != MIN_TOOLS_REV_NOT_SPECIFIED) {\r
- props.setProperty(PROP_MIN_TOOLS_REV, Integer.toString(getMinToolsRevision()));\r
+ props.setProperty(PkgProps.MIN_TOOLS_REV,\r
+ Integer.toString(getMinToolsRevision()));\r
}\r
}\r
\r
import com.android.sdklib.SdkManager;\r
import com.android.sdklib.internal.repository.Archive.Arch;\r
import com.android.sdklib.internal.repository.Archive.Os;\r
+import com.android.sdklib.repository.PkgProps;\r
import com.android.sdklib.repository.SdkRepoConstants;\r
\r
import org.w3c.dom.Node;\r
*/\r
public abstract class Package implements IDescription, Comparable<Package> {\r
\r
- public static final String PROP_REVISION = "Pkg.Revision"; //$NON-NLS-1$\r
- public static final String PROP_LICENSE = "Pkg.License"; //$NON-NLS-1$\r
- public static final String PROP_DESC = "Pkg.Desc"; //$NON-NLS-1$\r
- public static final String PROP_DESC_URL = "Pkg.DescUrl"; //$NON-NLS-1$\r
- public static final String PROP_RELEASE_NOTE = "Pkg.RelNote"; //$NON-NLS-1$\r
- public static final String PROP_RELEASE_URL = "Pkg.RelNoteUrl"; //$NON-NLS-1$\r
- public static final String PROP_SOURCE_URL = "Pkg.SourceUrl"; //$NON-NLS-1$\r
- public static final String PROP_OBSOLETE = "Pkg.Obsolete"; //$NON-NLS-1$\r
-\r
private final int mRevision;\r
private final String mObsolete;\r
private final String mLicense;\r
descUrl = "";\r
}\r
\r
- mRevision = Integer.parseInt(getProperty(props, PROP_REVISION, Integer.toString(revision)));\r
- mLicense = getProperty(props, PROP_LICENSE, license);\r
- mDescription = getProperty(props, PROP_DESC, description);\r
- mDescUrl = getProperty(props, PROP_DESC_URL, descUrl);\r
- mReleaseNote = getProperty(props, PROP_RELEASE_NOTE, "");\r
- mReleaseUrl = getProperty(props, PROP_RELEASE_URL, "");\r
- mObsolete = getProperty(props, PROP_OBSOLETE, null);\r
+ mRevision = Integer.parseInt(\r
+ getProperty(props, PkgProps.PKG_REVISION, Integer.toString(revision)));\r
+ mLicense = getProperty(props, PkgProps.PKG_LICENSE, license);\r
+ mDescription = getProperty(props, PkgProps.PKG_DESC, description);\r
+ mDescUrl = getProperty(props, PkgProps.PKG_DESC_URL, descUrl);\r
+ mReleaseNote = getProperty(props, PkgProps.PKG_RELEASE_NOTE, "");\r
+ mReleaseUrl = getProperty(props, PkgProps.PKG_RELEASE_URL, "");\r
+ mObsolete = getProperty(props, PkgProps.PKG_OBSOLETE, null);\r
\r
// If source is null and we can find a source URL in the properties, generate\r
// a dummy source just to store the URL. This allows us to easily remember where\r
// a package comes from.\r
- String srcUrl = getProperty(props, PROP_SOURCE_URL, null);\r
+ String srcUrl = getProperty(props, PkgProps.PKG_SOURCE_URL, null);\r
if (props != null && source == null && srcUrl != null) {\r
if (this instanceof AddonPackage) {\r
source = new SdkAddonSource(srcUrl, null /*uiName*/);\r
* These properties will later be give the constructor that takes a {@link Properties} object.\r
*/\r
void saveProperties(Properties props) {\r
- props.setProperty(PROP_REVISION, Integer.toString(mRevision));\r
+ props.setProperty(PkgProps.PKG_REVISION, Integer.toString(mRevision));\r
if (mLicense != null && mLicense.length() > 0) {\r
- props.setProperty(PROP_LICENSE, mLicense);\r
+ props.setProperty(PkgProps.PKG_LICENSE, mLicense);\r
}\r
\r
if (mDescription != null && mDescription.length() > 0) {\r
- props.setProperty(PROP_DESC, mDescription);\r
+ props.setProperty(PkgProps.PKG_DESC, mDescription);\r
}\r
if (mDescUrl != null && mDescUrl.length() > 0) {\r
- props.setProperty(PROP_DESC_URL, mDescUrl);\r
+ props.setProperty(PkgProps.PKG_DESC_URL, mDescUrl);\r
}\r
\r
if (mReleaseNote != null && mReleaseNote.length() > 0) {\r
- props.setProperty(PROP_RELEASE_NOTE, mReleaseNote);\r
+ props.setProperty(PkgProps.PKG_RELEASE_NOTE, mReleaseNote);\r
}\r
if (mReleaseUrl != null && mReleaseUrl.length() > 0) {\r
- props.setProperty(PROP_RELEASE_URL, mReleaseUrl);\r
+ props.setProperty(PkgProps.PKG_RELEASE_URL, mReleaseUrl);\r
}\r
if (mObsolete != null) {\r
- props.setProperty(PROP_OBSOLETE, mObsolete);\r
+ props.setProperty(PkgProps.PKG_OBSOLETE, mObsolete);\r
}\r
\r
if (mSource != null) {\r
- props.setProperty(PROP_SOURCE_URL, mSource.getUrl());\r
+ props.setProperty(PkgProps.PKG_SOURCE_URL, mSource.getUrl());\r
}\r
}\r
\r
import com.android.sdklib.SdkManager;\r
import com.android.sdklib.internal.repository.Archive.Arch;\r
import com.android.sdklib.internal.repository.Archive.Os;\r
+import com.android.sdklib.repository.PkgProps;\r
import com.android.sdklib.repository.SdkRepoConstants;\r
import com.android.util.Pair;\r
\r
*/\r
public class PlatformPackage extends MinToolsPackage implements IPackageVersion, ILayoutlibVersion {\r
\r
- public static final String PROP_VERSION = "Platform.Version"; //$NON-NLS-1$\r
- public static final String PROP_INCLUDED_ABI = "Platform.Included.Abi"; //$NON-NLS-1$\r
-\r
/** The package version, for platform, add-on and doc packages. */\r
private final AndroidVersion mVersion;\r
\r
mVersion = target.getVersion();\r
mVersionName = target.getVersionName();\r
mLayoutlibVersion = new LayoutlibVersionMixin(props);\r
- mIncludedAbi = props == null ? null : props.getProperty(PROP_INCLUDED_ABI);\r
+ mIncludedAbi = props == null ? null : props.getProperty(PkgProps.PLATFORM_INCLUDED_ABI);\r
}\r
\r
/**\r
mLayoutlibVersion.saveProperties(props);\r
\r
if (mVersionName != null) {\r
- props.setProperty(PROP_VERSION, mVersionName);\r
+ props.setProperty(PkgProps.PLATFORM_VERSION, mVersionName);\r
}\r
\r
if (mIncludedAbi != null) {\r
- props.setProperty(PROP_INCLUDED_ABI, mIncludedAbi);\r
+ props.setProperty(PkgProps.PLATFORM_INCLUDED_ABI, mIncludedAbi);\r
}\r
\r
}\r
import com.android.sdklib.AndroidVersion.AndroidVersionException;\r
import com.android.sdklib.internal.repository.Archive.Arch;\r
import com.android.sdklib.internal.repository.Archive.Os;\r
+import com.android.sdklib.repository.PkgProps;\r
import com.android.sdklib.repository.SdkRepoConstants;\r
\r
import org.w3c.dom.Node;\r
public class SamplePackage extends MinToolsPackage\r
implements IPackageVersion, IMinApiLevelDependency {\r
\r
- private static final String PROP_MIN_API_LEVEL = "Sample.MinApiLevel"; //$NON-NLS-1$\r
-\r
/** The matching platform version. */\r
private final AndroidVersion mVersion;\r
\r
mVersion = target.getVersion();\r
\r
mMinApiLevel = Integer.parseInt(\r
- getProperty(props, PROP_MIN_API_LEVEL, Integer.toString(MIN_API_LEVEL_NOT_SPECIFIED)));\r
+ getProperty(props,\r
+ PkgProps.SAMPLE_MIN_API_LEVEL,\r
+ Integer.toString(MIN_API_LEVEL_NOT_SPECIFIED)));\r
}\r
\r
/**\r
mVersion = new AndroidVersion(props);\r
\r
mMinApiLevel = Integer.parseInt(\r
- getProperty(props, PROP_MIN_API_LEVEL, Integer.toString(MIN_API_LEVEL_NOT_SPECIFIED)));\r
+ getProperty(props,\r
+ PkgProps.SAMPLE_MIN_API_LEVEL,\r
+ Integer.toString(MIN_API_LEVEL_NOT_SPECIFIED)));\r
}\r
\r
/**\r
mVersion.saveProperties(props);\r
\r
if (getMinApiLevel() != MIN_API_LEVEL_NOT_SPECIFIED) {\r
- props.setProperty(PROP_MIN_API_LEVEL, Integer.toString(getMinApiLevel()));\r
+ props.setProperty(PkgProps.SAMPLE_MIN_API_LEVEL, Integer.toString(getMinApiLevel()));\r
}\r
}\r
\r
import com.android.sdklib.SystemImage;\r
import com.android.sdklib.internal.repository.Archive.Arch;\r
import com.android.sdklib.internal.repository.Archive.Os;\r
+import com.android.sdklib.repository.PkgProps;\r
import com.android.sdklib.repository.SdkRepoConstants;\r
\r
import org.w3c.dom.Node;\r
public class SystemImagePackage extends Package\r
implements IPackageVersion, IPlatformDependency {\r
\r
- @VisibleForTesting(visibility=Visibility.PRIVATE)\r
- static final String PROP_ABI = "SystemImage.Abi"; //$NON-NLS-1$\r
-\r
/** The package version, for platform, add-on and doc packages. */\r
private final AndroidVersion mVersion;\r
\r
);\r
mVersion = platformVersion;\r
if (abi == null && props != null) {\r
- abi = props.getProperty(PROP_ABI);\r
+ abi = props.getProperty(PkgProps.SYS_IMG_ABI);\r
}\r
assert abi != null : "To use this SystemImagePackage constructor you must pass an ABI as a parameter or as a PROP_ABI property";\r
mAbi = abi;\r
super.saveProperties(props);\r
\r
mVersion.saveProperties(props);\r
- props.setProperty(PROP_ABI, mAbi);\r
+ props.setProperty(PkgProps.SYS_IMG_ABI, mAbi);\r
}\r
\r
/** Returns the ABI of the system-image. Cannot be null nor empty. */\r
--- /dev/null
+/*\r
+ * Copyright (C) 2011 The Android Open Source Project\r
+ *\r
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.eclipse.org/org/documents/epl-v10.php\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package com.android.sdklib.repository;\r
+\r
+\r
+\r
+/**\r
+ * Public constants used by the repository when saving {@code source.properties}\r
+ * files in local packages.\r
+ * <p/>\r
+ * These constants are public and part of the SDK Manager public API.\r
+ * Once published we can't change them arbitrarily since various parts\r
+ * of our build process depend on them.\r
+ */\r
+public class PkgProps {\r
+\r
+ // Base Package\r
+\r
+ public static final String PKG_REVISION = "Pkg.Revision"; //$NON-NLS-1$\r
+ public static final String PKG_LICENSE = "Pkg.License"; //$NON-NLS-1$\r
+ public static final String PKG_DESC = "Pkg.Desc"; //$NON-NLS-1$\r
+ public static final String PKG_DESC_URL = "Pkg.DescUrl"; //$NON-NLS-1$\r
+ public static final String PKG_RELEASE_NOTE = "Pkg.RelNote"; //$NON-NLS-1$\r
+ public static final String PKG_RELEASE_URL = "Pkg.RelNoteUrl"; //$NON-NLS-1$\r
+ public static final String PKG_SOURCE_URL = "Pkg.SourceUrl"; //$NON-NLS-1$\r
+ public static final String PKG_OBSOLETE = "Pkg.Obsolete"; //$NON-NLS-1$\r
+\r
+ // AndroidVersion\r
+\r
+ public static final String VERSION_API_LEVEL = "AndroidVersion.ApiLevel";//$NON-NLS-1$\r
+ public static final String VERSION_CODENAME = "AndroidVersion.CodeName";//$NON-NLS-1$\r
+\r
+ // AddonPackage\r
+\r
+ public static final String ADDON_NAME = "Addon.Name"; //$NON-NLS-1$\r
+ public static final String ADDON_VENDOR = "Addon.Vendor"; //$NON-NLS-1$\r
+\r
+ // DocPackage\r
+\r
+ // ExtraPackage\r
+\r
+ public static final String EXTRA_PATH = "Extra.Path"; //$NON-NLS-1$\r
+ public static final String EXTRA_OLD_PATHS = "Extra.OldPaths"; //$NON-NLS-1$\r
+ public static final String EXTRA_VENDOR = "Extra.Vendor"; //$NON-NLS-1$\r
+ public static final String EXTRA_MIN_API_LEVEL = "Extra.MinApiLevel"; //$NON-NLS-1$\r
+ public static final String EXTRA_PROJECT_FILES = "Extra.ProjectFiles"; //$NON-NLS-1$\r
+\r
+ // ILayoutlibVersion\r
+\r
+ public static final String LAYOUTLIB_API = "Layoutlib.Api"; //$NON-NLS-1$\r
+ public static final String LAYOUTLIB_REV = "Layoutlib.Revision"; //$NON-NLS-1$\r
+\r
+ // MinToolsPackage\r
+\r
+ public static final String MIN_TOOLS_REV = "Platform.MinToolsRev"; //$NON-NLS-1$\r
+\r
+ // PlatformPackage\r
+\r
+ public static final String PLATFORM_VERSION = "Platform.Version"; //$NON-NLS-1$\r
+ public static final String PLATFORM_INCLUDED_ABI = "Platform.Included.Abi"; //$NON-NLS-1$\r
+\r
+ // PlatformToolPackage\r
+\r
+ // SamplePackage\r
+\r
+ public static final String SAMPLE_MIN_API_LEVEL = "Sample.MinApiLevel"; //$NON-NLS-1$\r
+\r
+ // SystemImagePackage\r
+\r
+ public static final String SYS_IMG_ABI = "SystemImage.Abi"; //$NON-NLS-1$\r
+}\r
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;
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) {
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;
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;
// 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));
// 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));
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;
Properties props = super.createProps();
// MinToolsPackage properties
- props.setProperty(ExtraPackage.PROP_MIN_TOOLS_REV, "3");
+ props.setProperty(PkgProps.MIN_TOOLS_REV, "3");
return props;
}
package com.android.sdklib.internal.repository;\r
\r
import com.android.sdklib.IAndroidTarget;\r
+import com.android.sdklib.repository.PkgProps;\r
\r
import java.util.Properties;\r
\r
\r
private static Properties createProps(int min_tools_rev) {\r
Properties props = new Properties();\r
- props.setProperty(PlatformPackage.PROP_MIN_TOOLS_REV, Integer.toString((min_tools_rev)));\r
+ props.setProperty(PkgProps.MIN_TOOLS_REV, Integer.toString((min_tools_rev)));\r
return props;\r
}\r
\r
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;
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;
}
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;
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;
}
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;
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;
}
// 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));
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;
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;
// 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();