Search in sources :

Example 1 with DependencySet

use of com.android.tools.idea.gradle.project.sync.setup.module.dependency.DependencySet in project android by JetBrains.

the class TestArtifactSearchScopes method getExcludedDependenciesScope.

@NotNull
private FileRootSearchScope getExcludedDependenciesScope(@NotNull String artifactName) {
    if (getAndroidModel() == null) {
        return new FileRootSearchScope(myModule.getProject(), Collections.emptyList());
    }
    resolveDependencies();
    boolean isAndroidTest = ARTIFACT_ANDROID_TEST.equals(artifactName);
    DependencySet dependenciesToInclude = isAndroidTest ? androidTestDependencies : unitTestDependencies;
    DependencySet dependenciesToExclude = isAndroidTest ? unitTestDependencies : androidTestDependencies;
    ExcludedModules excludedModules = new ExcludedModules(myModule);
    excludedModules.add(dependenciesToExclude);
    excludedModules.remove(dependenciesToInclude);
    excludedModules.remove(mainDependencies);
    ExcludedRoots excludedRoots = new ExcludedRoots(myModule, excludedModules, dependenciesToExclude, dependenciesToInclude, isAndroidTest);
    excludedRoots.removeLibraryPaths(mainDependencies);
    return new FileRootSearchScope(myModule.getProject(), excludedRoots.get());
}
Also used : DependencySet(com.android.tools.idea.gradle.project.sync.setup.module.dependency.DependencySet) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with DependencySet

use of com.android.tools.idea.gradle.project.sync.setup.module.dependency.DependencySet 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);
    }
}
Also used : ModuleDependency(com.android.tools.idea.gradle.project.sync.setup.module.dependency.ModuleDependency) LibraryDependency(com.android.tools.idea.gradle.project.sync.setup.module.dependency.LibraryDependency) SyncIssue(com.android.builder.model.SyncIssue) DependencySet(com.android.tools.idea.gradle.project.sync.setup.module.dependency.DependencySet) AndroidProject(com.android.builder.model.AndroidProject)

Aggregations

DependencySet (com.android.tools.idea.gradle.project.sync.setup.module.dependency.DependencySet)2 AndroidProject (com.android.builder.model.AndroidProject)1 SyncIssue (com.android.builder.model.SyncIssue)1 LibraryDependency (com.android.tools.idea.gradle.project.sync.setup.module.dependency.LibraryDependency)1 ModuleDependency (com.android.tools.idea.gradle.project.sync.setup.module.dependency.ModuleDependency)1 NotNull (org.jetbrains.annotations.NotNull)1