Skip to content

Commit

Permalink
Don't use X86 for non-x86 arhitectures
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Widdis <widdis@gmail.com>
  • Loading branch information
dbwiddis committed Jul 17, 2022
1 parent 33d4253 commit a4a92c6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
12 changes: 8 additions & 4 deletions buildSrc/src/main/java/org/opensearch/gradle/Architecture.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,23 @@
public enum Architecture {

X64,
ARM64;
ARM64,
PPC,
RISCV;

public static Architecture current() {
final String architecture = System.getProperty("os.arch", "");
switch (architecture) {
case "amd64":
case "x86_64":
case "ppc64":
case "ppc64le":
case "riscv64":
return X64;
case "aarch64":
return ARM64;
case "ppc64":
case "ppc64le":
return PPC;
case "riscv64":
return RISCV;
default:
throw new IllegalArgumentException("can not determine architecture from [" + architecture + "]");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ public class ArchitectureTests extends GradleUnitTestCase {
public void testCurrentArchitecture() {
assertEquals(Architecture.X64, currentArchitecture("amd64"));
assertEquals(Architecture.X64, currentArchitecture("x86_64"));
assertEquals(Architecture.X64, currentArchitecture("ppc64"));
assertEquals(Architecture.X64, currentArchitecture("ppc64le"));
assertEquals(Architecture.X64, currentArchitecture("riscv64"));

assertEquals(Architecture.ARM64, currentArchitecture("aarch64"));
assertEquals(Architecture.PPC, currentArchitecture("ppc64"));
assertEquals(Architecture.PPC, currentArchitecture("ppc64le"));
assertEquals(Architecture.RISCV, currentArchitecture("riscv64"));
}

public void testInvalidCurrentArchitecture() {
Expand Down

0 comments on commit a4a92c6

Please sign in to comment.