diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2013-06-12 17:15:16 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2013-06-12 17:15:16 +0200 |
commit | f29ce9033080ae74a2f31541fe09c755376a61e2 (patch) | |
tree | dc48a466cccb89cef92f54260ac82bb8eeabae97 /sonar-plugin-api/src | |
parent | e534ce920a8b372156fe6510c14f93ab39f009ce (diff) | |
download | sonarqube-f29ce9033080ae74a2f31541fe09c755376a61e2.tar.gz sonarqube-f29ce9033080ae74a2f31541fe09c755376a61e2.zip |
SONAR-4386 Provide a context to ProjectBuilder for later evolutions
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectBuilder.java | 14 | ||||
-rw-r--r-- | sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectBuilderTest.java | 10 |
2 files changed, 16 insertions, 8 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectBuilder.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectBuilder.java index b3adf46ad6d..c5fe2aee67a 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectBuilder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/bootstrap/ProjectBuilder.java @@ -52,16 +52,18 @@ public abstract class ProjectBuilder implements BatchExtension { } /** - * This method was introduced to relax visibility of {@link #build(ProjectReactor)} + * Override this method to change project reactor structure. * @since 3.7 */ - public final void doBuild(ProjectReactor reactor) { - build(reactor); + public void build(ProjectBuilderContext context) { + // Call deprecated method for backward compatibility + build(context.getProjectReactor()); } /** - * This method will be called by Sonar core to let you a chance to change project reactor structure. - * @param reactor + * @deprecated since 3.7 override {@link #build(ProjectBuilderContext)} instead */ - protected abstract void build(ProjectReactor reactor); + @Deprecated + protected void build(ProjectReactor reactor) { + } } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectBuilderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectBuilderTest.java index 2ae474e3866..14b57bb10ac 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectBuilderTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/bootstrap/ProjectBuilderTest.java @@ -33,10 +33,16 @@ public class ProjectBuilderTest { @Test public void shouldChangeProject() { // this reactor is created and provided by Sonar - ProjectReactor projectReactor = new ProjectReactor(ProjectDefinition.create()); + final ProjectReactor projectReactor = new ProjectReactor(ProjectDefinition.create()); ProjectBuilder builder = new ProjectBuilderSample(new Settings()); - builder.doBuild(projectReactor); + builder.build(new ProjectBuilderContext() { + + @Override + public ProjectReactor getProjectReactor() { + return projectReactor; + } + }); assertThat(projectReactor.getProjects().size(), is(2)); ProjectDefinition root = projectReactor.getRoot(); |