aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-runner-api/src/main/java/org
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2015-08-12 08:33:30 +0200
committerDuarte Meneses <duarte.meneses@sonarsource.com>2015-08-12 13:46:58 +0200
commit43acac9dcbbbcb5a74bd13218d422e01487c5521 (patch)
tree46123883920973f203fdcf65acc1922e22e667b6 /sonar-runner-api/src/main/java/org
parent957ee8dda99b4ad469bc08250aab65a77863dc97 (diff)
downloadsonar-scanner-cli-43acac9dcbbbcb5a74bd13218d422e01487c5521.tar.gz
sonar-scanner-cli-43acac9dcbbbcb5a74bd13218d422e01487c5521.zip
SONARUNNER-145 Expose cache sync API
Diffstat (limited to 'sonar-runner-api/src/main/java/org')
-rw-r--r--sonar-runner-api/src/main/java/org/sonar/runner/api/EmbeddedRunner.java17
-rw-r--r--sonar-runner-api/src/main/java/org/sonar/runner/impl/ServerConnection.java7
2 files changed, 16 insertions, 8 deletions
diff --git a/sonar-runner-api/src/main/java/org/sonar/runner/api/EmbeddedRunner.java b/sonar-runner-api/src/main/java/org/sonar/runner/api/EmbeddedRunner.java
index 7b852ab..bebbf38 100644
--- a/sonar-runner-api/src/main/java/org/sonar/runner/api/EmbeddedRunner.java
+++ b/sonar-runner-api/src/main/java/org/sonar/runner/api/EmbeddedRunner.java
@@ -124,9 +124,20 @@ public class EmbeddedRunner {
}
}
+ public void syncProject(String projectKey) {
+ if (!VersionUtils.isAtLeast52(launcher.getVersion())) {
+ throw new IllegalStateException("not supported in current SonarQube version: " + launcher.getVersion());
+ }
+ launcher.syncProject(projectKey);
+ }
+
public void start() {
+ start(false);
+ }
+
+ public void start(boolean forceSync) {
initGlobalDefaultValues();
- doStart();
+ doStart(forceSync);
}
public void stop() {
@@ -175,7 +186,7 @@ public class EmbeddedRunner {
}
}
- protected void doStart() {
+ protected void doStart(boolean forceSync) {
launcher = launcherFactory.createLauncher(globalProperties());
if (VersionUtils.isAtLeast52(launcher.getVersion())) {
launcher.start(globalProperties(), new org.sonar.runner.batch.LogOutput() {
@@ -185,7 +196,7 @@ public class EmbeddedRunner {
logOutput.log(formattedMessage, LogOutput.Level.valueOf(level.name()));
}
- });
+ }, forceSync);
}
}
diff --git a/sonar-runner-api/src/main/java/org/sonar/runner/impl/ServerConnection.java b/sonar-runner-api/src/main/java/org/sonar/runner/impl/ServerConnection.java
index 457e355..eb1002f 100644
--- a/sonar-runner-api/src/main/java/org/sonar/runner/impl/ServerConnection.java
+++ b/sonar-runner-api/src/main/java/org/sonar/runner/impl/ServerConnection.java
@@ -78,11 +78,8 @@ class ServerConnection {
private static boolean isCacheEnabled(Properties properties) {
String analysisMode = properties.getProperty("sonar.analysis.mode");
- String enableOffline = properties.getProperty("sonar.enableOffline");
- boolean isPreview = "preview".equalsIgnoreCase(analysisMode) || "quick".equalsIgnoreCase(analysisMode) ||
- "incremental".equalsIgnoreCase(analysisMode);
-
- return isPreview && "true".equals(enableOffline);
+ boolean isPreview = "issues".equalsIgnoreCase(analysisMode);
+ return isPreview;
}
/**