aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-08-11 14:30:13 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-08-11 14:30:13 -0700
commit41676f1090d9a2e75955862eb3e2622dc03fbdc3 (patch)
treeaf5669e449014a97613d8e80b30f28b0b819cbe8
parent07e88f462bc89571b6726643c676cb075ed4e04d (diff)
parent4a77347cd8d63f25aa2b3a3d57cee47160e600e6 (diff)
downloadsdk-41676f1090d9a2e75955862eb3e2622dc03fbdc3.zip
sdk-41676f1090d9a2e75955862eb3e2622dc03fbdc3.tar.gz
sdk-41676f1090d9a2e75955862eb3e2622dc03fbdc3.tar.bz2
Merge change 20786 into donut
* changes: BUG 2041701: Release notes content/link in SDK Updater schema
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Package.java89
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/repository/SdkRepository.java10
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository.xsd20
-rwxr-xr-xsdkmanager/libs/sdklib/tests/com/android/sdklib/repository/repository_sample.xml4
4 files changed, 107 insertions, 16 deletions
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 8d19c0f..5afe73c 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
@@ -42,16 +42,20 @@ import java.util.Properties;
*/
public abstract class Package implements IDescription {
- private static final String PROP_REVISION = "Pkg.Revision"; //$NON-NLS-1$
- private static final String PROP_LICENSE = "Pkg.License"; //$NON-NLS-1$
- private static final String PROP_DESC = "Pkg.Desc"; //$NON-NLS-1$
- private static final String PROP_DESC_URL = "Pkg.DescUrl"; //$NON-NLS-1$
- private static final String PROP_SOURCE_URL = "Pkg.SourceUrl"; //$NON-NLS-1$
- private static final String PROP_USER_SOURCE = "Pkg.UserSrc"; //$NON-NLS-1$
+ private static final String PROP_REVISION = "Pkg.Revision"; //$NON-NLS-1$
+ private static final String PROP_LICENSE = "Pkg.License"; //$NON-NLS-1$
+ private static final String PROP_DESC = "Pkg.Desc"; //$NON-NLS-1$
+ private static final String PROP_DESC_URL = "Pkg.DescUrl"; //$NON-NLS-1$
+ private static final String PROP_RELEASE_NOTE = "Pkg.RelNote"; //$NON-NLS-1$
+ private static final String PROP_RELEASE_URL = "Pkg.RelNoteUrl"; //$NON-NLS-1$
+ private static final String PROP_SOURCE_URL = "Pkg.SourceUrl"; //$NON-NLS-1$
+ private static final String PROP_USER_SOURCE = "Pkg.UserSrc"; //$NON-NLS-1$
private final int mRevision;
private final String mLicense;
private final String mDescription;
private final String mDescUrl;
+ private final String mReleaseNote;
+ private final String mReleaseUrl;
private final Archive[] mArchives;
private final RepoSource mSource;
@@ -80,6 +84,8 @@ public abstract class Package implements IDescription {
mRevision = XmlParserUtils.getXmlInt (packageNode, SdkRepository.NODE_REVISION, 0);
mDescription = XmlParserUtils.getXmlString(packageNode, SdkRepository.NODE_DESCRIPTION);
mDescUrl = XmlParserUtils.getXmlString(packageNode, SdkRepository.NODE_DESC_URL);
+ mReleaseNote = XmlParserUtils.getXmlString(packageNode, SdkRepository.NODE_RELEASE_NOTE);
+ mReleaseUrl = XmlParserUtils.getXmlString(packageNode, SdkRepository.NODE_RELEASE_URL);
mLicense = parseLicense(packageNode, licenses);
mArchives = parseArchives(XmlParserUtils.getFirstChild(
@@ -104,10 +110,19 @@ public abstract class Package implements IDescription {
Arch archiveArch,
String archiveOsPath) {
+ if (description == null) {
+ description = "";
+ }
+ if (descUrl == null) {
+ 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);
+ 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, "");
// 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
@@ -145,16 +160,24 @@ public abstract class Package implements IDescription {
*/
void saveProperties(Properties props) {
props.setProperty(PROP_REVISION, Integer.toString(mRevision));
- if (mLicense != null) {
+ if (mLicense != null && mLicense.length() > 0) {
props.setProperty(PROP_LICENSE, mLicense);
}
- if (mDescription != null) {
+
+ if (mDescription != null && mDescription.length() > 0) {
props.setProperty(PROP_DESC, mDescription);
}
- if (mDescUrl != null) {
+ if (mDescUrl != null && mDescUrl.length() > 0) {
props.setProperty(PROP_DESC_URL, mDescUrl);
}
+ if (mReleaseNote != null && mReleaseNote.length() > 0) {
+ props.setProperty(PROP_RELEASE_NOTE, mReleaseNote);
+ }
+ if (mReleaseUrl != null && mReleaseUrl.length() > 0) {
+ props.setProperty(PROP_RELEASE_URL, mReleaseUrl);
+ }
+
if (mSource != null) {
props.setProperty(PROP_SOURCE_URL, mSource.getUrl());
props.setProperty(PROP_USER_SOURCE, Boolean.toString(mSource.isUserSource()));
@@ -259,6 +282,22 @@ public abstract class Package implements IDescription {
}
/**
+ * Returns the optional release note for all packages (platform, add-on, tool, doc) or
+ * for a lib. Can be empty but not null.
+ */
+ public String getReleaseNote() {
+ return mReleaseNote;
+ }
+
+ /**
+ * Returns the optional release note URL for all packages (platform, add-on, tool, doc).
+ * Can be empty but not null.
+ */
+ public String getReleaseNoteUrl() {
+ return mReleaseUrl;
+ }
+
+ /**
* Returns the archives defined in this package.
* Can be an empty array but not null.
*/
@@ -291,7 +330,31 @@ public abstract class Package implements IDescription {
* Can be empty but not null.
*/
public String getLongDescription() {
- return String.format("%1$s\nRevision %2$d", getDescription(), getRevision());
+ StringBuilder sb = new StringBuilder();
+
+ String s = getDescription();
+ if (s != null) {
+ sb.append(s);
+ }
+
+ sb.append(String.format("\nRevision %1$d", getRevision()));
+
+ s = getDescUrl();
+ if (s != null && s.length() > 0) {
+ sb.append(String.format("\n\nMore information at %1$s", s));
+ }
+
+ s = getReleaseNote();
+ if (s != null && s.length() > 0) {
+ sb.append("\n\nRelease note:\n").append(s);
+ }
+
+ s = getReleaseNoteUrl();
+ if (s != null && s.length() > 0) {
+ sb.append("\nRelease note URL: ").append(s);
+ }
+
+ return sb.toString();
}
/**
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/SdkRepository.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/SdkRepository.java
index 88d18db..4b12d59 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/SdkRepository.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/SdkRepository.java
@@ -53,11 +53,15 @@ public class SdkRepository {
/** The optional uses-license for all packages (platform, add-on, tool, doc) or for a lib. */
public static final String NODE_USES_LICENSE = "uses-license"; //$NON-NLS-1$
/** The revision, an int > 0, for all packages (platform, add-on, tool, doc). */
- public static final String NODE_REVISION = "revision"; //$NON-NLS-1$
+ public static final String NODE_REVISION = "revision"; //$NON-NLS-1$
/** The optional description for all packages (platform, add-on, tool, doc) or for a lib. */
- public static final String NODE_DESCRIPTION = "description"; //$NON-NLS-1$
+ public static final String NODE_DESCRIPTION = "description"; //$NON-NLS-1$
/** The optional description URL for all packages (platform, add-on, tool, doc). */
- public static final String NODE_DESC_URL = "desc-url"; //$NON-NLS-1$
+ public static final String NODE_DESC_URL = "desc-url"; //$NON-NLS-1$
+ /** The optional release note for all packages (platform, add-on, tool, doc). */
+ public static final String NODE_RELEASE_NOTE = "release-note"; //$NON-NLS-1$
+ /** The optional release note URL for all packages (platform, add-on, tool, doc). */
+ public static final String NODE_RELEASE_URL = "release-url"; //$NON-NLS-1$
/** The version, a string, for platform packages. */
public static final String NODE_VERSION = "version"; //$NON-NLS-1$
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository.xsd b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository.xsd
index a697c83..7ca0892 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository.xsd
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/repository/sdk-repository.xsd
@@ -65,6 +65,10 @@
<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>
@@ -99,6 +103,10 @@
<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" />
@@ -143,6 +151,10 @@
<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>
@@ -173,6 +185,10 @@
<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>
@@ -219,6 +235,10 @@
<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>
diff --git a/sdkmanager/libs/sdklib/tests/com/android/sdklib/repository/repository_sample.xml b/sdkmanager/libs/sdklib/tests/com/android/sdklib/repository/repository_sample.xml
index 7340549..20b8571 100755
--- a/sdkmanager/libs/sdklib/tests/com/android/sdklib/repository/repository_sample.xml
+++ b/sdkmanager/libs/sdklib/tests/com/android/sdklib/repository/repository_sample.xml
@@ -39,6 +39,10 @@
<sdk:uses-license ref="license1" />
<sdk:description>Some optional description</sdk:description>
<sdk:desc-url>http://www.example.com/platform1.html</sdk:desc-url>
+ <sdk:release-note>This is an optional release note
+ for this package. It's a free multi-line text.
+ </sdk:release-note>
+ <sdk:release-url>http://some/url/for/the/release/note.html</sdk:release-url>
<!-- The archives node is mandatory and it cannot be empty. -->
<sdk:archives>
<sdk:archive os="any">