use of org.gradle.tooling.model.eclipse.EclipseWorkspaceProject in project gradle by gradle.
the class RunBuildDependenciesTaskBuilder method buildAll.
@Override
public RunClosedProjectBuildDependencies buildAll(String modelName, EclipseRuntime eclipseRuntime, Project project) {
this.projectOpenStatus = eclipseRuntime.getWorkspace().getProjects().stream().collect(Collectors.toMap(EclipseWorkspaceProject::getName, EclipseModelBuilder::isProjectOpen, (a, b) -> a | b));
List<TaskDependency> buildDependencies = populate(project.getRootProject());
if (!buildDependencies.isEmpty()) {
Gradle rootGradle = getRootGradle(project.getGradle());
Project rootProject = rootGradle.getRootProject();
StartParameter startParameter = rootGradle.getStartParameter();
List<String> taskPaths = new ArrayList<>(startParameter.getTaskNames());
String parentTaskName = parentTaskName(rootProject, "eclipseClosedDependencies");
Task task = rootProject.task(parentTaskName);
task.dependsOn(buildDependencies.toArray(new Object[0]));
taskPaths.add(parentTaskName);
startParameter.setTaskNames(taskPaths);
}
return DefaultRunClosedProjectBuildDependencies.INSTANCE;
}
use of org.gradle.tooling.model.eclipse.EclipseWorkspaceProject in project gradle by gradle.
the class EclipseModelBuilder method calculateReservedProjectNames.
private List<String> calculateReservedProjectNames(ProjectInternal rootProject, EclipseRuntime parameter) {
if (parameter == null) {
return Collections.emptyList();
}
EclipseWorkspace workspace = parameter.getWorkspace();
if (workspace == null) {
return Collections.emptyList();
}
List<EclipseWorkspaceProject> projects = workspace.getProjects();
if (projects == null) {
return Collections.emptyList();
}
List<String> reservedProjectNames = new ArrayList<>();
List<EclipseWorkspaceProject> externalProjects = gatherExternalProjects(rootProject, projects);
for (EclipseWorkspaceProject externalProject : externalProjects) {
reservedProjectNames.add(externalProject.getName());
}
return reservedProjectNames;
}
use of org.gradle.tooling.model.eclipse.EclipseWorkspaceProject in project gradle by gradle.
the class EclipseModelBuilder method gatherExternalProjects.
private List<EclipseWorkspaceProject> gatherExternalProjects(ProjectInternal rootProject, List<EclipseWorkspaceProject> projects) {
// The eclipse workspace contains projects from root and included builds. Check projects from all builds
// so that models built for included builds do not consider projects from parent builds as external.
Set<File> gradleProjectLocations = collectAllProjects(new ArrayList<>(), getRootBuild(rootProject.getGradle()), new HashSet<>()).stream().map(p -> p.getProjectDir().getAbsoluteFile()).collect(Collectors.toSet());
List<EclipseWorkspaceProject> externalProjects = new ArrayList<>();
for (EclipseWorkspaceProject project : projects) {
if (project == null || project.getLocation() == null || project.getName() == null || project.getLocation() == null) {
continue;
}
if (!gradleProjectLocations.contains(project.getLocation().getAbsoluteFile())) {
externalProjects.add(project);
}
}
return externalProjects;
}
Aggregations