@@ -10,7 +10,7 @@ | |||
<name>SonarQube Runner - Batch</name> | |||
<properties> | |||
<sonarBatchVersion>5.2-SNAPSHOT</sonarBatchVersion> | |||
<sonarBatchVersion>4.5.1</sonarBatchVersion> | |||
</properties> | |||
<dependencies> | |||
@@ -50,6 +50,12 @@ | |||
<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> | |||
@@ -59,6 +65,15 @@ | |||
<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> |
@@ -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); | |||
} | |||
} | |||
} |
@@ -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; | |||
} | |||
} | |||
} |
@@ -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; | |||
} | |||
} |
@@ -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; |
@@ -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 |