Search in sources :

Example 1 with PsModulePath

use of com.android.tools.idea.gradle.structure.model.PsModulePath in project android by JetBrains.

the class PsAnalyzerDaemon method checkForUpdates.

private boolean checkForUpdates(@NotNull PsLibraryDependency dependency) {
    PsContext context = getContext();
    AvailableLibraryUpdates results = context.getLibraryUpdateCheckerDaemon().getAvailableUpdates();
    PsArtifactDependencySpec spec = dependency.getDeclaredSpec();
    if (spec != null) {
        AvailableLibraryUpdate update = results.findUpdateFor(spec);
        if (update != null) {
            String text = String.format("Newer version available: <b>%1$s</b> (%2$s)", update.version, update.repository);
            PsLibraryDependencyNavigationPath mainPath = new PsLibraryDependencyNavigationPath(context, dependency);
            PsIssue issue = new PsIssue(text, mainPath, LIBRARY_UPDATES_AVAILABLE, UPDATE);
            issue.setExtraPath(new PsModulePath(dependency.getParent()));
            PsLibraryDependencyVersionQuickFixPath quickFix = new PsLibraryDependencyVersionQuickFixPath(dependency, update.version);
            quickFix.setHrefText("[Update]");
            issue.setQuickFixPath(quickFix);
            myIssues.add(issue);
            return true;
        }
    }
    return false;
}
Also used : AvailableLibraryUpdate(com.android.tools.idea.gradle.structure.daemon.AvailableLibraryUpdateStorage.AvailableLibraryUpdate) PsLibraryDependencyVersionQuickFixPath(com.android.tools.idea.gradle.structure.quickfix.PsLibraryDependencyVersionQuickFixPath) PsContext(com.android.tools.idea.gradle.structure.configurables.PsContext) PsModulePath(com.android.tools.idea.gradle.structure.model.PsModulePath) AvailableLibraryUpdates(com.android.tools.idea.gradle.structure.daemon.AvailableLibraryUpdateStorage.AvailableLibraryUpdates) PsLibraryDependencyNavigationPath(com.android.tools.idea.gradle.structure.navigation.PsLibraryDependencyNavigationPath)

Example 2 with PsModulePath

use of com.android.tools.idea.gradle.structure.model.PsModulePath in project android by JetBrains.

the class PsJavaModuleAnalyzer method doAnalyze.

@Override
protected void doAnalyze(@NotNull PsJavaModule module, @NotNull PsIssueCollection issueCollection) {
    PsModulePath modulePath = new PsModulePath(module);
    module.forEachDependency(dependency -> {
        if (dependency instanceof PsLibraryDependency && dependency.isDeclared()) {
            PsLibraryDependency libraryDependency = (PsLibraryDependency) dependency;
            analyzeDeclaredDependency(libraryDependency, modulePath, issueCollection);
        }
    });
}
Also used : PsModulePath(com.android.tools.idea.gradle.structure.model.PsModulePath) PsLibraryDependency(com.android.tools.idea.gradle.structure.model.PsLibraryDependency)

Aggregations

PsModulePath (com.android.tools.idea.gradle.structure.model.PsModulePath)2 PsContext (com.android.tools.idea.gradle.structure.configurables.PsContext)1 AvailableLibraryUpdate (com.android.tools.idea.gradle.structure.daemon.AvailableLibraryUpdateStorage.AvailableLibraryUpdate)1 AvailableLibraryUpdates (com.android.tools.idea.gradle.structure.daemon.AvailableLibraryUpdateStorage.AvailableLibraryUpdates)1 PsLibraryDependency (com.android.tools.idea.gradle.structure.model.PsLibraryDependency)1 PsLibraryDependencyNavigationPath (com.android.tools.idea.gradle.structure.navigation.PsLibraryDependencyNavigationPath)1 PsLibraryDependencyVersionQuickFixPath (com.android.tools.idea.gradle.structure.quickfix.PsLibraryDependencyVersionQuickFixPath)1