Merge change 3345 into donut

* changes:
  SDK Updater: Add optional license elements to XML schema.
This commit is contained in:
Android (Google) Code Review
2009-06-08 13:27:35 -07:00
9 changed files with 49 additions and 5 deletions

View File

@@ -74,13 +74,14 @@ public class AddonPackage extends Package {
} }
/** /**
* Creates a new platform package based on an actual {@link IAndroidTarget} (with * Creates a new platform package based on an actual {@link IAndroidTarget} (which
* {@link IAndroidTarget#isPlatform()} false) from the {@link SdkManager}. * {@link IAndroidTarget#isPlatform()} false) from the {@link SdkManager}.
* This is used to list local SDK folders. * This is used to list local SDK folders.
*/ */
AddonPackage(IAndroidTarget target) { AddonPackage(IAndroidTarget target) {
super( null, //source super( null, //source
0, //revision 0, //revision
null, //license
target.getDescription(), //description target.getDescription(), //description
null, //descUrl null, //descUrl
Os.getCurrentOs(), //archiveOs Os.getCurrentOs(), //archiveOs

View File

@@ -49,6 +49,7 @@ public class DocPackage extends Package {
DocPackage(RepoSource source, DocPackage(RepoSource source,
int apiLevel, int apiLevel,
int revision, int revision,
String license,
String description, String description,
String descUrl, String descUrl,
Os archiveOs, Os archiveOs,
@@ -58,6 +59,7 @@ public class DocPackage extends Package {
String archiveChecksum) { String archiveChecksum) {
super(source, super(source,
revision, revision,
license,
description, description,
descUrl, descUrl,
archiveOs, archiveOs,

View File

@@ -167,6 +167,7 @@ public class LocalSdkParser {
pkg = new ToolPackage( pkg = new ToolPackage(
null, //source null, //source
0, //revision 0, //revision
null, //license
"Tools", //description "Tools", //description
null, //descUrl null, //descUrl
Os.getCurrentOs(), //archiveOs Os.getCurrentOs(), //archiveOs
@@ -229,6 +230,7 @@ public class LocalSdkParser {
null, //source null, //source
0, //apiLevel 0, //apiLevel
0, //revision 0, //revision
null, //license
String.format("Documentation for %1$s", found), //description String.format("Documentation for %1$s", found), //description
null, //descUrl null, //descUrl
Os.getCurrentOs(), //archiveOs Os.getCurrentOs(), //archiveOs

View File

@@ -40,6 +40,7 @@ import java.util.ArrayList;
public abstract class Package implements IDescription { public abstract class Package implements IDescription {
private final int mRevision; private final int mRevision;
private final String mLicense;
private final String mDescription; private final String mDescription;
private final String mDescUrl; private final String mDescUrl;
private final Archive[] mArchives; private final Archive[] mArchives;
@@ -55,7 +56,7 @@ public abstract class Package implements IDescription {
mRevision = getXmlInt (packageNode, SdkRepository.NODE_REVISION, 0); mRevision = getXmlInt (packageNode, SdkRepository.NODE_REVISION, 0);
mDescription = getXmlString(packageNode, SdkRepository.NODE_DESCRIPTION); mDescription = getXmlString(packageNode, SdkRepository.NODE_DESCRIPTION);
mDescUrl = getXmlString(packageNode, SdkRepository.NODE_DESC_URL); mDescUrl = getXmlString(packageNode, SdkRepository.NODE_DESC_URL);
mLicense = getXmlString(packageNode, SdkRepository.NODE_LICENSE);
mArchives = parseArchives(getFirstChild(packageNode, SdkRepository.NODE_ARCHIVES)); mArchives = parseArchives(getFirstChild(packageNode, SdkRepository.NODE_ARCHIVES));
} }
@@ -65,6 +66,7 @@ public abstract class Package implements IDescription {
*/ */
public Package(RepoSource source, public Package(RepoSource source,
int revision, int revision,
String license,
String description, String description,
String descUrl, String descUrl,
Os archiveOs, Os archiveOs,
@@ -74,6 +76,7 @@ public abstract class Package implements IDescription {
String archiveChecksum) { String archiveChecksum) {
mSource = source; mSource = source;
mRevision = revision; mRevision = revision;
mLicense = license;
mDescription = description; mDescription = description;
mDescUrl = descUrl; mDescUrl = descUrl;
mArchives = new Archive[1]; mArchives = new Archive[1];
@@ -140,6 +143,14 @@ public abstract class Package implements IDescription {
return mRevision; return mRevision;
} }
/**
* Returns the optional description for all packages (platform, add-on, tool, doc) or
* for a lib. It is null if the element has not been specified in the repository XML.
*/
public String getLicense() {
return mLicense;
}
/** /**
* Returns the optional description for all packages (platform, add-on, tool, doc) or * Returns the optional description for all packages (platform, add-on, tool, doc) or
* for a lib. Can be empty but not null. * for a lib. Can be empty but not null.

View File

@@ -47,13 +47,14 @@ public class PlatformPackage extends Package {
} }
/** /**
* Creates a new platform package based on an actual {@link IAndroidTarget} (with * Creates a new platform package based on an actual {@link IAndroidTarget} (which
* must have {@link IAndroidTarget#isPlatform()} true) from the {@link SdkManager}. * must have {@link IAndroidTarget#isPlatform()} true) from the {@link SdkManager}.
* This is used to list local SDK folders. * This is used to list local SDK folders.
*/ */
PlatformPackage(IAndroidTarget target) { PlatformPackage(IAndroidTarget target) {
super( null, //source super( null, //source
0, //revision 0, //revision
null, //license
target.getDescription(), //description target.getDescription(), //description
null, //descUrl null, //descUrl
Os.getCurrentOs(), //archiveOs Os.getCurrentOs(), //archiveOs

View File

@@ -44,6 +44,7 @@ public class ToolPackage extends Package {
*/ */
ToolPackage(RepoSource source, ToolPackage(RepoSource source,
int revision, int revision,
String license,
String description, String description,
String descUrl, String descUrl,
Os archiveOs, Os archiveOs,
@@ -53,6 +54,7 @@ public class ToolPackage extends Package {
String archiveChecksum) { String archiveChecksum) {
super(source, super(source,
revision, revision,
license,
description, description,
descUrl, descUrl,
archiveOs, archiveOs,

View File

@@ -46,6 +46,8 @@ public class SdkRepository {
/** The revision, an int > 0, for all packages (platform, add-on, tool, doc). */ /** 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 license for all packages (platform, add-on, tool, doc) or for a lib. */
public static final String NODE_LICENSE = "license"; //$NON-NLS-1$
/** The optional description for all packages (platform, add-on, tool, doc) or for a lib. */ /** 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). */ /** The optional description URL for all packages (platform, add-on, tool, doc). */

View File

@@ -56,6 +56,9 @@
<!-- The revision, an int > 0, incremented each time a new <!-- The revision, an int > 0, incremented each time a new
package is generated. --> package is generated. -->
<xsd:element name="revision" type="xsd:positiveInteger" /> <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="license" type="xsd:string" minOccurs="0" />
<!-- The optional description of this package. --> <!-- The optional description of this package. -->
<xsd:element name="description" type="xsd:string" minOccurs="0" /> <xsd:element name="description" type="xsd:string" minOccurs="0" />
<!-- The optional description URL of this package --> <!-- The optional description URL of this package -->
@@ -84,6 +87,9 @@
<!-- The revision, an int > 0, incremented each time a new <!-- The revision, an int > 0, incremented each time a new
package is generated. --> package is generated. -->
<xsd:element name="revision" type="xsd:positiveInteger" /> <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="license" type="xsd:string" minOccurs="0" />
<!-- The optional description of this package. --> <!-- The optional description of this package. -->
<xsd:element name="description" type="xsd:string" minOccurs="0" /> <xsd:element name="description" type="xsd:string" minOccurs="0" />
<!-- The optional description URL of this package --> <!-- The optional description URL of this package -->
@@ -124,6 +130,9 @@
<!-- The revision, an int > 0, incremented each time a new <!-- The revision, an int > 0, incremented each time a new
package is generated. --> package is generated. -->
<xsd:element name="revision" type="xsd:positiveInteger" /> <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="license" type="xsd:string" minOccurs="0" />
<!-- The optional description of this package. --> <!-- The optional description of this package. -->
<xsd:element name="description" type="xsd:string" minOccurs="0" /> <xsd:element name="description" type="xsd:string" minOccurs="0" />
<!-- The optional description URL of this package --> <!-- The optional description URL of this package -->
@@ -148,6 +157,9 @@
<!-- The revision, an int > 0, incremented each time a new <!-- The revision, an int > 0, incremented each time a new
package is generated. --> package is generated. -->
<xsd:element name="revision" type="xsd:positiveInteger" /> <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="license" type="xsd:string" minOccurs="0" />
<!-- The optional description of this package. --> <!-- The optional description of this package. -->
<xsd:element name="description" type="xsd:string" minOccurs="0" /> <xsd:element name="description" type="xsd:string" minOccurs="0" />
<!-- The optional description URL of this package --> <!-- The optional description URL of this package -->

View File

@@ -26,6 +26,8 @@
<sdk:api-level>1</sdk:api-level> <sdk:api-level>1</sdk:api-level>
<sdk:revision>3</sdk:revision> <sdk:revision>3</sdk:revision>
<sdk:description>Some optional description</sdk:description> <sdk:description>Some optional description</sdk:description>
<sdk:license>This is the license
for this platform.</sdk:license>
<sdk:desc-url>http://www.example.com/platform1.html</sdk:desc-url> <sdk:desc-url>http://www.example.com/platform1.html</sdk:desc-url>
<!-- The archives node is mandatory and it cannot be empty. --> <!-- The archives node is mandatory and it cannot be empty. -->
<sdk:archives> <sdk:archives>
@@ -41,6 +43,7 @@
<sdk:api-level>1</sdk:api-level> <sdk:api-level>1</sdk:api-level>
<sdk:revision>1</sdk:revision> <sdk:revision>1</sdk:revision>
<sdk:description>Some optional description</sdk:description> <sdk:description>Some optional description</sdk:description>
<!-- the license element is not mandatory. -->
<sdk:desc-url>http://www.example.com/docs.html</sdk:desc-url> <sdk:desc-url>http://www.example.com/docs.html</sdk:desc-url>
<sdk:archives> <sdk:archives>
<sdk:archive os="any"> <sdk:archive os="any">
@@ -56,6 +59,8 @@
<sdk:api-level>1</sdk:api-level> <sdk:api-level>1</sdk:api-level>
<sdk:vendor>John Doe</sdk:vendor> <sdk:vendor>John Doe</sdk:vendor>
<sdk:revision>1</sdk:revision> <sdk:revision>1</sdk:revision>
<!-- license can be empty. -->
<sdk:license></sdk:license>
<sdk:description>Some optional description</sdk:description> <sdk:description>Some optional description</sdk:description>
<sdk:desc-url>http://www.example.com/myfirstaddon</sdk:desc-url> <sdk:desc-url>http://www.example.com/myfirstaddon</sdk:desc-url>
<sdk:archives> <sdk:archives>
@@ -82,6 +87,7 @@
<sdk:version>1.1</sdk:version> <sdk:version>1.1</sdk:version>
<sdk:api-level>2</sdk:api-level> <sdk:api-level>2</sdk:api-level>
<sdk:revision>12</sdk:revision> <sdk:revision>12</sdk:revision>
<sdk:license>This is the license for this package.</sdk:license>
<!-- sdk:description and sdk:desc-url are optional --> <!-- sdk:description and sdk:desc-url are optional -->
<sdk:archives> <sdk:archives>
<sdk:archive os="windows"> <sdk:archive os="windows">
@@ -139,12 +145,14 @@
<sdk:name>com.android.mymaps</sdk:name> <sdk:name>com.android.mymaps</sdk:name>
</sdk:lib> </sdk:lib>
</sdk:libs> </sdk:libs>
<sdk:license>This is the license for this package.</sdk:license>
</sdk:add-on> </sdk:add-on>
<sdk:tool> <sdk:tool>
<sdk:revision>1</sdk:revision> <sdk:revision>1</sdk:revision>
<sdk:description>Some optional description</sdk:description> <sdk:description>Some optional description</sdk:description>
<sdk:desc-url>http://www.example.com/tools.html</sdk:desc-url> <sdk:desc-url>http://www.example.com/tools.html</sdk:desc-url>
<sdk:license>This is the license for this package.</sdk:license>
<sdk:archives> <sdk:archives>
<sdk:archive os="any"> <sdk:archive os="any">
<sdk:size>65536</sdk:size> <sdk:size>65536</sdk:size>
@@ -157,6 +165,7 @@
<sdk:doc> <sdk:doc>
<sdk:api-level>2</sdk:api-level> <sdk:api-level>2</sdk:api-level>
<sdk:revision>42</sdk:revision> <sdk:revision>42</sdk:revision>
<sdk:license>This is the license for this package.</sdk:license>
<sdk:archives> <sdk:archives>
<sdk:archive os="windows"> <sdk:archive os="windows">
<sdk:size>65536</sdk:size> <sdk:size>65536</sdk:size>
@@ -178,6 +187,7 @@
<sdk:tool> <sdk:tool>
<sdk:revision>42</sdk:revision> <sdk:revision>42</sdk:revision>
<sdk:license>This is the license for this package.</sdk:license>
<sdk:archives> <sdk:archives>
<sdk:archive os="windows"> <sdk:archive os="windows">
<sdk:size>65536</sdk:size> <sdk:size>65536</sdk:size>
@@ -198,6 +208,7 @@
</sdk:tool> </sdk:tool>
<sdk:add-on> <sdk:add-on>
<sdk:license>This is the license for this package.</sdk:license>
<sdk:name>This add-on has no libraries</sdk:name> <sdk:name>This add-on has no libraries</sdk:name>
<sdk:api-level>4</sdk:api-level> <sdk:api-level>4</sdk:api-level>
<sdk:vendor>Joe Bar</sdk:vendor> <sdk:vendor>Joe Bar</sdk:vendor>