]> source.dussan.org Git - sonar-scanner-cli.git/commitdiff
Remove any dependency on SQ SNAPSHOT
authorJulien HENRY <julien.henry@sonarsource.com>
Tue, 29 Sep 2015 08:26:21 +0000 (10:26 +0200)
committerJulien HENRY <julien.henry@sonarsource.com>
Fri, 2 Oct 2015 13:44:42 +0000 (15:44 +0200)
sonar-runner-batch/pom.xml
sonar-runner-batch/src/main/java/org/sonar/batch/bootstrapper/Batch.java [new file with mode: 0644]
sonar-runner-batch/src/main/java/org/sonar/batch/bootstrapper/IssueListener.java [new file with mode: 0644]
sonar-runner-batch/src/main/java/org/sonar/batch/bootstrapper/LogOutput.java [new file with mode: 0644]
sonar-runner-batch/src/main/java/org/sonar/batch/bootstrapper/package-info.java [new file with mode: 0644]
travis.sh

index 20e039d996baf0fc431afeea8eaf3ef866e7a82c..ff195339f5fc3d5a90a89b807232d71183c38f7e 100644 (file)
@@ -10,7 +10,7 @@
   <name>SonarQube Runner - Batch</name>
 
   <properties>
-    <sonarBatchVersion>5.2-SNAPSHOT</sonarBatchVersion>
+    <sonarBatchVersion>4.5.1</sonarBatchVersion>
   </properties>
 
   <dependencies>
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.assertj</groupId>
+      <artifactId>assertj-core</artifactId>
+      <version>2.1.0</version>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-all</artifactId>
 
   <build>
     <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>**/org/sonar/batch/bootstrapper/*</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-shade-plugin</artifactId>
diff --git a/sonar-runner-batch/src/main/java/org/sonar/batch/bootstrapper/Batch.java b/sonar-runner-batch/src/main/java/org/sonar/batch/bootstrapper/Batch.java
new file mode 100644 (file)
index 0000000..60f1465
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * SonarQube Runner - Batch
+ * Copyright (C) 2011 SonarSource
+ * sonarqube@googlegroups.com
+ *
+ * This program 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.
+ *
+ * This program 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  02
+ */
+package org.sonar.batch.bootstrapper;
+
+import java.util.List;
+import java.util.Map;
+import org.picocontainer.annotations.Nullable;
+
+/**
+ * Entry point for sonar-runner 2.1.
+ *
+ * @since 2.14
+ */
+public final class Batch {
+
+  private Batch(Builder builder) {
+  }
+
+  public LoggingConfiguration getLoggingConfiguration() {
+    return null;
+  }
+
+  /**
+   * @deprecated since 4.4 use {@link #start()}, {@link #executeTask(Map)} and then {@link #stop()}
+   */
+  @Deprecated
+  public synchronized Batch execute() {
+    return this;
+  }
+
+  /**
+   * @since 4.4
+   */
+  public synchronized Batch start() {
+    return start(false);
+  }
+
+  public synchronized Batch start(boolean forceSync) {
+    return this;
+  }
+
+  /**
+   * @since 4.4
+   */
+  public Batch executeTask(Map<String, String> analysisProperties, Object... components) {
+    return this;
+  }
+
+  /**
+   * @since 5.2
+   */
+  public Batch executeTask(Map<String, String> analysisProperties, IssueListener issueListener) {
+    return this;
+  }
+
+  /**
+   * @since 5.2
+   */
+  public Batch syncProject(String projectKey) {
+    return this;
+  }
+
+  /**
+   * @since 4.4
+   */
+  public synchronized void stop() {
+  }
+
+  private void doStop(boolean swallowException) {
+  }
+
+  private void configureLogging() {
+  }
+
+  public static Builder builder() {
+    return new Builder();
+  }
+
+  public static final class Builder {
+
+    private Builder() {
+    }
+
+    public Builder setEnvironment(EnvironmentInformation env) {
+      return this;
+    }
+
+    public Builder setComponents(List<Object> l) {
+      return this;
+    }
+
+    public Builder setLogOutput(@Nullable LogOutput logOutput) {
+      return this;
+    }
+
+    /**
+     * @deprecated since 3.7 use {@link #setBootstrapProperties(Map)}
+     */
+    @Deprecated
+    public Builder setGlobalProperties(Map<String, String> globalProperties) {
+      return this;
+    }
+
+    public Builder setBootstrapProperties(Map<String, String> bootstrapProperties) {
+      return this;
+    }
+
+    public Builder addComponents(Object... components) {
+      return this;
+    }
+
+    public Builder addComponent(Object component) {
+      return this;
+    }
+
+    public boolean isEnableLoggingConfiguration() {
+      return false;
+    }
+
+    /**
+     * Logback is configured by default. It can be disabled, but n this case the batch bootstrapper must provide its
+     * own implementation of SLF4J.
+     */
+    public Builder setEnableLoggingConfiguration(boolean b) {
+      return this;
+    }
+
+    public Batch build() {
+      return new Batch(this);
+    }
+  }
+}
diff --git a/sonar-runner-batch/src/main/java/org/sonar/batch/bootstrapper/IssueListener.java b/sonar-runner-batch/src/main/java/org/sonar/batch/bootstrapper/IssueListener.java
new file mode 100644 (file)
index 0000000..193ae46
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * SonarQube Runner - Batch
+ * Copyright (C) 2011 SonarSource
+ * sonarqube@googlegroups.com
+ *
+ * This program 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.
+ *
+ * This program 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  02
+ */
+package org.sonar.batch.bootstrapper;
+
+public interface IssueListener {
+  void handle(Issue issue);
+
+  class Issue {
+    private String key;
+    private String componentKey;
+    private Integer line;
+    private String message;
+    private String ruleKey;
+    private String ruleName;
+    private String status;
+    private String resolution;
+    private boolean isNew;
+    private String assigneeLogin;
+    private String assigneeName;
+    private String severity;
+
+    public String getSeverity() {
+      return severity;
+    }
+
+    public void setSeverity(String severity) {
+      this.severity = severity;
+    }
+
+    public String getKey() {
+      return key;
+    }
+
+    public void setKey(String key) {
+      this.key = key;
+    }
+
+    public String getComponentKey() {
+      return componentKey;
+    }
+
+    public void setComponentKey(String componentKey) {
+      this.componentKey = componentKey;
+    }
+
+    public Integer getLine() {
+      return line;
+    }
+
+    public void setLine(Integer line) {
+      this.line = line;
+    }
+
+    public String getMessage() {
+      return message;
+    }
+
+    public void setMessage(String message) {
+      this.message = message;
+    }
+
+    public String getRuleKey() {
+      return ruleKey;
+    }
+
+    public void setRuleKey(String ruleKey) {
+      this.ruleKey = ruleKey;
+    }
+
+    public String getRuleName() {
+      return ruleName;
+    }
+
+    public void setRuleName(String ruleName) {
+      this.ruleName = ruleName;
+    }
+
+    public String getStatus() {
+      return status;
+    }
+
+    public void setStatus(String status) {
+      this.status = status;
+    }
+
+    public String getResolution() {
+      return resolution;
+    }
+
+    public void setResolution(String resolution) {
+      this.resolution = resolution;
+    }
+
+    public boolean isNew() {
+      return isNew;
+    }
+
+    public void setNew(boolean isNew) {
+      this.isNew = isNew;
+    }
+
+    public String getAssigneeLogin() {
+      return assigneeLogin;
+    }
+
+    public void setAssigneeLogin(String assigneeLogin) {
+      this.assigneeLogin = assigneeLogin;
+    }
+
+    public String getAssigneeName() {
+      return assigneeName;
+    }
+
+    public void setAssigneeName(String assigneeName) {
+      this.assigneeName = assigneeName;
+    }
+  }
+}
diff --git a/sonar-runner-batch/src/main/java/org/sonar/batch/bootstrapper/LogOutput.java b/sonar-runner-batch/src/main/java/org/sonar/batch/bootstrapper/LogOutput.java
new file mode 100644 (file)
index 0000000..f4e0bcb
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * SonarQube Runner - Batch
+ * Copyright (C) 2011 SonarSource
+ * sonarqube@googlegroups.com
+ *
+ * This program 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.
+ *
+ * This program 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  02
+ */
+package org.sonar.batch.bootstrapper;
+
+/**
+ * Allow to redirect batch logs to a custom output. By defaults logs are written to System.out
+ * @since 5.2
+ */
+public interface LogOutput {
+
+  void log(String formattedMessage, Level level);
+
+  enum Level {
+    ERROR, WARN, INFO, DEBUG, TRACE;
+  }
+}
diff --git a/sonar-runner-batch/src/main/java/org/sonar/batch/bootstrapper/package-info.java b/sonar-runner-batch/src/main/java/org/sonar/batch/bootstrapper/package-info.java
new file mode 100644 (file)
index 0000000..59c2684
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * SonarQube Runner - Batch
+ * Copyright (C) 2011 SonarSource
+ * sonarqube@googlegroups.com
+ *
+ * This program 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.
+ *
+ * This program 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  02
+ */
+/**
+ * This package contains duplicated classes to avoid a dependency on SQ batch
+ */
+package org.sonar.batch.bootstrapper;
index a3bb399ca2a275a8f3476d5dab42b8d7bb01e14b..abaceebce6729baa17396683c6d7938567ad8995 100755 (executable)
--- a/travis.sh
+++ b/travis.sh
@@ -13,16 +13,12 @@ case "$TESTS" in
 CI)
   installTravisTools
 
-  build_snapshot "SonarSource/sonarqube"
-
   mvn verify -B -e -V
   ;;
 
 IT-DEV)
   installTravisTools
 
-  build_snapshot "SonarSource/sonarqube"
-
   mvn install -Dsource.skip=true -Denforcer.skip=true -Danimal.sniffer.skip=true -Dmaven.test.skip=true
 
   cd it