org.gradle.plugins.ide.eclipse.model.EclipseModel Java Examples

The following examples show how to use org.gradle.plugins.ide.eclipse.model.EclipseModel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PwtLibPlugin.java    From putnami-gradle-plugin with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void initGpe(final Project project) {
	project.afterEvaluate(new Action<Project>() {
		@Override
		public void execute(final Project p) {
			final PutnamiExtension extention = (PutnamiExtension) project.getExtensions()
				.getByName(PutnamiExtension.PWT_EXTENSION);

			if (p.getPlugins().hasPlugin("eclipse") && extention.isGooglePluginEclipse()) {
				final EclipseModel eclipseModel = project.getExtensions().getByType(EclipseModel.class);
				eclipseModel.getProject().natures(ECLIPSE_NATURE);
				eclipseModel.getProject().buildCommand(ECLIPSE_BUILDER_PROJECT_VALIDATOR);
				project.getPlugins().withType(PwtPlugin.class, new Action<PwtPlugin>() {
					@Override
					public void execute(PwtPlugin warPlugin) {
						eclipseModel.getProject().buildCommand(ECLIPSE_BUILDER_WEBAPP_VALIDATOR);
					}
				});
			}
		}
	});
}
 
Example #2
Source File: OptionalDependenciesPlugin.java    From reactor-core with Apache License 2.0 6 votes vote down vote up
@Override
public void apply(Project project) {
	Configuration optional = project.getConfigurations().create(OPTIONAL_CONFIGURATION_NAME);
	optional.attributes((attributes) -> attributes.attribute(Usage.USAGE_ATTRIBUTE,
			project.getObjects().named(Usage.class, Usage.JAVA_RUNTIME)));
	project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> {
		SourceSetContainer sourceSets = project.getConvention().getPlugin(JavaPluginConvention.class)
		                                       .getSourceSets();
		sourceSets.all((sourceSet) -> {
			sourceSet.setCompileClasspath(sourceSet.getCompileClasspath().plus(optional));
			sourceSet.setRuntimeClasspath(sourceSet.getRuntimeClasspath().plus(optional));
		});
		project.getTasks().withType(Javadoc.class)
		       .all((javadoc) -> javadoc.setClasspath(javadoc.getClasspath().plus(optional)));
	});
	project.getPlugins().withType(EclipsePlugin.class,
			(eclipsePlugin) -> project.getExtensions().getByType(EclipseModel.class)
			                          .classpath((classpath) -> classpath.getPlusConfigurations().add(optional)));
}
 
Example #3
Source File: EclipseGeneratorPlugin.java    From gradle-android-eclipse with Apache License 2.0 5 votes vote down vote up
private EclipseModel eclipseModel(Project project) {
	try {
		return (EclipseModel) project.property("eclipse");
	} catch (MissingPropertyException e) {
		throw new RuntimeException(
				"Cannot find 'eclipse' property.\nEnsure that the following is in your project: \n\napply plugin: 'eclipse'\n\n",
				e);
	}
}
 
Example #4
Source File: EclipseConfigurator.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
public EclipseConfigurator(Project project) {
  this.project = project;
  project.getPluginManager().apply(ECLIPSE_PLUGIN_ID);
  this.eclipseModel = project.getExtensions().findByType(EclipseModel.class);
}