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,14 +74,15 @@ 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}.
* This is used to list local SDK folders.
*/
AddonPackage(IAndroidTarget target) {
super( null, //source
0, //revision
target.getDescription(), //description
null, //license
target.getDescription(), //description
null, //descUrl
Os.getCurrentOs(), //archiveOs
Arch.getCurrentArch(), //archiveArch

View File

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

View File

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

View File

@@ -40,6 +40,7 @@ import java.util.ArrayList;
public abstract class Package implements IDescription {
private final int mRevision;
private final String mLicense;
private final String mDescription;
private final String mDescUrl;
private final Archive[] mArchives;
@@ -55,7 +56,7 @@ public abstract class Package implements IDescription {
mRevision = getXmlInt (packageNode, SdkRepository.NODE_REVISION, 0);
mDescription = getXmlString(packageNode, SdkRepository.NODE_DESCRIPTION);
mDescUrl = getXmlString(packageNode, SdkRepository.NODE_DESC_URL);
mLicense = getXmlString(packageNode, SdkRepository.NODE_LICENSE);
mArchives = parseArchives(getFirstChild(packageNode, SdkRepository.NODE_ARCHIVES));
}
@@ -65,6 +66,7 @@ public abstract class Package implements IDescription {
*/
public Package(RepoSource source,
int revision,
String license,
String description,
String descUrl,
Os archiveOs,
@@ -74,6 +76,7 @@ public abstract class Package implements IDescription {
String archiveChecksum) {
mSource = source;
mRevision = revision;
mLicense = license;
mDescription = description;
mDescUrl = descUrl;
mArchives = new Archive[1];
@@ -140,6 +143,14 @@ public abstract class Package implements IDescription {
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
* for a lib. Can be empty but not null.

View File

@@ -47,14 +47,15 @@ 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}.
* This is used to list local SDK folders.
*/
PlatformPackage(IAndroidTarget target) {
super( null, //source
0, //revision
target.getDescription(), //description
null, //license
target.getDescription(), //description
null, //descUrl
Os.getCurrentOs(), //archiveOs
Arch.getCurrentArch(), //archiveArch

View File

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

View File

@@ -46,6 +46,8 @@ public class SdkRepository {
/** The revision, an int > 0, for all packages (platform, add-on, tool, doc). */
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. */
public static final String NODE_DESCRIPTION = "description"; //$NON-NLS-1$
/** 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
package is generated. -->
<xsd:element name="revision" type="xsd:positiveInteger" />
<!-- The optional license of this package. If present, users will have
to agree to it before downloading. -->
<xsd:element name="license" type="xsd:string" minOccurs="0" />
<!-- The optional description of this package. -->
<xsd:element name="description" type="xsd:string" minOccurs="0" />
<!-- The optional description URL of this package -->
@@ -84,6 +87,9 @@
<!-- The revision, an int > 0, incremented each time a new
package is generated. -->
<xsd:element name="revision" type="xsd:positiveInteger" />
<!-- The optional license of this package. If present, users will have
to agree to it before downloading. -->
<xsd:element name="license" type="xsd:string" minOccurs="0" />
<!-- The optional description of this package. -->
<xsd:element name="description" type="xsd:string" minOccurs="0" />
<!-- The optional description URL of this package -->
@@ -124,6 +130,9 @@
<!-- The revision, an int > 0, incremented each time a new
package is generated. -->
<xsd:element name="revision" type="xsd:positiveInteger" />
<!-- The optional license of this package. If present, users will have
to agree to it before downloading. -->
<xsd:element name="license" type="xsd:string" minOccurs="0" />
<!-- The optional description of this package. -->
<xsd:element name="description" type="xsd:string" minOccurs="0" />
<!-- The optional description URL of this package -->
@@ -148,6 +157,9 @@
<!-- The revision, an int > 0, incremented each time a new
package is generated. -->
<xsd:element name="revision" type="xsd:positiveInteger" />
<!-- The optional license of this package. If present, users will have
to agree to it before downloading. -->
<xsd:element name="license" type="xsd:string" minOccurs="0" />
<!-- The optional description of this package. -->
<xsd:element name="description" type="xsd:string" minOccurs="0" />
<!-- The optional description URL of this package -->

View File

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