use of org.sonar.api.batch.bootstrap.internal.ProjectBuilderContext in project sonarqube by SonarSource.
the class ProjectBuildersExecutor method execute.
public void execute(ProjectReactor reactor) {
if (projectBuilders.length > 0) {
Profiler profiler = Profiler.create(LOG).startInfo("Execute project builders");
ProjectBuilderContext context = new ProjectBuilderContext(reactor);
for (ProjectBuilder projectBuilder : projectBuilders) {
try {
projectBuilder.build(context);
} catch (Exception e) {
throw MessageException.of("Failed to execute project builder: " + getDescription(projectBuilder), e);
}
}
profiler.stopInfo();
}
}
use of org.sonar.api.batch.bootstrap.internal.ProjectBuilderContext in project sonarqube by SonarSource.
the class ProjectBuilderTest method shouldChangeProject.
@Test
public void shouldChangeProject() {
// this reactor is created and provided by Sonar
final ProjectReactor projectReactor = new ProjectReactor(ProjectDefinition.create());
ProjectBuilder builder = new ProjectBuilderSample(new MapSettings());
builder.build(new ProjectBuilderContext(projectReactor));
assertThat(projectReactor.getProjects().size(), is(2));
ProjectDefinition root = projectReactor.getRoot();
assertThat(root.getName(), is("Name changed by plugin"));
assertThat(root.getSubProjects().size(), is(1));
assertThat(root.getSubProjects().get(0).sources()).contains("src");
}
Aggregations