use of com.android.repository.api.RemotePackage in project android by JetBrains.
the class Platform method findLatestCompatibleBuildTool.
private String findLatestCompatibleBuildTool() {
Revision revision = null;
String path = null;
for (RemotePackage remote : getRepositoryPackages().getRemotePackages().values()) {
if (!remote.getPath().startsWith(SdkConstants.FD_BUILD_TOOLS)) {
continue;
}
Revision testRevision = remote.getVersion();
if (testRevision.getMajor() == myVersion.getApiLevel() && (revision == null || testRevision.compareTo(revision) > 0)) {
revision = testRevision;
path = remote.getPath();
}
}
return path;
}
use of com.android.repository.api.RemotePackage in project android by JetBrains.
the class InstallComponentsPath method findLatestPlatform.
@Nullable
public static RemotePackage findLatestPlatform(@Nullable Map<String, RemotePackage> remotePackages) {
if (remotePackages == null) {
return null;
}
AndroidVersion max = null;
RemotePackage latest = null;
for (RemotePackage pkg : remotePackages.values()) {
TypeDetails details = pkg.getTypeDetails();
if (!(details instanceof DetailsTypes.PlatformDetailsType)) {
continue;
}
DetailsTypes.PlatformDetailsType platformDetails = (DetailsTypes.PlatformDetailsType) details;
AndroidVersion version = platformDetails.getAndroidVersion();
if (version.isPreview()) {
// We only want stable platforms
continue;
}
if (max == null || version.compareTo(max) > 0) {
latest = pkg;
max = version;
}
}
return latest;
}
use of com.android.repository.api.RemotePackage in project android by JetBrains.
the class InstallSummaryStep method getPackagesTable.
@Nullable
private static String getPackagesTable(@NotNull Collection<RemotePackage> remotePackages) {
if (remotePackages.isEmpty()) {
return null;
}
TreeSet<RemotePackage> sortedPackagesList = Sets.newTreeSet(new PackageInfoComparator());
sortedPackagesList.addAll(remotePackages);
StringBuilder table = new StringBuilder("<table>");
for (RemotePackage remotePkgInfo : sortedPackagesList) {
Archive archive = remotePkgInfo.getArchive();
assert archive != null;
// Adds some whitespace between name and size columns
table.append("<tr><td>").append(remotePkgInfo.getDisplayName()).append("</td><td> </td><td>").append(WelcomeUIUtils.getSizeLabel(archive.getComplete().getSize())).append("</td></tr>");
}
table.append("</table>");
return table.toString();
}
use of com.android.repository.api.RemotePackage in project android by JetBrains.
the class InstallSummaryStep method getDownloadSizeSection.
private static Section getDownloadSizeSection(@NotNull Collection<RemotePackage> remotePackages) {
long downloadSize = 0;
for (RemotePackage remotePackage : remotePackages) {
// TODO: patches?
Archive archive = remotePackage.getArchive();
assert archive != null;
downloadSize += archive.getComplete().getSize();
}
return new Section("Total Download Size", downloadSize == 0 ? "" : WelcomeUIUtils.getSizeLabel(downloadSize));
}
use of com.android.repository.api.RemotePackage in project android by JetBrains.
the class AndroidSdk method getLatestCompatibleBuildToolsPath.
/**
* Find latest build tools revision. Versions compatible with the selected platforms will be installed by the platform components.
* @return The Revision of the latest build tools package, or null if no remote build tools packages are available.
*/
@Nullable
private String getLatestCompatibleBuildToolsPath() {
ProgressIndicator progress = new ProgressIndicatorAdapter() {
};
RemotePackage latest = mySdkHandler.getLatestRemotePackageForPrefix(SdkConstants.FD_BUILD_TOOLS, false, progress);
return latest != null ? latest.getPath() : null;
}
Aggregations