use of com.android.builder.model.SyncIssue in project android by JetBrains.
the class PsAndroidModuleAnalyzerTest method createIssueFrom.
@Test
public void createIssueFrom() {
SyncIssue syncIssue = mock(SyncIssue.class);
when(syncIssue.getMessage()).thenReturn("Conflict with dependency 'com.google.guava:guava'. Resolved versions for app (16.0) " + "and test app (16.0.1) differ. See http://g.co/androidstudio/app-test-app-conflict for " + "details.");
when(syncIssue.getSeverity()).thenReturn(SEVERITY_ERROR);
PsPath path = mock(PsPath.class);
PsIssue issue = PsAndroidModuleAnalyzer.createIssueFrom(syncIssue, path, null);
assertThat(issue.getText()).isEqualTo("Conflict with dependency 'com.google.guava:guava'. Resolved versions for app (16.0) " + "and test app (16.0.1) differ. See " + "<a href='http://g.co/androidstudio/app-test-app-conflict'>http://g.co/androidstudio/app-test-app-conflict</a> " + "for details.");
assertThat(issue.getSeverity()).isEqualTo(ERROR);
}
use of com.android.builder.model.SyncIssue in project android by JetBrains.
the class SyncIssuesReporter method report.
public void report(@NotNull Collection<SyncIssue> syncIssues, @NotNull Module module) {
if (syncIssues.isEmpty()) {
return;
}
boolean hasSyncErrors = false;
VirtualFile buildFile = getGradleBuildFile(module);
for (SyncIssue syncIssue : syncIssues) {
if (syncIssue.getSeverity() == SEVERITY_ERROR) {
hasSyncErrors = true;
}
report(syncIssue, module, buildFile);
}
if (hasSyncErrors) {
Project project = module.getProject();
GradleSyncState.getInstance(project).getSummary().setSyncErrorsFound(true);
}
}
use of com.android.builder.model.SyncIssue in project atlas by alibaba.
the class AtlasDependencyManager2 method resolveDependencies.
public Set<AndroidDependency> resolveDependencies(@NonNull VariantScope variantScope) {
// this.apDependencies = resolveApDependencies(variantDeps);
AtlasDependencyGraph artifactDependencyGraph = new AtlasDependencyGraph();
DependencyGraphs dependencyGraphs = artifactDependencyGraph.createLevel4DependencyGraph(variantScope, false, true, new Consumer<SyncIssue>() {
@Override
public void accept(SyncIssue syncIssue) {
sLogger.error(syncIssue.getMessage());
}
});
return null;
}
use of com.android.builder.model.SyncIssue in project android by JetBrains.
the class DependenciesModuleSetupStep method doSetUpModule.
@Override
protected void doSetUpModule(@NotNull Module module, @NotNull IdeModifiableModelsProvider ideModelsProvider, @NotNull AndroidModuleModel androidModel, @Nullable SyncAction.ModuleModels gradleModels, @Nullable ProgressIndicator indicator) {
AndroidProject androidProject = androidModel.getAndroidProject();
DependencySet dependencies = myDependenciesExtractor.extractFrom(androidModel);
for (LibraryDependency dependency : dependencies.onLibraries()) {
updateLibraryDependency(module, ideModelsProvider, dependency, androidProject);
}
for (ModuleDependency dependency : dependencies.onModules()) {
updateModuleDependency(module, ideModelsProvider, dependency, androidProject);
}
addExtraSdkLibrariesAsDependencies(module, ideModelsProvider, androidProject);
Collection<SyncIssue> syncIssues = androidModel.getSyncIssues();
if (syncIssues != null) {
SyncIssuesReporter.getInstance().report(syncIssues, module);
} else {
//noinspection deprecation
Collection<String> unresolvedDependencies = androidProject.getUnresolvedDependencies();
UnresolvedDependenciesReporter.getInstance().report(unresolvedDependencies, module);
}
}
use of com.android.builder.model.SyncIssue in project android by JetBrains.
the class PsAndroidModuleAnalyzer method doAnalyze.
@Override
protected void doAnalyze(@NotNull PsAndroidModule module, @NotNull PsIssueCollection issueCollection) {
Multimap<String, SyncIssue> issuesByData = ArrayListMultimap.create();
AndroidModuleModel gradleModel = module.getGradleModel();
Collection<SyncIssue> syncIssues = gradleModel.getAndroidProject().getSyncIssues();
for (SyncIssue syncIssue : syncIssues) {
String data = nullToEmpty(syncIssue.getData());
issuesByData.put(data, syncIssue);
}
PsModulePath modulePath = new PsModulePath(module);
module.forEachDependency(dependency -> {
if (dependency instanceof PsLibraryDependency && dependency.isDeclared()) {
PsLibraryDependency libraryDependency = (PsLibraryDependency) dependency;
PsPath path = new PsLibraryDependencyNavigationPath(getContext(), libraryDependency);
PsArtifactDependencySpec resolvedSpec = libraryDependency.getResolvedSpec();
String issueKey = resolvedSpec.group + GRADLE_PATH_SEPARATOR + resolvedSpec.name;
Collection<SyncIssue> librarySyncIssues = issuesByData.get(issueKey);
for (SyncIssue syncIssue : librarySyncIssues) {
PsIssue issue = createIssueFrom(syncIssue, path, modulePath);
issueCollection.add(issue);
}
analyzeDeclaredDependency(libraryDependency, modulePath, issueCollection);
}
});
}
Aggregations