use of com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator in project android by JetBrains.
the class InstallComponentsPath method deriveValues.
@Override
public void deriveValues(Set<ScopedStateStore.Key> modified) {
super.deriveValues(modified);
if (modified.contains(WizardConstants.KEY_SDK_INSTALL_LOCATION)) {
String sdkPath = myState.get(WizardConstants.KEY_SDK_INSTALL_LOCATION);
if (sdkPath != null) {
File sdkLocation = new File(sdkPath);
if (!FileUtil.filesEqual(myLocalHandler.getLocation(), sdkLocation)) {
myLocalHandler = AndroidSdkHandler.getInstance(sdkLocation);
StudioLoggerProgressIndicator progress = new StudioLoggerProgressIndicator(getClass());
myLocalHandler.getSdkManager(progress).loadSynchronously(RepoManager.DEFAULT_EXPIRATION_PERIOD_MS, progress, new StudioDownloader(), StudioSettingsController.getInstance());
myComponentInstaller = new ComponentInstaller(myLocalHandler);
myComponentTree.updateState(myLocalHandler);
}
}
}
}
use of com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator in project android by JetBrains.
the class InstallComponentsPath method createComponentTree.
private ComponentTreeNode createComponentTree(@NotNull FirstRunWizardMode reason, @NotNull ScopedStateStore stateStore, boolean createAvd) {
List<ComponentTreeNode> components = Lists.newArrayList();
components.add(new AndroidSdk(stateStore, myInstallUpdates));
DynamicWizard wizard = getWizard();
ProgressWindow progressWindow = new ProgressWindow(false, false, null);
if (wizard != null) {
Disposer.register(wizard.getDisposable(), progressWindow);
}
com.android.repository.api.ProgressIndicator progress = new RepoProgressIndicatorAdapter(progressWindow);
RepoManager sdkManager = myLocalHandler.getSdkManager(new StudioLoggerProgressIndicator(getClass()));
sdkManager.loadSynchronously(RepoManager.DEFAULT_EXPIRATION_PERIOD_MS, progress, new StudioDownloader(progressWindow), StudioSettingsController.getInstance());
Map<String, RemotePackage> remotePackages = sdkManager.getPackages().getRemotePackages();
ComponentTreeNode platforms = Platform.createSubtree(stateStore, remotePackages, myInstallUpdates);
if (platforms != null) {
components.add(platforms);
}
if (Haxm.canRun() && reason == FirstRunWizardMode.NEW_INSTALL) {
Haxm.HaxmInstallationIntention haxmInstallationIntention = myInstallUpdates ? Haxm.HaxmInstallationIntention.INSTALL_WITH_UPDATES : Haxm.HaxmInstallationIntention.INSTALL_WITHOUT_UPDATES;
components.add(new Haxm(haxmInstallationIntention, stateStore, FirstRunWizard.KEY_CUSTOM_INSTALL));
}
if (createAvd) {
components.add(new AndroidVirtualDevice(stateStore, remotePackages, myInstallUpdates, myFileOp));
}
return new ComponentCategory("Root", "Root node that is not supposed to appear in the UI", components);
}
use of com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator in project android by JetBrains.
the class AndroidSdkUtils method isGlassInstalled.
public static boolean isGlassInstalled() {
StudioLoggerProgressIndicator progress = new StudioLoggerProgressIndicator(AndroidSdkUtils.class);
AndroidSdkHandler handler = AndroidSdks.getInstance().tryToChooseSdkHandler();
Collection<IAndroidTarget> targets = handler.getAndroidTargetManager(progress).getTargets(progress);
for (IAndroidTarget target : targets) {
if (!target.isPlatform() && target.getName().startsWith("Glass Development Kit")) {
return true;
}
}
return false;
}
use of com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator in project android by JetBrains.
the class RepositoryUrlManager method resolveDynamicCoordinateVersion.
@Nullable
@VisibleForTesting
String resolveDynamicCoordinateVersion(@NotNull GradleCoordinate coordinate, @Nullable Project project, @NotNull AndroidSdkHandler sdkHandler) {
if (coordinate.getGroupId() == null || coordinate.getArtifactId() == null) {
return null;
}
String filter = coordinate.getRevision();
if (!filter.endsWith("+")) {
// Already resolved. That was easy.
return filter;
}
filter = filter.substring(0, filter.length() - 1);
File sdkLocation = sdkHandler.getLocation();
if (sdkLocation != null) {
// If this coordinate points to an artifact in one of our repositories, mark it will a comment if they don't
// have that repository available.
String libraryCoordinate = getLibraryRevision(coordinate.getGroupId(), coordinate.getArtifactId(), filter, false, sdkLocation, sdkHandler.getFileOp());
if (libraryCoordinate != null) {
return libraryCoordinate;
}
// If that didn't yield any matches, try again, this time allowing preview platforms.
// This is necessary if the artifact filter includes enough of a version where there are
// only preview matches.
libraryCoordinate = getLibraryRevision(coordinate.getGroupId(), coordinate.getArtifactId(), filter, true, sdkLocation, sdkHandler.getFileOp());
if (libraryCoordinate != null) {
return libraryCoordinate;
}
}
// Regular Gradle dependency? Look in Gradle cache
GradleVersion versionFound = GradleLocalCache.getInstance().findLatestArtifactVersion(coordinate, project, filter);
if (versionFound != null) {
return versionFound.toString();
}
// Maybe it's available for download as an SDK component
RemotePackage sdkPackage = SdkMavenRepository.findLatestRemoteVersion(coordinate, sdkHandler, new StudioLoggerProgressIndicator(getClass()));
if (sdkPackage != null) {
GradleCoordinate found = SdkMavenRepository.getCoordinateFromSdkPath(sdkPackage.getPath());
if (found != null) {
return found.getRevision();
}
}
// Perform network lookup to resolve current best version, if possible
if (project != null) {
LintClient client = new LintIdeClient(project);
Revision latest = GradleDetector.getLatestVersionFromRemoteRepo(client, coordinate, coordinate.isPreview());
if (latest != null) {
String version = latest.toShortString();
if (version.startsWith(filter)) {
return version;
}
}
}
return null;
}
use of com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator in project android by JetBrains.
the class AndroidSdkUpdaterPlugin method initComponent.
@Override
public void initComponent() {
if (isAndroidSdkManagerEnabled()) {
ExternalComponentManager.getInstance().registerComponentSource(new SdkComponentSource());
URL offlineRepo = getOfflineRepoDir();
if (offlineRepo != null) {
// We don't have an actual RepoManager yet, so just get all the modules statically.
RepositorySourceProvider provider = new ConstantSourceProvider(offlineRepo.toString(), "Offline Repo", AndroidSdkHandler.getAllModules());
AndroidSdkHandler.addCustomSourceProvider(provider, new StudioLoggerProgressIndicator(getClass()));
}
}
}
Aggregations