Skip to content

Commit

Permalink
SLCORE-1105 Avoid showing the Java icon in the taskbar on MacOS (#1209)
Browse files Browse the repository at this point in the history
  • Loading branch information
nquinquenel authored Jan 20, 2025
1 parent 3b0252e commit 563c9b5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ private static List<String> createCommand(Path distPath, Path jreJavaExePath, @N
if (clientJvmOpts != null) {
commands.addAll(Arrays.asList(clientJvmOpts.split(" ")));
}
// Avoid displaying the Java icon in the taskbar on Mac
commands.add("-Djava.awt.headless=true");
commands.add("-classpath");
commands.add(classpath);
commands.add(SLOOP_CLI_ENTRYPOINT_CLASS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ void test_command_with_embedded_jre(@TempDir Path distPath) throws IOException {

sloop = underTest.start(distPath);

verify(mockPbFactory).apply(List.of(bundledJrejavaPath.toString(), "-classpath", distPath.resolve("lib") + File.separator + '*', "org.sonarsource.sonarlint.core.backend.cli.SonarLintServerCli"));
verify(mockPbFactory).apply(List.of(bundledJrejavaPath.toString(), "-Djava.awt.headless=true",
"-classpath", distPath.resolve("lib") + File.separator + '*', "org.sonarsource.sonarlint.core.backend.cli.SonarLintServerCli"));
assertThat(sloop.getRpcServer()).isNotNull();
}

Expand All @@ -100,7 +101,8 @@ void test_command_with_custom_jre_on_linux(@TempDir Path distPath) {
sloop = underTest.start(distPath, fakeJreHomePath);

verify(mockPbFactory)
.apply(List.of(fakeJreJavaLinuxPath.toString(), "-classpath", distPath.resolve("lib") + File.separator + '*', "org.sonarsource.sonarlint.core.backend.cli.SonarLintServerCli"));
.apply(List.of(fakeJreJavaLinuxPath.toString(), "-Djava.awt.headless=true",
"-classpath", distPath.resolve("lib") + File.separator + '*', "org.sonarsource.sonarlint.core.backend.cli.SonarLintServerCli"));
assertThat(sloop.getRpcServer()).isNotNull();
}

Expand All @@ -110,7 +112,8 @@ void test_command_with_custom_jre_on_windows(@TempDir Path distPath) {
sloop = underTest.start(distPath, fakeJreHomePath);

verify(mockPbFactory)
.apply(List.of(fakeJreJavaWindowsPath.toString(), "-classpath", distPath.resolve("lib") + File.separator + '*', "org.sonarsource.sonarlint.core.backend.cli.SonarLintServerCli"));
.apply(List.of(fakeJreJavaWindowsPath.toString(), "-Djava.awt.headless=true",
"-classpath", distPath.resolve("lib") + File.separator + '*', "org.sonarsource.sonarlint.core.backend.cli.SonarLintServerCli"));
assertThat(sloop.getRpcServer()).isNotNull();
}

Expand Down Expand Up @@ -155,7 +158,8 @@ void test_command_with_custom_jre_on_linux_and_jvm_option(@TempDir Path distPath
sloop = underTest.start(distPath, fakeJreHomePath, "-XX:+UseG1GC -XX:MaxHeapFreeRatio=50");

verify(mockPbFactory)
.apply(List.of(fakeJreJavaLinuxPath.toString(), "-XX:+UseG1GC", "-XX:MaxHeapFreeRatio=50", "-classpath", distPath.resolve("lib") + File.separator + '*', "org.sonarsource.sonarlint.core.backend.cli.SonarLintServerCli"));
.apply(List.of(fakeJreJavaLinuxPath.toString(), "-XX:+UseG1GC", "-XX:MaxHeapFreeRatio=50", "-Djava.awt.headless=true",
"-classpath", distPath.resolve("lib") + File.separator + '*', "org.sonarsource.sonarlint.core.backend.cli.SonarLintServerCli"));
assertThat(sloop.getRpcServer()).isNotNull();
}
}

0 comments on commit 563c9b5

Please sign in to comment.