Search in sources :

Example 6 with XmlFileContentMerger

use of org.gradle.plugins.ide.api.XmlFileContentMerger in project gradle by gradle.

the class EclipseWtp method getFacet.

/**
 * Configures wtp facet.
 * <p>
 * For examples see docs for {@link EclipseWtpFacet}
 */
public EclipseWtpFacet getFacet() {
    if (facet == null) {
        XmlTransformer xmlTransformer = new XmlTransformer();
        xmlTransformer.setIndentation("\t");
        facet = getObjectFactory().newInstance(EclipseWtpFacet.class, new XmlFileContentMerger(xmlTransformer));
    }
    return facet;
}
Also used : XmlTransformer(org.gradle.internal.xml.XmlTransformer) XmlFileContentMerger(org.gradle.plugins.ide.api.XmlFileContentMerger)

Example 7 with XmlFileContentMerger

use of org.gradle.plugins.ide.api.XmlFileContentMerger 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);
    }
}
Also used : XmlFileContentMerger(org.gradle.plugins.ide.api.XmlFileContentMerger) Project(org.gradle.api.Project) EclipseWorkspaceProject(org.gradle.tooling.model.eclipse.EclipseWorkspaceProject) DefaultGradleProject(org.gradle.plugins.ide.internal.tooling.model.DefaultGradleProject) DefaultEclipseProject(org.gradle.plugins.ide.internal.tooling.eclipse.DefaultEclipseProject) XmlTransformer(org.gradle.internal.xml.XmlTransformer) DefaultEclipseOutputLocation(org.gradle.plugins.ide.internal.tooling.eclipse.DefaultEclipseOutputLocation) EclipseModel(org.gradle.plugins.ide.eclipse.model.EclipseModel) DefaultEclipseProject(org.gradle.plugins.ide.internal.tooling.eclipse.DefaultEclipseProject)

Aggregations

XmlTransformer (org.gradle.internal.xml.XmlTransformer)7 XmlFileContentMerger (org.gradle.plugins.ide.api.XmlFileContentMerger)7 File (java.io.File)4 Project (org.gradle.api.Project)3 Action (org.gradle.api.Action)2 ConventionMapping (org.gradle.api.internal.ConventionMapping)2 IConventionAware (org.gradle.api.internal.IConventionAware)2 Predicate (com.google.common.base.Predicate)1 List (java.util.List)1 Set (java.util.Set)1 Callable (java.util.concurrent.Callable)1 JavaVersion (org.gradle.api.JavaVersion)1 JavaBasePlugin (org.gradle.api.plugins.JavaBasePlugin)1 JavaPlugin (org.gradle.api.plugins.JavaPlugin)1 JavaPluginExtension (org.gradle.api.plugins.JavaPluginExtension)1 WarPlugin (org.gradle.api.plugins.WarPlugin)1 TaskProvider (org.gradle.api.tasks.TaskProvider)1 War (org.gradle.api.tasks.bundling.War)1 Ear (org.gradle.plugins.ear.Ear)1 EarPlugin (org.gradle.plugins.ear.EarPlugin)1