use of org.gradle.plugins.ide.eclipse.model.EclipseModel in project spring-boot by spring-projects.
the class SystemTestPlugin method configureSystemTesting.
private void configureSystemTesting(Project project) {
SourceSet systemTestSourceSet = createSourceSet(project);
createTestTask(project, systemTestSourceSet);
project.getPlugins().withType(EclipsePlugin.class, (eclipsePlugin) -> {
EclipseModel eclipse = project.getExtensions().getByType(EclipseModel.class);
eclipse.classpath((classpath) -> classpath.getPlusConfigurations().add(project.getConfigurations().getByName(systemTestSourceSet.getRuntimeClasspathConfigurationName())));
});
}
use of org.gradle.plugins.ide.eclipse.model.EclipseModel in project spring-boot by spring-projects.
the class IntegrationTestPlugin method configureIntegrationTesting.
private void configureIntegrationTesting(Project project) {
SourceSet intTestSourceSet = createSourceSet(project);
Test intTest = createTestTask(project, intTestSourceSet);
project.getTasks().getByName(LifecycleBasePlugin.CHECK_TASK_NAME).dependsOn(intTest);
project.getPlugins().withType(EclipsePlugin.class, (eclipsePlugin) -> {
EclipseModel eclipse = project.getExtensions().getByType(EclipseModel.class);
eclipse.classpath((classpath) -> classpath.getPlusConfigurations().add(project.getConfigurations().getByName(intTestSourceSet.getRuntimeClasspathConfigurationName())));
});
}
use of org.gradle.plugins.ide.eclipse.model.EclipseModel in project gradle by gradle.
the class EclipseWtpPlugin method onApply.
@Override
protected void onApply(Project project) {
project.getPluginManager().apply(EclipsePlugin.class);
getLifecycleTask().configure(withDescription("Generates Eclipse wtp configuration files."));
getCleanTask().configure(withDescription("Cleans Eclipse wtp configuration files."));
project.getTasks().named(EclipsePlugin.ECLIPSE_TASK_NAME, dependsOn(getLifecycleTask()));
project.getTasks().named(cleanName(EclipsePlugin.ECLIPSE_TASK_NAME), dependsOn(getCleanTask()));
EclipseModel model = project.getExtensions().getByType(EclipseModel.class);
configureEclipseProject(project, model);
configureEclipseWtpComponent(project, model);
configureEclipseWtpFacet(project, model);
// do this after wtp is configured because wtp config is required to update classpath properly
configureEclipseClasspath(project, model);
}
use of org.gradle.plugins.ide.eclipse.model.EclipseModel in project gradle by gradle.
the class EclipseModelBuilder method populate.
private void populate(Project project) {
((ProjectInternal) project).getModel().applyToMutableState(state -> {
EclipseModel eclipseModel = project.getExtensions().getByType(EclipseModel.class);
boolean projectDependenciesOnly = this.projectDependenciesOnly;
ClasspathElements classpathElements = gatherClasspathElements(projectOpenStatus, eclipseModel.getClasspath(), projectDependenciesOnly);
DefaultEclipseProject eclipseProject = findEclipseProject(project);
eclipseProject.setClasspath(classpathElements.getExternalDependencies());
eclipseProject.setProjectDependencies(classpathElements.getProjectDependencies());
eclipseProject.setSourceDirectories(classpathElements.getSourceDirectories());
eclipseProject.setClasspathContainers(classpathElements.getClasspathContainers());
eclipseProject.setOutputLocation(classpathElements.getEclipseOutputLocation() != null ? classpathElements.getEclipseOutputLocation() : new DefaultEclipseOutputLocation("bin"));
eclipseProject.setAutoBuildTasks(!eclipseModel.getAutoBuildTasks().getDependencies(null).isEmpty());
org.gradle.plugins.ide.eclipse.model.Project xmlProject = new org.gradle.plugins.ide.eclipse.model.Project(new XmlTransformer());
XmlFileContentMerger projectFile = eclipseModel.getProject().getFile();
if (projectFile == null) {
xmlProject.configure(eclipseModel.getProject());
} else {
eclipseModel.getProject().mergeXmlProject(xmlProject);
}
populateEclipseProjectTasks(eclipseProject, tasksFactory.getTasks(project));
populateEclipseProject(eclipseProject, xmlProject);
populateEclipseProjectJdt(eclipseProject, eclipseModel.getJdt());
});
for (Project childProject : project.getChildProjects().values()) {
populate(childProject);
}
}
use of org.gradle.plugins.ide.eclipse.model.EclipseModel in project gradle by gradle.
the class EclipseModelAwareUniqueProjectNameProvider method getDeduplicatedNames.
private synchronized Map<ProjectState, String> getDeduplicatedNames() {
if (deduplicated == null) {
projectToInformationMap = new HashMap<>();
for (ProjectState state : projectRegistry.getAllProjects()) {
// try to get the name from EclipseProject.name
state.getOwner().ensureProjectsConfigured();
EclipseModel model = state.getMutableModel().getExtensions().findByType(EclipseModel.class);
if (model != null && model.getProject().getName() != null) {
projectToInformationMap.put(state, new ProjectStateWrapper(model.getProject().getName(), state, state.getParent()));
continue;
}
// fallback: take the name from the ProjectState
projectToInformationMap.put(state, new ProjectStateWrapper(state.getName(), state, state.getParent()));
}
HierarchicalElementDeduplicator<ProjectStateWrapper> deduplicator = new HierarchicalElementDeduplicator<>(new ProjectPathDeduplicationAdapter(projectToInformationMap));
List<ProjectStateWrapper> allElements = new ArrayList<>();
allElements.addAll(reservedNames);
allElements.addAll(projectToInformationMap.values());
this.deduplicated = deduplicator.deduplicate(allElements).entrySet().stream().collect(Collectors.toMap(e -> e.getKey().project, Map.Entry::getValue));
}
return deduplicated;
}
Aggregations