use of org.gradle.plugins.ide.internal.resolver.DefaultGradleApiSourcesResolver in project gradle by gradle.
the class EclipseClasspath method resolveDependencies.
/**
* Calculates, resolves and returns dependency entries of this classpath.
*/
public List<ClasspathEntry> resolveDependencies() {
ProjectInternal projectInternal = (ProjectInternal) this.project;
IdeArtifactRegistry ideArtifactRegistry = projectInternal.getServices().get(IdeArtifactRegistry.class);
boolean inferModulePath = false;
Task javaCompileTask = project.getTasks().findByName(JavaPlugin.COMPILE_JAVA_TASK_NAME);
if (javaCompileTask instanceof JavaCompile) {
JavaCompile javaCompile = (JavaCompile) javaCompileTask;
inferModulePath = javaCompile.getModularity().getInferModulePath().get();
if (inferModulePath) {
List<File> sourceRoots = CompilationSourceDirs.inferSourceRoots((FileTreeInternal) javaCompile.getSource());
inferModulePath = JavaModuleDetector.isModuleSource(true, sourceRoots);
}
}
ClasspathFactory classpathFactory = new ClasspathFactory(this, ideArtifactRegistry, new DefaultGradleApiSourcesResolver(projectInternal.newDetachedResolver()), inferModulePath);
return classpathFactory.createEntries();
}
use of org.gradle.plugins.ide.internal.resolver.DefaultGradleApiSourcesResolver in project gradle by gradle.
the class IdeaModule method resolveDependencies.
/**
* Resolves and returns the module's dependencies.
*
* @return dependencies
*/
public Set<Dependency> resolveDependencies() {
ProjectInternal projectInternal = (ProjectInternal) project;
IdeArtifactRegistry ideArtifactRegistry = projectInternal.getServices().get(IdeArtifactRegistry.class);
IdeaDependenciesProvider ideaDependenciesProvider = new IdeaDependenciesProvider(projectInternal, ideArtifactRegistry, new DefaultGradleApiSourcesResolver(projectInternal.newDetachedResolver()));
return ideaDependenciesProvider.provide(this);
}
Aggregations