Skip to content

Commit 0da4f15

Browse files
author
Android (Google) Code Review
committed
Merge change If1bda264 into eclair-sdk
* changes: SDK Manager: phase 1 of support for future schemas
2 parents b624370 + 580e982 commit 0da4f15

File tree

12 files changed

+1440
-173
lines changed

12 files changed

+1440
-173
lines changed

tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonPackage.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,13 @@ private Lib[] parseLibs(Node libsNode) {
143143
ArrayList<Lib> libs = new ArrayList<Lib>();
144144

145145
if (libsNode != null) {
146+
String nsUri = libsNode.getNamespaceURI();
146147
for(Node child = libsNode.getFirstChild();
147148
child != null;
148149
child = child.getNextSibling()) {
149150

150151
if (child.getNodeType() == Node.ELEMENT_NODE &&
151-
SdkRepository.NS_SDK_REPOSITORY.equals(child.getNamespaceURI()) &&
152+
nsUri.equals(child.getNamespaceURI()) &&
152153
SdkRepository.NODE_LIB.equals(child.getLocalName())) {
153154
libs.add(parseLib(child));
154155
}

tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Archive.java

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ public String getUiName() {
9696
return mUiName;
9797
}
9898

99+
/** Returns the XML name of the OS. */
100+
public String getXmlName() {
101+
return toString().toLowerCase();
102+
}
103+
99104
/**
100105
* Returns the current OS as one of the {@link Os} enum values or null.
101106
*/
@@ -113,6 +118,16 @@ public static Os getCurrentOs() {
113118

114119
return null;
115120
}
121+
122+
/** Returns true if this OS is compatible with the current one. */
123+
public boolean isCompatible() {
124+
if (this == ANY) {
125+
return true;
126+
}
127+
128+
Os os = getCurrentOs();
129+
return this == os;
130+
}
116131
}
117132

118133
/** The Architecture that this archive can be downloaded on. */
@@ -133,6 +148,11 @@ public String getUiName() {
133148
return mUiName;
134149
}
135150

151+
/** Returns the XML name of the architecture. */
152+
public String getXmlName() {
153+
return toString().toLowerCase();
154+
}
155+
136156
/**
137157
* Returns the current architecture as one of the {@link Arch} enum values or null.
138158
*/
@@ -154,6 +174,16 @@ public static Arch getCurrentArch() {
154174

155175
return null;
156176
}
177+
178+
/** Returns true if this architecture is compatible with the current one. */
179+
public boolean isCompatible() {
180+
if (this == ANY) {
181+
return true;
182+
}
183+
184+
Arch arch = getCurrentArch();
185+
return this == arch;
186+
}
157187
}
158188

159189
private final Os mOs;
@@ -324,27 +354,7 @@ public String getLongDescription() {
324354
* Returns true if this archive can be installed on the current platform.
325355
*/
326356
public boolean isCompatible() {
327-
// Check OS
328-
Os os = getOs();
329-
330-
if (os != Os.ANY) {
331-
Os os2 = Os.getCurrentOs();
332-
if (os2 != os) {
333-
return false;
334-
}
335-
}
336-
337-
// Check Arch
338-
Arch arch = getArch();
339-
340-
if (arch != Arch.ANY) {
341-
Arch arch2 = Arch.getCurrentArch();
342-
if (arch2 != arch) {
343-
return false;
344-
}
345-
}
346-
347-
return true;
357+
return getOs().isCompatible() && getArch().isCompatible();
348358
}
349359

350360
/**
@@ -1053,8 +1063,7 @@ private boolean generateSourceProperties(File unzipDestFolder) {
10531063
/**
10541064
* Sets the executable Unix permission (0777) on a file or folder.
10551065
* @param file The file to set permissions on.
1056-
* @param unixMode the permissions as received from {@link ZipArchiveEntry#getUnixMode()}.
1057-
* @throws IOException
1066+
* @throws IOException If an I/O error occurs
10581067
*/
10591068
private void setExecutablePermission(File file) throws IOException {
10601069
Runtime.getRuntime().exec(new String[] {

tools/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Package.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,13 @@ private Archive[] parseArchives(Node archivesNode) {
211211
ArrayList<Archive> archives = new ArrayList<Archive>();
212212

213213
if (archivesNode != null) {
214+
String nsUri = archivesNode.getNamespaceURI();
214215
for(Node child = archivesNode.getFirstChild();
215216
child != null;
216217
child = child.getNextSibling()) {
217218

218219
if (child.getNodeType() == Node.ELEMENT_NODE &&
219-
SdkRepository.NS_SDK_REPOSITORY.equals(child.getNamespaceURI()) &&
220+
nsUri.equals(child.getNamespaceURI()) &&
220221
SdkRepository.NODE_ARCHIVE.equals(child.getLocalName())) {
221222
archives.add(parseArchive(child));
222223
}

0 commit comments

Comments
 (0)