aboutsummaryrefslogtreecommitdiffstats
path: root/sdkmanager
diff options
context:
space:
mode:
authorRaphael <raphael@google.com>2011-10-21 13:12:52 -0700
committerRaphael <raphael@google.com>2011-10-21 13:12:52 -0700
commit24bf21ec932cb962fb7b335abdc30250be2de360 (patch)
treeb079d43a46869420240ef5e2ce85bae120e4c194 /sdkmanager
parent6a32475b88d138562a0d19d94078ba83999baa75 (diff)
downloadsdk-24bf21ec932cb962fb7b335abdc30250be2de360.zip
sdk-24bf21ec932cb962fb7b335abdc30250be2de360.tar.gz
sdk-24bf21ec932cb962fb7b335abdc30250be2de360.tar.bz2
SDK Manager: label incompatible packages.
- Clearly states that a package is not compatible. - Provides an env var to work around and install anyway: $ export ANDROID_SDK_IGNORE_COMPAT=1 $ tools/android Change-Id: I5d94fbe452c72572054b2aecb781acfe3519135c
Diffstat (limited to 'sdkmanager')
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java18
-rwxr-xr-xsdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ArchiveInstaller.java7
-rwxr-xr-xsdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/icons/pkg_incompat_16.pngbin0 -> 454 bytes
-rwxr-xr-xsdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PackagesPage.java32
-rwxr-xr-xsdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PkgItem.java3
5 files changed, 51 insertions, 9 deletions
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java
index c33fba9..e335411 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkConstants.java
@@ -453,4 +453,22 @@ public final class SdkConstants {
return PLATFORM_UNKNOWN;
}
+
+ /**
+ * Returns current platform's UI name
+ *
+ * @return one of "Windows", "Mac OS X", "Linux" or "other".
+ */
+ public static String currentPlatformName() {
+ String os = System.getProperty("os.name"); //$NON-NLS-1$
+ if (os.startsWith("Mac OS")) { //$NON-NLS-1$
+ return "Mac OS X"; //$NON-NLS-1$
+ } else if (os.startsWith("Windows")) { //$NON-NLS-1$
+ return "Windows"; //$NON-NLS-1$
+ } else if (os.startsWith("Linux")) { //$NON-NLS-1$
+ return "Linux"; //$NON-NLS-1$
+ }
+
+ return "Other";
+ }
}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ArchiveInstaller.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ArchiveInstaller.java
index a06a88b..ee442e1 100755
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ArchiveInstaller.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ArchiveInstaller.java
@@ -46,6 +46,8 @@ import java.util.Set;
*/
public class ArchiveInstaller {
+ public static final String ENV_VAR_IGNORE_COMPAT = "ANDROID_SDK_IGNORE_COMPAT";
+
public static final int NUM_MONITOR_INC = 100;
/** The current {@link FileOp} to use. Never null. */
@@ -110,7 +112,10 @@ public class ArchiveInstaller {
return false;
}
- if (!newArchive.isCompatible()) {
+ // In detail mode, give us a way to force install of incompatible archives.
+ boolean checkIsCompatible = System.getenv(ENV_VAR_IGNORE_COMPAT) == null;
+
+ if (checkIsCompatible && !newArchive.isCompatible()) {
monitor.log("Skipping incompatible archive: %1$s for %2$s",
name,
newArchive.getOsDescription());
diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/icons/pkg_incompat_16.png b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/icons/pkg_incompat_16.png
new file mode 100755
index 0000000..7ef989e
--- /dev/null
+++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/icons/pkg_incompat_16.png
Binary files differ
diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PackagesPage.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PackagesPage.java
index 3c1ba8a..00315e2 100755
--- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PackagesPage.java
+++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PackagesPage.java
@@ -18,6 +18,7 @@ package com.android.sdkuilib.internal.repository.sdkman2;
import com.android.sdklib.SdkConstants;
import com.android.sdklib.internal.repository.Archive;
+import com.android.sdklib.internal.repository.ArchiveInstaller;
import com.android.sdklib.internal.repository.IDescription;
import com.android.sdklib.internal.repository.ITask;
import com.android.sdklib.internal.repository.ITaskMonitor;
@@ -97,6 +98,7 @@ public class PackagesPage extends UpdaterPage
static final String ICON_SORT_BY_SOURCE = "source_icon16.png"; //$NON-NLS-1$
static final String ICON_SORT_BY_API = "platform_pkg_16.png"; //$NON-NLS-1$
static final String ICON_PKG_NEW = "pkg_new_16.png"; //$NON-NLS-1$
+ static final String ICON_PKG_INCOMPAT = "pkg_incompat_16.png"; //$NON-NLS-1$
static final String ICON_PKG_UPDATE = "pkg_update_16.png"; //$NON-NLS-1$
static final String ICON_PKG_INSTALLED = "pkg_installed_16.png"; //$NON-NLS-1$
@@ -1061,17 +1063,21 @@ public class PackagesPage extends UpdaterPage
int count = 0;
+ // Give us a way to force install of incompatible archives.
+ boolean checkIsCompatible =
+ System.getenv(ArchiveInstaller.ENV_VAR_IGNORE_COMPAT) == null;
+
if (mDisplayArchives) {
// In detail mode, we display archives so we can install only the
// archives that are actually selected.
- // Note that in this mode we allow the user to install an archive
- // even if it's not "compatible" with the current platform or is
- // already installed.
for (Object c : checked) {
if (c instanceof Archive) {
Archive a = (Archive) c;
if (a != null) {
+ if (checkIsCompatible && !a.isCompatible()) {
+ continue;
+ }
count++;
if (outArchives != null) {
outArchives.add((Archive) c);
@@ -1104,7 +1110,10 @@ public class PackagesPage extends UpdaterPage
}
if (p != null) {
for (Archive a : p.getArchives()) {
- if (a != null && a.isCompatible()) {
+ if (a != null) {
+ if (checkIsCompatible && !a.isCompatible()) {
+ continue;
+ }
count++;
if (outArchives != null) {
outArchives.add(a);
@@ -1418,7 +1427,13 @@ public class PackagesPage extends UpdaterPage
return "Installed";
case NEW:
- return "Not installed";
+ Package p = pkg.getMainPackage();
+ if (p != null && p.hasCompatibleArchive()) {
+ return "Not installed";
+ } else {
+ return String.format("Not compatible with %1$s",
+ SdkConstants.currentPlatformName());
+ }
}
return pkg.getState().toString();
@@ -1499,7 +1514,12 @@ public class PackagesPage extends UpdaterPage
return imgFactory.getImageByName(ICON_PKG_INSTALLED);
}
case NEW:
- return imgFactory.getImageByName(ICON_PKG_NEW);
+ Package p = pi.getMainPackage();
+ if (p != null && p.hasCompatibleArchive()) {
+ return imgFactory.getImageByName(ICON_PKG_NEW);
+ } else {
+ return imgFactory.getImageByName(ICON_PKG_INCOMPAT);
+ }
}
}
}
diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PkgItem.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PkgItem.java
index 5c3a469..d5eb0a3 100755
--- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PkgItem.java
+++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/sdkman2/PkgItem.java
@@ -19,8 +19,8 @@ package com.android.sdkuilib.internal.repository.sdkman2;
import com.android.sdklib.internal.repository.Archive;
import com.android.sdklib.internal.repository.IPackageVersion;
import com.android.sdklib.internal.repository.Package;
-import com.android.sdklib.internal.repository.Package.UpdateInfo;
import com.android.sdklib.internal.repository.SdkSource;
+import com.android.sdklib.internal.repository.Package.UpdateInfo;
/**
* A {@link PkgItem} represents one main {@link Package} combined with its state
@@ -257,5 +257,4 @@ public class PkgItem implements Comparable<PkgItem> {
sb.append('>');
return sb.toString();
}
-
}