diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2015-09-29 10:26:21 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2015-10-02 15:44:42 +0200 |
commit | d34d9a97294ba185a5574899a67c76bec764bbb1 (patch) | |
tree | fe77c9c9fb1f774b6ca215696f515d108722fad5 | |
parent | 8cec954ad673e32bf46d2a3b9fa62bdb6d86b7c8 (diff) | |
download | sonar-scanner-cli-d34d9a97294ba185a5574899a67c76bec764bbb1.tar.gz sonar-scanner-cli-d34d9a97294ba185a5574899a67c76bec764bbb1.zip |
Remove any dependency on SQ SNAPSHOT
6 files changed, 356 insertions, 5 deletions
diff --git a/sonar-runner-batch/pom.xml b/sonar-runner-batch/pom.xml index 20e039d..ff19533 100644 --- a/sonar-runner-batch/pom.xml +++ b/sonar-runner-batch/pom.xml @@ -10,7 +10,7 @@ <name>SonarQube Runner - Batch</name> <properties> - <sonarBatchVersion>5.2-SNAPSHOT</sonarBatchVersion> + <sonarBatchVersion>4.5.1</sonarBatchVersion> </properties> <dependencies> @@ -51,6 +51,12 @@ <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> <scope>test</scope> @@ -61,6 +67,15 @@ <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> <executions> <execution> 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 index 0000000..60f1465 --- /dev/null +++ b/sonar-runner-batch/src/main/java/org/sonar/batch/bootstrapper/Batch.java @@ -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 index 0000000..193ae46 --- /dev/null +++ b/sonar-runner-batch/src/main/java/org/sonar/batch/bootstrapper/IssueListener.java @@ -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 index 0000000..f4e0bcb --- /dev/null +++ b/sonar-runner-batch/src/main/java/org/sonar/batch/bootstrapper/LogOutput.java @@ -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 index 0000000..59c2684 --- /dev/null +++ b/sonar-runner-batch/src/main/java/org/sonar/batch/bootstrapper/package-info.java @@ -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 |