}
@Override
- public ProjectRepositories load(String projectKey, boolean issuesMode, @Nullable String branchTarget) {
- GetRequest request = new GetRequest(getUrl(projectKey, issuesMode, branchTarget));
+ public ProjectRepositories load(String projectKey, boolean issuesMode, @Nullable String branchBase) {
+ GetRequest request = new GetRequest(getUrl(projectKey, issuesMode, branchBase));
try (WsResponse response = wsClient.call(request)) {
InputStream is = response.contentStream();
return processStream(is, projectKey);
}
}
- private static String getUrl(String projectKey, boolean issuesMode, @Nullable String branchTarget) {
+ private static String getUrl(String projectKey, boolean issuesMode, @Nullable String branchBase) {
StringBuilder builder = new StringBuilder();
builder.append(BATCH_PROJECT_URL)
if (issuesMode) {
builder.append("&issues_mode=true");
}
- if (branchTarget != null) {
- builder.append("&branch=").append(branchTarget);
+ if (branchBase != null) {
+ builder.append("&branch=").append(branchBase);
}
return builder.toString();
}
import javax.annotation.Nullable;
public interface ProjectRepositoriesLoader {
- ProjectRepositories load(String projectKeyWithBranch, boolean issuesMode, @Nullable String branchTarget);
+ ProjectRepositories load(String projectKeyWithBranch, boolean issuesMode, @Nullable String branchBase);
}
protected ProjectRepositories provideInternal(ProjectRepositoriesLoader loader, ProjectKey projectKey, boolean isIssueMode, BranchConfiguration branchConfig) {
if (project == null) {
Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG);
- project = loader.load(projectKey.get(), isIssueMode, branchConfig.branchTarget());
+ project = loader.load(projectKey.get(), isIssueMode, branchConfig.branchBase());
checkProject(isIssueMode);
profiler.stopInfo();
}
BranchType branchType();
/**
- * The name of the target branch to merge into, and the base to determine changed files.
- *
- * @return name of the target branch
+ * The name of the branch.
+ */
+ @CheckForNull
+ String branchName();
+
+ /**
+ * The name of the target branch to merge into.
*/
@CheckForNull
String branchTarget();
/**
- * The name of the branch.
+ * The name of the base branch to determine project repository and changed files.
*/
@CheckForNull
- String branchName();
+ String branchBase();
}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT 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 02110-1301, USA.
- */
-package org.sonar.scanner.scan;
-
-import java.util.List;
-import javax.annotation.Nullable;
-import org.sonar.api.batch.InstantiationStrategy;
-import org.sonar.api.batch.ScannerSide;
-
-@ScannerSide
-@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
-public interface BranchConfigurationValidator {
- void validate(List<String> validationMessages, @Nullable String deprecatedBranchName, boolean incrementalMode);
-}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT 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 02110-1301, USA.
+ */
+package org.sonar.scanner.scan;
+
+import java.util.List;
+import javax.annotation.Nullable;
+import org.sonar.api.batch.InstantiationStrategy;
+import org.sonar.api.batch.ScannerSide;
+
+@ScannerSide
+@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
+public interface BranchParamsValidator {
+ void validate(List<String> validationMessages, @Nullable String deprecatedBranchName, boolean incrementalMode);
+}
return BranchType.LONG;
}
+ @CheckForNull
+ @Override
+ public String branchName() {
+ return null;
+ }
+
@CheckForNull
@Override
public String branchTarget() {
@CheckForNull
@Override
- public String branchName() {
+ public String branchBase() {
return null;
}
}
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT 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 02110-1301, USA.
- */
-package org.sonar.scanner.scan;
-
-import java.util.List;
-import javax.annotation.Nullable;
-
-public class DefaultBranchConfigurationValidator implements BranchConfigurationValidator {
- @Override
- public void validate(List<String> validationMessages, @Nullable String deprecatedBranchName, boolean incrementalMode) {
- // no-op
- }
-}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 SonarSource SA
+ * mailto:info AT sonarsource DOT 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 02110-1301, USA.
+ */
+package org.sonar.scanner.scan;
+
+import java.util.List;
+import javax.annotation.Nullable;
+
+public class DefaultBranchParamsValidator implements BranchParamsValidator {
+ @Override
+ public void validate(List<String> validationMessages, @Nullable String deprecatedBranchName, boolean incrementalMode) {
+ // no-op
+ }
+}
public class ProjectReactorValidator {
private final DefaultAnalysisMode mode;
- private final BranchConfigurationValidator branchConfigurationValidator;
+ private final BranchParamsValidator branchParamsValidator;
- public ProjectReactorValidator(DefaultAnalysisMode mode, BranchConfigurationValidator branchConfigurationValidator) {
+ public ProjectReactorValidator(DefaultAnalysisMode mode, BranchParamsValidator branchParamsValidator) {
this.mode = mode;
- this.branchConfigurationValidator = branchConfigurationValidator;
+ this.branchParamsValidator = branchParamsValidator;
}
public ProjectReactorValidator(DefaultAnalysisMode mode) {
- this(mode, new DefaultBranchConfigurationValidator());
+ this(mode, new DefaultBranchParamsValidator());
}
public void validate(ProjectReactor reactor) {
String deprecatedBranchName = reactor.getRoot().getBranch();
- branchConfigurationValidator.validate(validationMessages, deprecatedBranchName, mode.isIncremental());
+ branchParamsValidator.validate(validationMessages, deprecatedBranchName, mode.isIncremental());
validateBranch(validationMessages, deprecatedBranchName);
if (!validationMessages.isEmpty()) {
private Date lastAnalysisDate;
@Override
- public ProjectRepositories load(String projectKey, boolean isIssuesMode, @Nullable String branchTarget) {
+ public ProjectRepositories load(String projectKey, boolean isIssuesMode, @Nullable String branchBase) {
Table<String, String, String> settings = HashBasedTable.create();
return new ProjectRepositories(settings, fileDataTable, lastAnalysisDate);
}
private static class FakeBranchConfiguration implements BranchConfiguration {
private BranchType branchType = BranchType.LONG;
- private String branchName = "";
- private String branchTarget = "";
+ private String branchName = null;
+ private String branchTarget = null;
+ private String branchBase = null;
@Override
public BranchType branchType() {
return branchType;
}
+ @CheckForNull
+ @Override
+ public String branchName() {
+ return branchName;
+ }
+
@CheckForNull
@Override
public String branchTarget() {
@CheckForNull
@Override
- public String branchName() {
- return branchName;
+ public String branchBase() {
+ return branchBase;
}
}