This repository has been archived by the owner on Apr 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
feat: ARM-arch is now supported, avoid always recomputing values #48
Merged
+24
−17
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
41 changes: 24 additions & 17 deletions
41
core/src/main/java/io/javaoperatorsdk/jenvtest/binary/OSInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
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; | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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