use of org.gradle.api.internal.PropertiesTransformer in project gradle by gradle.
the class EclipsePlugin method configureEclipseJdt.
private void configureEclipseJdt(final Project project, final EclipseModel model) {
project.getPlugins().withType(JavaBasePlugin.class, new Action<JavaBasePlugin>() {
@Override
public void execute(JavaBasePlugin javaBasePlugin) {
model.setJdt(project.getObjects().newInstance(EclipseJdt.class, new PropertiesFileContentMerger(new PropertiesTransformer())));
final TaskProvider<GenerateEclipseJdt> task = project.getTasks().register(ECLIPSE_JDT_TASK_NAME, GenerateEclipseJdt.class, model.getJdt());
task.configure(new Action<GenerateEclipseJdt>() {
@Override
public void execute(GenerateEclipseJdt task) {
// task properties:
task.setDescription("Generates the Eclipse JDT settings file.");
task.setOutputFile(project.file(".settings/org.eclipse.jdt.core.prefs"));
task.setInputFile(project.file(".settings/org.eclipse.jdt.core.prefs"));
}
});
addWorker(task, ECLIPSE_JDT_TASK_NAME);
// model properties:
ConventionMapping conventionMapping = ((IConventionAware) model.getJdt()).getConventionMapping();
conventionMapping.map("sourceCompatibility", new Callable<JavaVersion>() {
@Override
public JavaVersion call() {
return project.getExtensions().getByType(JavaPluginExtension.class).getSourceCompatibility();
}
});
conventionMapping.map("targetCompatibility", new Callable<JavaVersion>() {
@Override
public JavaVersion call() {
return project.getExtensions().getByType(JavaPluginExtension.class).getTargetCompatibility();
}
});
conventionMapping.map("javaRuntimeName", new Callable<String>() {
@Override
public String call() {
return eclipseJavaRuntimeNameFor(project.getExtensions().getByType(JavaPluginExtension.class).getTargetCompatibility());
}
});
}
});
}
Aggregations