actionBroadcastMap.put(project, actionBroadcast);
return actionBroadcast;
}
private SonarRunner createTask(final Project project, final Map<Project, ActionBroadcast<SonarProperties>> actionBroadcastMap) {
SonarRunner sonarRunnerTask = project.getTasks().create(SonarRunnerExtension.SONAR_RUNNER_TASK_NAME, SonarRunner.class);
sonarRunnerTask.setDescription("Analyzes " + project + " and its subprojects with Sonar Runner.");
ConventionMapping conventionMapping = new DslObject(sonarRunnerTask).getConventionMapping();
conventionMapping.map("sonarProperties", new Callable<Object>() {
public Object call() throws Exception {
Map<String, Object> properties = Maps.newLinkedHashMap();
computeSonarProperties(project, properties, actionBroadcastMap);
return properties;
}
});
sonarRunnerTask.dependsOn(new Callable<Iterable<? extends Task>>() {
public Iterable<? extends Task> call() throws Exception {
Iterable<Project> applicableProjects = Iterables.filter(project.getAllprojects(), new Predicate<Project>() {
public boolean apply(Project input) {
return input.getPlugins().hasPlugin(JavaPlugin.class)
&& !input.getExtensions().getByType(SonarRunnerExtension.class).isSkipProject();