String serverUrl = properties.getProperty("sonar.host.url");
String app = properties.getProperty(InternalProperties.RUNNER_APP);
String appVersion = properties.getProperty(InternalProperties.RUNNER_APP_VERSION);
+ boolean enableCache = isCacheEnabled(properties);
+
+ return new ServerConnection(serverUrl, app, appVersion, enableCache, cache, logger);
+ }
+
+ private static boolean isCacheEnabled(Properties properties) {
String analysisMode = properties.getProperty("sonar.analysis.mode");
String enableOffline = properties.getProperty("sonar.enableOffline");
- boolean enableCache = "preview".equalsIgnoreCase(analysisMode) && "true".equals(enableOffline);
+ boolean isPreview = "preview".equalsIgnoreCase(analysisMode) || "quick".equalsIgnoreCase(analysisMode) ||
+ "incremental".equalsIgnoreCase(analysisMode);
- return new ServerConnection(serverUrl, app, appVersion, enableCache, cache, logger);
+ return isPreview && "true".equals(enableOffline);
}
/**
httpServer.setMockResponseData("abcde");
Properties props = new Properties();
props.setProperty("sonar.host.url", httpServer.url() + "/");
- props.setProperty("sonar.analysis.mode", "preview");
+ props.setProperty("sonar.analysis.mode", "quick");
props.setProperty("sonar.enableOffline", "true");
assertThat(cacheDir.list().length).isEqualTo(0);