Skip to content

Commit

Permalink
improve log
Browse files Browse the repository at this point in the history
  • Loading branch information
saberduck committed Sep 26, 2023
1 parent ddb7268 commit 87d494a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static Platform detect(Environment env) {
var lowerCaseOsName = osName.toLowerCase(Locale.ROOT);
if (osName.contains("Windows") && isX64(env)) {
return WIN_X64;
} else if (lowerCaseOsName.contains("linux") && isX64(env) && !isAlpine()) {
} else if (lowerCaseOsName.contains("linux") && isX64(env) && !env.isAlpine()) {
// alpine linux is using musl libc, which is not compatible with linux-x64
return LINUX_X64;
} else if (lowerCaseOsName.contains("mac os") && isARM64(env)) {
Expand All @@ -133,10 +133,6 @@ private static boolean isX64(Environment env) {
private static boolean isARM64(Environment env) {
return env.getOsArch().contains("aarch64");
}

private static boolean isAlpine() {
return Files.exists(Path.of("/etc/alpine-release"));
}
}

public EmbeddedNode(ProcessWrapper processWrapper, Environment env) {
Expand Down Expand Up @@ -164,7 +160,13 @@ public boolean isAvailable() {
* @throws IOException
*/
public void deploy() throws IOException {
LOG.info("Detected os: {} arch: {} platform: {}", env.getOsName(), env.getOsArch(), platform);
LOG.info(
"Detected os: {} arch: {} alpine: {}. Platform: {}",
env.getOsName(),
env.getOsArch(),
env.isAlpine(),
platform
);
if (platform == UNSUPPORTED) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import static org.sonarsource.api.sonarlint.SonarLintSide.INSTANCE;

import java.nio.file.Files;
import java.nio.file.Path;
import org.sonar.api.scanner.ScannerSide;
import org.sonarsource.api.sonarlint.SonarLintSide;

Expand All @@ -24,4 +26,8 @@ public String getOsName() {
public String getOsArch() {
return System.getProperty("os.arch");
}

public boolean isAlpine() {
return Files.exists(Path.of("/etc/alpine-release"));
}
}

0 comments on commit 87d494a

Please sign in to comment.