Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

feat: ARM-arch is now supported, avoid always recomputing values #48

Merged
merged 1 commit into from
Mar 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 24 additions & 17 deletions core/src/main/java/io/javaoperatorsdk/jenvtest/binary/OSInfo.java
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
package io.javaoperatorsdk.jenvtest.binary;

public class OSInfo {
private final String os;
private final String arch;

public String getOSName() {
String os = System.getProperty("os.name").toLowerCase();
public OSInfo() {
final var osArch = System.getProperty("os.arch").toLowerCase();
switch (osArch) {
case "ppc64":
arch = "ppc64le";
break;
case "aarch64":
arch = "arm64";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are no binaries for ARM, but on macs this should work with amd64 binaries.

Copy link
Contributor Author

@metacosm metacosm Mar 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are binaries for ARM and, no, amd64 won't work on more recent Macs. I've checked on both, or, at least, tests don't pass on my system without this PR and do with this PR, which I assume means that things work.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh, sorry your are right, I completely missed that

break;
default:
arch = "amd64";
}

final var os = System.getProperty("os.name").toLowerCase();
if (os.contains("win")) {
return "windows";
this.os = "windows";
} else if (os.contains("mac")) {
return "darwin";
this.os = "darwin";
} else {
return os;
this.os = os;
}
}

/**
* Only amd64 and ppc64 binaries available.
*
* @return ppc64le if on that architecture otherwise amd64.
*/
public String getOSArch() {
var osArch = System.getProperty("os.arch").toLowerCase();
if (osArch.contains("ppc64")) {
return "ppc64le";
} else {
return "amd64";
}
public String getOSName() {
return os;
}

public String getOSArch() {
return arch;
}
}