use of com.android.tools.idea.gradle.project.sync.setup.module.common.DependencySetupErrors in project android by JetBrains.
the class DependenciesModuleSetupStep method updateModuleDependency.
private void updateModuleDependency(@NotNull Module module, @NotNull IdeModifiableModelsProvider modelsProvider, @NotNull ModuleDependency dependency, @NotNull AndroidProject androidProject) {
Module moduleDependency = dependency.getModule(modelsProvider);
LibraryDependency compiledArtifact = dependency.getBackupDependency();
if (moduleDependency != null) {
ModuleOrderEntry orderEntry = modelsProvider.getModifiableRootModel(module).addModuleOrderEntry(moduleDependency);
orderEntry.setScope(dependency.getScope());
orderEntry.setExported(true);
if (compiledArtifact != null) {
setModuleCompiledArtifact(moduleDependency, compiledArtifact);
}
return;
}
DependencySetupErrors dependencySetupErrors = DependencySetupErrors.getInstance(module.getProject());
String backupName = compiledArtifact != null ? compiledArtifact.getName() : null;
dependencySetupErrors.addMissingModule(dependency.getGradlePath(), module.getName(), backupName);
// fall back to library dependency, if available.
if (compiledArtifact != null) {
updateLibraryDependency(module, modelsProvider, compiledArtifact, androidProject);
}
}
use of com.android.tools.idea.gradle.project.sync.setup.module.common.DependencySetupErrors in project android by JetBrains.
the class DependenciesModuleSetupStep method updateDependency.
private static void updateDependency(@NotNull Module module, @NotNull IdeModifiableModelsProvider modelsProvider, @NotNull JavaModuleDependency dependency) {
DependencySetupErrors setupErrors = DependencySetupErrors.getInstance(module.getProject());
String moduleName = dependency.getModuleName();
Module found = null;
for (Module m : modelsProvider.getModules()) {
if (moduleName.equals(m.getName())) {
found = m;
}
}
ModifiableRootModel moduleModel = modelsProvider.getModifiableRootModel(module);
if (found != null) {
AndroidFacet androidFacet = findFacet(found, modelsProvider, AndroidFacet.ID);
if (androidFacet == null) {
ModuleOrderEntry entry = moduleModel.addModuleOrderEntry(found);
entry.setExported(true);
} else {
// If it depends on an android module, we should skip that.
setupErrors.addInvalidModuleDependency(moduleModel.getModule(), found.getName(), "Java modules cannot depend on Android modules");
}
return;
}
setupErrors.addMissingModule(moduleName, module.getName(), null);
}
use of com.android.tools.idea.gradle.project.sync.setup.module.common.DependencySetupErrors in project android by JetBrains.
the class DependenciesModuleSetupStep method updateDependency.
private void updateDependency(@NotNull Module module, @NotNull IdeModifiableModelsProvider modelsProvider, @NotNull JarLibraryDependency dependency) {
DependencyScope scope = parseScope(dependency.getScope());
File binaryPath = dependency.getBinaryPath();
if (binaryPath == null) {
DependencySetupErrors setupErrors = DependencySetupErrors.getInstance(module.getProject());
setupErrors.addMissingBinaryPath(module.getName());
return;
}
// Gradle API doesn't provide library name at the moment.
String name = binaryPath.isFile() ? getNameWithoutExtension(binaryPath) : sanitizeFileName(binaryPath.getPath());
myDependenciesSetup.setUpLibraryDependency(module, modelsProvider, name, scope, binaryPath, dependency.getSourcePath(), dependency.getJavadocPath());
}
Aggregations