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";
+ }
}
*/\r
public class ArchiveInstaller {\r
\r
+ public static final String ENV_VAR_IGNORE_COMPAT = "ANDROID_SDK_IGNORE_COMPAT";\r
+\r
public static final int NUM_MONITOR_INC = 100;\r
\r
/** The current {@link FileOp} to use. Never null. */\r
return false;\r
}\r
\r
- if (!newArchive.isCompatible()) {\r
+ // In detail mode, give us a way to force install of incompatible archives.\r
+ boolean checkIsCompatible = System.getenv(ENV_VAR_IGNORE_COMPAT) == null;\r
+\r
+ if (checkIsCompatible && !newArchive.isCompatible()) {\r
monitor.log("Skipping incompatible archive: %1$s for %2$s",\r
name,\r
newArchive.getOsDescription());\r
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;
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$
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);
}
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);
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();
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);
+ }
}
}
}