Skip to content

Commit

Permalink
SLLS-279 populate sonar.java.source analyzer property when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
sophio-japharidze-sonarsource committed Nov 25, 2024
1 parent a055a7d commit 6f40211
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,18 @@ public Map<String, String> configureJavaProperties(List<URI> fileInTheSameModule
// Assume all files in the same module have the same vmLocation
var commonConfig = javaConfigs.get(javaConfigs.keySet().iterator().next());
var vmLocationStr = commonConfig.getVmLocation();
var sourceLevel = commonConfig.getSourceLevel();
List<Path> jdkClassesRoots = new ArrayList<>();
if (vmLocationStr != null) {
var vmLocation = Paths.get(vmLocationStr);
jdkClassesRoots = getVmClasspathFromCacheOrCompute(vmLocation);
props.put("sonar.java.jdkHome", vmLocationStr);
}

if (sourceLevel != null) {
props.put("sonar.java.source", sourceLevel);
}

// Assume all main files have the same classpath
if (!mainFiles.isEmpty()) {
var mainConfig = javaConfigs.get(mainFiles.get(0));
Expand Down

0 comments on commit 6f40211

Please sign in to comment.