|
26 | 26 | import java.nio.file.Path; |
27 | 27 | import java.nio.file.Paths; |
28 | 28 | import java.nio.file.attribute.PosixFilePermission; |
| 29 | +import java.util.EnumSet; |
29 | 30 | import java.util.HashMap; |
30 | 31 | import java.util.List; |
31 | 32 | import java.util.Map; |
|
69 | 70 | import org.sonarsource.sonarlint.core.rpc.protocol.backend.connection.config.DidChangeCredentialsParams; |
70 | 71 | import org.sonarsource.sonarlint.core.rpc.protocol.backend.connection.projects.GetAllProjectsParams; |
71 | 72 | import org.sonarsource.sonarlint.core.rpc.protocol.backend.connection.projects.SonarProjectDto; |
| 73 | +import org.sonarsource.sonarlint.core.rpc.protocol.backend.initialize.BackendCapability; |
72 | 74 | import org.sonarsource.sonarlint.core.rpc.protocol.backend.initialize.ClientConstantInfoDto; |
73 | | -import org.sonarsource.sonarlint.core.rpc.protocol.backend.initialize.FeatureFlagsDto; |
74 | 75 | import org.sonarsource.sonarlint.core.rpc.protocol.backend.initialize.HttpConfigurationDto; |
75 | 76 | import org.sonarsource.sonarlint.core.rpc.protocol.backend.initialize.InitializeParams; |
76 | 77 | import org.sonarsource.sonarlint.core.rpc.protocol.backend.initialize.JsTsRequirementsDto; |
@@ -191,22 +192,16 @@ protected IStatus run(IProgressMonitor monitor) { |
191 | 192 | var sqConnections = ConnectionSynchronizer.buildSqConnectionDtos(); |
192 | 193 | var scConnections = ConnectionSynchronizer.buildScConnectionDtos(); |
193 | 194 |
|
194 | | - // Check if telemetry was disabled via system properties (e.g. in unit / integration tests) |
195 | | - var telemetryEnabled = !Boolean.parseBoolean(System.getProperty("sonarlint.telemetry.disabled", "false")); |
196 | | - |
197 | 195 | // Getting this information is expensive, therefore only do it once and re-use the values! |
198 | 196 | var plugInVersion = SonarLintUtils.getPluginVersion(); |
199 | 197 | var ideVersion = SonarLintTelemetry.ideVersionForTelemetry(); |
200 | 198 |
|
201 | | - var monitoringEnabled = MonitoringService.isDogfoodingEnvironment(); |
202 | | - SonarLintLogger.get().debug("Monitoring with Sentry is " + (monitoringEnabled ? "enabled" : "disabled")); |
203 | | - |
204 | 199 | backend.initialize(new InitializeParams( |
205 | 200 | new ClientConstantInfoDto(getIdeName(), "SonarQube for IDE (SonarLint) - Eclipse " + plugInVersion + " - " + ideVersion), |
206 | 201 | new TelemetryClientConstantAttributesDto("eclipse", "SonarLint Eclipse", plugInVersion, ideVersion, Map.of()), |
207 | 202 | httpConfiguration, |
208 | 203 | getSonarCloudAlternativeEnvironment(), |
209 | | - new FeatureFlagsDto(true, true, true, true, false, true, true, true, telemetryEnabled, true, monitoringEnabled), |
| 204 | + getBackendCapabilities(), |
210 | 205 | StoragePathManager.getStorageDir(), |
211 | 206 | StoragePathManager.getDefaultWorkDir(), |
212 | 207 | Set.copyOf(embeddedPluginPaths), |
@@ -242,6 +237,32 @@ protected IStatus run(IProgressMonitor monitor) { |
242 | 237 | return Status.OK_STATUS; |
243 | 238 | } |
244 | 239 |
|
| 240 | + private Set<BackendCapability> getBackendCapabilities() { |
| 241 | + // Check if telemetry was disabled via system properties (e.g. in unit / integration tests) |
| 242 | + var telemetryEnabled = !Boolean.parseBoolean(System.getProperty("sonarlint.telemetry.disabled", "false")); |
| 243 | + |
| 244 | + var monitoringEnabled = MonitoringService.isDogfoodingEnvironment(); |
| 245 | + SonarLintLogger.get().debug("Monitoring with Sentry is " + (monitoringEnabled ? "enabled" : "disabled")); |
| 246 | + |
| 247 | + var backendCapabilities = EnumSet.of( |
| 248 | + BackendCapability.SMART_NOTIFICATIONS, |
| 249 | + BackendCapability.PROJECT_SYNCHRONIZATION, |
| 250 | + BackendCapability.EMBEDDED_SERVER, |
| 251 | + BackendCapability.SERVER_SENT_EVENTS, |
| 252 | + BackendCapability.DATAFLOW_BUG_DETECTION, |
| 253 | + BackendCapability.FULL_SYNCHRONIZATION); |
| 254 | + |
| 255 | + if (telemetryEnabled) { |
| 256 | + backendCapabilities.add(BackendCapability.TELEMETRY); |
| 257 | + } |
| 258 | + |
| 259 | + if (monitoringEnabled) { |
| 260 | + backendCapabilities.add(BackendCapability.MONITORING); |
| 261 | + } |
| 262 | + |
| 263 | + return backendCapabilities; |
| 264 | + } |
| 265 | + |
245 | 266 | /** |
246 | 267 | * When running tests, Tycho does not execute p2 directives, so we have to manually fix the permissions of the sloop executables. |
247 | 268 | */ |
|
0 commit comments