/** * Configure the Eclipse classpath task * * @param eclipseClasspath Eclipse classpath task to configure * @param eclipseConfigPlugin Eclipse configuration plugin to configure task */ @Mutate public void configureEclipseClasspathTask(@Each GenerateEclipseClasspath eclipseClasspath, EclipseConfigPlugin eclipseConfigPlugin) { EclipseClasspath classpath = eclipseClasspath.getClasspath(); classpath.setDownloadSources(true); classpath.setDownloadJavadoc(true); classpath.getContainers().remove(EclipseWtpPlugin.WEB_LIBS_CONTAINER); classpath.getFile().withXml(xml -> eclipseConfigPlugin.configureClasspathXml(Validate.notNull(xml))); }
@Override public void execute(final Project project) { final EclipseModel eclipseModel = project.getExtensions().getByType(EclipseModel.class); eclipseModel.getClasspath().getPlusConfigurations().add(gwtBasePlugin.getGwtConfiguration()); if(eclipseExtension.isAddGwtContainer()) { logger.debug("Using GWT_CONTAINER for eclipse"); eclipseModel.getClasspath().getContainers().add(ECLIPSE_GWT_CONTAINER); eclipseModel.getClasspath().getMinusConfigurations().add(gwtBasePlugin.getGwtSdkConfiguration()); } else { logger.debug("Not using GWT_CONTAINER for eclipse"); eclipseModel.getClasspath().getPlusConfigurations().add(gwtBasePlugin.getGwtSdkConfiguration()); } } });
@Override public void execute(Project project) { logger.info("Updating eclipse model with Android dependencies"); EclipseModel eclipseModel = eclipseModel(project); eclipseModel.getClasspath().getFile().beforeMerged(new AddSourceFoldersAction()); eclipseModel.getClasspath().getFile().whenMerged(new GenerateLibraryDependenciesAction(project)); eclipseModel.getClasspath().getFile().whenMerged(new AndroidSdkLibraryDependenciesAction(project)); project.getTasksByName("eclipseClasspath", false).forEach(t -> t.dependsOn("generateDebugSources")); logger.info("Android dependencies done"); } });
private void initGwtEclipsePlugin(final Project project) { final GwtExtension gwtExtension = (GwtExtension) project.getExtensions() .getByName(GwtExtension.NAME); if (project.getPlugins().hasPlugin("eclipse") && gwtExtension.isGwtPluginEclipse()) { final EclipseModel eclipseModel = project.getExtensions() .getByType(EclipseModel.class); final EclipseProject eclipseProject = eclipseModel.getProject(); eclipseProject.natures(ECLIPSE_NATURE); eclipseProject.buildCommand(ECLIPSE_BUILDER_PROJECT_VALIDATOR); eclipseModel.getClasspath().getContainers() .add(ECLIPSE_GWT_CONTAINER); project.getPlugins() .withType(GwtPlugin.class, new Action<GwtPlugin>() { @Override public void execute(GwtPlugin warPlugin) { eclipseProject.buildCommand(ECLIPSE_BUILDER_WEBAPP_VALIDATOR); } }); } } }
eclipseConv.getClasspath().getPlusConfigurations().add(project.getConfigurations().getByName(CONFIG_MC)); eclipseConv.getClasspath().getPlusConfigurations().add(project.getConfigurations().getByName(CONFIG_MC_DEPS)); eclipseConv.getClasspath().getPlusConfigurations().add(project.getConfigurations().getByName(CONFIG_START)); eclipseConv.getClasspath().getPlusConfigurations().add(project.getConfigurations().getByName(CONFIG_PROVIDED));
@Override protected void applyOnce(Project project) { EclipseProjectPlugin.modifyEclipseProject(project, eclipseModel -> { eclipseModel.getClasspath().getFile().getXmlTransformer().addAction(this::classic); }); }
/** * Configure the Eclipse classpath task * * @param eclipseClasspath Eclipse classpath task to configure * @param eclipseConfigPlugin Eclipse configuration plugin to configure task */ @Mutate public void configureEclipseClasspathTask(@Each GenerateEclipseClasspath eclipseClasspath, EclipseConfigPlugin eclipseConfigPlugin) { EclipseClasspath classpath = eclipseClasspath.getClasspath(); classpath.setDownloadSources(true); classpath.setDownloadJavadoc(true); classpath.getContainers().remove(EclipseWtpPlugin.WEB_LIBS_CONTAINER); classpath.getFile().withXml(xml -> eclipseConfigPlugin.configureClasspathXml(Validate.notNull(xml))); }
eclipseModel.getClasspath().getFile().getXmlTransformer().addAction(xmlProvider -> { Node entry = xmlProvider.asNode().appendNode("classpathentry"); entry.attributes().put("kind", "src");
@Override protected void applyOnce(Project project) { ProjectDepsExtension extension = project.getExtensions().create(ProjectDepsExtension.NAME, ProjectDepsExtension.class); EclipseProjectPlugin.modifyEclipseProject(project, eclipseModel -> { // find the project's referenced projects and reference them explicitly in the eclipse model Task prepareEclipse = project.task("prepareEclipse"); prepareEclipse.doLast(task -> { Set<String> referencedProjects = eclipseModel.getProject().getReferencedProjects(); project.getConfigurations().stream() .flatMap(config -> config.getDependencies().stream()) .filter(dep -> dep instanceof ProjectDependency) .forEach(dep -> { referencedProjects.add(dep.getName()); }); }); // it's needed for generating the eclipseClasspath and eclipseProject Iterables.getOnlyElement(project.getTasksByName("eclipseClasspath", false)).dependsOn(prepareEclipse); Iterables.getOnlyElement(project.getTasksByName("eclipseProject", false)).dependsOn(prepareEclipse); // create robust classpath entries for all referenced projects eclipseModel.getClasspath().getFile().getXmlTransformer().addAction(xmlProvider -> { modifyClasspath(xmlProvider.asNode(), eclipseModel, extension); }); }); }