diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2015-03-09 11:00:03 +0100 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2015-03-09 11:00:43 +0100 |
commit | b5ae4d3661dadbca4bfc42d5c48eb65ee40a5a81 (patch) | |
tree | 468385282d3bd65c187b9c92a591f7dabe44e700 /plugins/sonar-xoo-plugin | |
parent | 8f27adb529037708f56e5127240e4e237d584fd9 (diff) | |
download | sonarqube-b5ae4d3661dadbca4bfc42d5c48eb65ee40a5a81.tar.gz sonarqube-b5ae4d3661dadbca4bfc42d5c48eb65ee40a5a81.zip |
SONAR-6250 Fix use of sonar.branch on dotnet projects
Diffstat (limited to 'plugins/sonar-xoo-plugin')
-rw-r--r-- | plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java | 26 | ||||
-rw-r--r-- | plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/extensions/XooProjectBuilder.java | 55 |
2 files changed, 62 insertions, 19 deletions
diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java index df3a7b5c64e..8aa011ef873 100644 --- a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/XooPlugin.java @@ -20,23 +20,9 @@ package org.sonar.xoo; import org.sonar.api.SonarPlugin; -import org.sonar.xoo.lang.DependencySensor; -import org.sonar.xoo.lang.MeasureSensor; -import org.sonar.xoo.lang.SymbolReferencesSensor; -import org.sonar.xoo.lang.SyntaxHighlightingSensor; -import org.sonar.xoo.lang.XooCpdMapping; -import org.sonar.xoo.lang.XooTokenizer; -import org.sonar.xoo.rule.ChecksSensor; -import org.sonar.xoo.rule.CreateIssueByInternalKeySensor; -import org.sonar.xoo.rule.DeprecatedResourceApiSensor; -import org.sonar.xoo.rule.OneIssueOnDirPerFileSensor; -import org.sonar.xoo.rule.OneIssuePerLineSensor; -import org.sonar.xoo.rule.RandomAccessSensor; -import org.sonar.xoo.rule.XooFakeExporter; -import org.sonar.xoo.rule.XooFakeImporter; -import org.sonar.xoo.rule.XooFakeImporterWithMessages; -import org.sonar.xoo.rule.XooQualityProfile; -import org.sonar.xoo.rule.XooRulesDefinition; +import org.sonar.xoo.extensions.XooProjectBuilder; +import org.sonar.xoo.lang.*; +import org.sonar.xoo.rule.*; import org.sonar.xoo.scm.XooBlameCommand; import org.sonar.xoo.scm.XooScmProvider; @@ -81,7 +67,9 @@ public class XooPlugin extends SonarPlugin { OneIssuePerLineSensor.class, OneIssueOnDirPerFileSensor.class, - CreateIssueByInternalKeySensor.class - ); + CreateIssueByInternalKeySensor.class, + + // Other + XooProjectBuilder.class); } } diff --git a/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/extensions/XooProjectBuilder.java b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/extensions/XooProjectBuilder.java new file mode 100644 index 00000000000..0ec5bcd0f1e --- /dev/null +++ b/plugins/sonar-xoo-plugin/src/main/java/org/sonar/xoo/extensions/XooProjectBuilder.java @@ -0,0 +1,55 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.xoo.extensions; + +import org.sonar.api.batch.bootstrap.ProjectBuilder; +import org.sonar.api.batch.bootstrap.ProjectDefinition; +import org.sonar.api.config.Settings; + +import java.io.File; + +public class XooProjectBuilder extends ProjectBuilder { + + private Settings settings; + + public XooProjectBuilder(Settings settings) { + this.settings = settings; + } + + @Override + public void build(Context context) { + if (!settings.getBoolean("sonar.xoo.enableProjectBuilder")) { + return; + } + ProjectDefinition root = context.projectReactor().getRoot(); + + ProjectDefinition module = ProjectDefinition.create() + .setKey(root.getKey() + ":module1") + .setName("Module 1"); + + module.setBaseDir(new File(root.getBaseDir(), "module1")); + module.setWorkDir(new File(root.getWorkDir(), "module1")); + + module.setSources("src"); + + root.addSubProject(module); + } + +} |