aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src/main/java/org/sonar/batch/bootstrap
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2015-08-17 17:25:24 +0200
committerDuarte Meneses <duarte.meneses@sonarsource.com>2015-08-18 09:36:10 +0200
commit5a1c0df59d916d7775cbddd712e05534da35fc8e (patch)
tree27039011073f67ab13b7c101f865f629a707a4a3 /sonar-batch/src/main/java/org/sonar/batch/bootstrap
parent9060cac655bd0484b27ec74758343230712a85c4 (diff)
downloadsonarqube-5a1c0df59d916d7775cbddd712e05534da35fc8e.tar.gz
sonarqube-5a1c0df59d916d7775cbddd712e05534da35fc8e.zip
SONAR-6761 Drop incremental mode
Diffstat (limited to 'sonar-batch/src/main/java/org/sonar/batch/bootstrap')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/AbstractAnalysisMode.java62
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalMode.java35
2 files changed, 66 insertions, 31 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/AbstractAnalysisMode.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/AbstractAnalysisMode.java
new file mode 100644
index 00000000000..61726ba4108
--- /dev/null
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/AbstractAnalysisMode.java
@@ -0,0 +1,62 @@
+/*
+ * 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.batch.bootstrap;
+
+import org.apache.commons.lang.StringUtils;
+import org.sonar.api.CoreProperties;
+
+import java.util.Arrays;
+
+import org.sonar.api.batch.AnalysisMode;
+
+public abstract class AbstractAnalysisMode implements AnalysisMode {
+ protected boolean preview;
+ protected boolean issues;
+
+ protected AbstractAnalysisMode() {
+ }
+
+ public boolean isPreview() {
+ return preview;
+ }
+
+ public boolean isIssues() {
+ return issues;
+ }
+
+ public boolean isPublish() {
+ return !preview && !issues;
+ }
+
+ protected static void validate(String mode) {
+ if (StringUtils.isEmpty(mode)) {
+ return;
+ }
+
+ if (CoreProperties.ANALYSIS_MODE_INCREMENTAL.equals(mode)) {
+ throw new IllegalStateException("Invalid analysis mode: " + mode + ". This mode was removed in SonarQube 5.2. Valid modes are: " + Arrays.toString(VALID_MODES));
+ }
+
+ if (!Arrays.asList(VALID_MODES).contains(mode)) {
+ throw new IllegalStateException("Invalid analysis mode: " + mode + ". Valid modes are: " + Arrays.toString(VALID_MODES));
+ }
+ }
+
+}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalMode.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalMode.java
index a0f53ab8660..ecfcf6346e8 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalMode.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/GlobalMode.java
@@ -19,37 +19,20 @@
*/
package org.sonar.batch.bootstrap;
-import java.util.Arrays;
+import org.sonar.api.CoreProperties;
import org.sonar.api.batch.AnalysisMode;
-import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.sonar.api.CoreProperties;
-public class GlobalMode implements AnalysisMode {
+public class GlobalMode extends AbstractAnalysisMode implements AnalysisMode {
private static final Logger LOG = LoggerFactory.getLogger(GlobalMode.class);
- private boolean preview;
- private boolean issues;
-
- public boolean isPreview() {
- return preview;
- }
-
- public boolean isIssues() {
- return issues;
- }
-
- public boolean isPublish() {
- return !preview && !issues;
- }
public GlobalMode(GlobalProperties props) {
String mode = props.property(CoreProperties.ANALYSIS_MODE);
validate(mode);
- preview = CoreProperties.ANALYSIS_MODE_PREVIEW.equals(mode);
- issues = CoreProperties.ANALYSIS_MODE_ISSUES.equals(mode);
-
+ issues = CoreProperties.ANALYSIS_MODE_ISSUES.equals(mode) || CoreProperties.ANALYSIS_MODE_PREVIEW.equals(mode);
+
if (preview) {
LOG.debug("Preview global mode");
} else if (issues) {
@@ -58,14 +41,4 @@ public class GlobalMode implements AnalysisMode {
LOG.debug("Publish global mode");
}
}
-
- private static void validate(String mode) {
- if (StringUtils.isEmpty(mode)) {
- return;
- }
-
- if (!Arrays.asList(VALID_MODES).contains(mode)) {
- throw new IllegalStateException("Invalid analysis mode: " + mode + ". Valid modes are: " + Arrays.toString(VALID_MODES));
- }
- }
}