use of com.intellij.openapi.roots.DependencyScope in project intellij-community by JetBrains.
the class AddLibraryToDependenciesFix method invoke.
@Override
public void invoke(@NotNull Project project, @Nullable Editor editor, PsiFile file) {
DependencyScope scope = suggestScopeByLocation(myCurrentModule, myReference.getElement());
JavaProjectModelModificationService.getInstance(project).addDependency(myCurrentModule, myLibrary, scope);
if (myQualifiedClassName != null && editor != null) {
importClass(myCurrentModule, editor, myReference, myQualifiedClassName);
}
}
use of com.intellij.openapi.roots.DependencyScope in project intellij-community by JetBrains.
the class ManifestImporter method getClasspath.
@NotNull
public String getClasspath(@NotNull MavenProject mavenProject, @Nullable Element manifestConfiguration) {
StringBuilder classpath = new StringBuilder();
String classpathPrefix = getClasspathPrefix(manifestConfiguration);
for (MavenArtifact mavenArtifact : mavenProject.getDependencies()) {
final DependencyScope scope = MavenModuleImporter.selectScope(mavenArtifact.getScope());
if (scope.isForProductionCompile() || scope.isForProductionRuntime()) {
if (classpath.length() > 0) {
classpath.append(" ");
}
classpath.append(classpathPrefix);
String artifactFileName = mavenArtifact.getArtifactId() + "-" + mavenArtifact.getVersion() + "." + mavenArtifact.getExtension();
classpath.append(doGetClasspathItem(mavenProject, mavenArtifact, artifactFileName));
}
}
return classpath.toString();
}
use of com.intellij.openapi.roots.DependencyScope in project android by JetBrains.
the class DependenciesModuleSetupStep method updateLibraryDependency.
public void updateLibraryDependency(@NotNull Module module, @NotNull IdeModifiableModelsProvider modelsProvider, @NotNull LibraryDependency dependency, @NotNull AndroidProject androidProject) {
String name = dependency.getName();
DependencyScope scope = dependency.getScope();
myDependenciesSetup.setUpLibraryDependency(module, modelsProvider, name, scope, dependency.getArtifactPath(), dependency.getPaths(BINARY), dependency.getPaths(DOCUMENTATION));
File buildFolder = androidProject.getBuildFolder();
// Exclude jar files that are in "jars" folder in "build" folder.
// see https://code.google.com/p/android/issues/detail?id=123788
ContentEntry[] contentEntries = modelsProvider.getModifiableRootModel(module).getContentEntries();
if (contentEntries.length > 0) {
for (File binaryPath : dependency.getPaths(BINARY)) {
File parent = binaryPath.getParentFile();
if (parent != null && FD_JARS.equals(parent.getName()) && isAncestor(buildFolder, parent, true)) {
ContentEntry parentContentEntry = findParentContentEntry(parent, contentEntries);
if (parentContentEntry != null) {
parentContentEntry.addExcludeFolder(pathToIdeaUrl(parent));
}
}
}
}
}
Aggregations