aboutsummaryrefslogtreecommitdiffstats
path: root/it/it-plugins/project-builder-plugin/src/main/java/RenameProject.java
diff options
context:
space:
mode:
Diffstat (limited to 'it/it-plugins/project-builder-plugin/src/main/java/RenameProject.java')
-rw-r--r--it/it-plugins/project-builder-plugin/src/main/java/RenameProject.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/it/it-plugins/project-builder-plugin/src/main/java/RenameProject.java b/it/it-plugins/project-builder-plugin/src/main/java/RenameProject.java
new file mode 100644
index 00000000000..67971dc208b
--- /dev/null
+++ b/it/it-plugins/project-builder-plugin/src/main/java/RenameProject.java
@@ -0,0 +1,28 @@
+import org.sonar.api.batch.bootstrap.ProjectBuilder;
+import org.sonar.api.batch.bootstrap.ProjectDefinition;
+import org.sonar.api.batch.bootstrap.ProjectReactor;
+import org.sonar.api.config.Settings;
+
+/**
+ * This plugin relates to projects/project-builder sample
+ */
+public final class RenameProject extends ProjectBuilder {
+
+ private Settings settings;
+
+ public RenameProject(ProjectReactor reactor, Settings settings) {
+ super(reactor);
+ this.settings = settings;
+ }
+
+ @Override
+ protected void build(ProjectReactor reactor) {
+ if (!settings.getBoolean("sonar.enableProjectBuilder")) {
+ return;
+ }
+ System.out.println("---> Renaming project");
+ // change name of root project
+ ProjectDefinition root = reactor.getRoot();
+ root.setName("Name changed by plugin");
+ }
+}