use of org.gradle.api.internal.project.ProjectInternal in project gradle by gradle.
the class EclipseModelBuilder method buildAll.
@Override
public DefaultEclipseProject buildAll(String modelName, Project project) {
boolean includeTasks = modelName.equals("org.gradle.tooling.model.eclipse.EclipseProject");
tasksFactory = new TasksFactory(includeTasks);
projectDependenciesOnly = modelName.equals("org.gradle.tooling.model.eclipse.HierarchicalEclipseProject");
currentProject = project;
eclipseProjects = Lists.newArrayList();
ProjectInternal root = (ProjectInternal) project.getRootProject();
rootGradleProject = gradleProjectBuilder.buildAll(project);
tasksFactory.collectTasks(root);
applyEclipsePlugin(root, new ArrayList<>());
deduplicateProjectNames(root);
buildHierarchy(root);
populate(root);
return result;
}
use of org.gradle.api.internal.project.ProjectInternal 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);
}
use of org.gradle.api.internal.project.ProjectInternal in project gradle by gradle.
the class BuildInitPlugin method apply.
@Override
public void apply(Project project) {
if (project.getParent() == null) {
project.getTasks().register("init", InitBuild.class, initBuild -> {
initBuild.setGroup("Build Setup");
initBuild.setDescription("Initializes a new Gradle build.");
RelativeFilePathResolver resolver = ((ProjectInternal) project).getFileResolver();
File buildFile = project.getBuildFile();
FileDetails buildFileDetails = FileDetails.of(buildFile, resolver);
File settingsFile = ((ProjectInternal) project).getGradle().getSettings().getSettingsScript().getResource().getLocation().getFile();
FileDetails settingsFileDetails = FileDetails.of(settingsFile, resolver);
initBuild.onlyIf(new InitBuildOnlyIfSpec(buildFileDetails, settingsFileDetails, initBuild.getLogger()));
initBuild.dependsOn(new InitBuildDependsOnCallable(buildFileDetails, settingsFileDetails));
ProjectInternal.DetachedResolver detachedResolver = ((ProjectInternal) project).newDetachedResolver();
initBuild.getProjectLayoutRegistry().getBuildConverter().configureClasspath(detachedResolver, project.getObjects());
initBuild.getInsecureProtocol().convention(InsecureProtocolOption.WARN);
});
}
}
use of org.gradle.api.internal.project.ProjectInternal in project gradle by gradle.
the class DefaultTaskContainer method findByPath.
@Override
public Task findByPath(String path) {
if (Strings.isNullOrEmpty(path)) {
throw new InvalidUserDataException("A path must be specified!");
}
if (!path.contains(Project.PATH_SEPARATOR)) {
return findByName(path);
}
String projectPath = StringUtils.substringBeforeLast(path, Project.PATH_SEPARATOR);
ProjectInternal project = this.project.findProject(Strings.isNullOrEmpty(projectPath) ? Project.PATH_SEPARATOR : projectPath);
if (project == null) {
return null;
}
project.getOwner().ensureTasksDiscovered();
return project.getTasks().findByName(StringUtils.substringAfterLast(path, Project.PATH_SEPARATOR));
}
use of org.gradle.api.internal.project.ProjectInternal in project gradle by gradle.
the class DefaultTaskSelector method getFilter.
public Spec<Task> getFilter(String path) {
final ResolvedTaskPath taskPath = taskPathResolver.resolvePath(path, gradle.getDefaultProject());
if (!taskPath.isQualified()) {
ProjectInternal targetProject = taskPath.getProject();
configurer.configure(targetProject);
if (taskNameResolver.tryFindUnqualifiedTaskCheaply(taskPath.getTaskName(), taskPath.getProject())) {
// An exact match in the target project - can just filter tasks by path to avoid configuring sub-projects at this point
return new TaskPathSpec(targetProject, taskPath.getTaskName());
}
}
final Set<Task> selectedTasks = getSelection(path, gradle.getDefaultProject()).getTasks();
return new Spec<Task>() {
@Override
public boolean isSatisfiedBy(Task element) {
return !selectedTasks.contains(element);
}
};
}
Aggregations