use of com.android.tools.idea.gradle.model.java.JavaModuleDependency in project android by JetBrains.
the class DependenciesModuleSetupStep method doSetUpModule.
@Override
protected void doSetUpModule(@NotNull Module module, @NotNull IdeModifiableModelsProvider ideModelsProvider, @NotNull JavaModuleModel javaModuleModel, @Nullable SyncAction.ModuleModels gradleModels, @Nullable ProgressIndicator indicator) {
List<String> unresolved = new ArrayList<>();
for (JavaModuleDependency dependency : javaModuleModel.getJavaModuleDependencies()) {
updateDependency(module, ideModelsProvider, dependency);
}
for (JarLibraryDependency dependency : javaModuleModel.getJarLibraryDependencies()) {
if (dependency.isResolved()) {
updateDependency(module, ideModelsProvider, dependency);
} else {
unresolved.add(dependency.getName());
}
}
UnresolvedDependenciesReporter.getInstance().report(unresolved, module);
}
use of com.android.tools.idea.gradle.model.java.JavaModuleDependency in project android by JetBrains.
the class DependenciesModuleSetupStepTest method testSetUpModuleDependency.
public void testSetUpModuleDependency() {
String moduleName = "lib";
// This is the module to add as dependency.
Module libModule = createModule(moduleName);
JavaModuleDependency moduleDependency = new JavaModuleDependency(moduleName, "compile", true);
Collection<JavaModuleDependency> moduleDependencies = new ArrayList<>();
moduleDependencies.add(moduleDependency);
// We only want module dependencies
when(myJavaModuleModel.getJavaModuleDependencies()).thenReturn(moduleDependencies);
when(myJavaModuleModel.getJarLibraryDependencies()).thenReturn(Collections.emptyList());
Module mainModule = getModule();
mySetupStep.setUpModule(mainModule, myModelsProvider, myJavaModuleModel, null, null);
// needed to check if the module dependency was added.
ApplicationManager.getApplication().runWriteAction(() -> myModelsProvider.commit());
// See https://code.google.com/p/android/issues/detail?id=225923
ExpectedModuleDependency expected = new ExpectedModuleDependency(libModule, COMPILE, true);
assertAbout(moduleDependencies()).that(mainModule).contains(expected);
}
Aggregations