From 4df54948f9eae82c6e5d9e20cc1e4d82c9a83872 Mon Sep 17 00:00:00 2001 From: Alexander Zinovyev Date: Tue, 8 Nov 2022 00:28:32 +1300 Subject: [PATCH] Add `riscv32` and `riscv64` support (#62) Motivation: - `os-maven-plugin` doesn't recognize the following `os.arch` values: - `riscv32` - `riscv64` Modifications: - Return `riscv` for `riscv` and `riscv32`. - Return `riscv64` for `riscv64`. Result: - Fixes #61 Co-authored-by: Trustin Lee --- README.md | 3 ++- src/main/java/kr/motd/maven/os/Detector.java | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2ce5e44..e13be98 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,8 @@ * `ppcle_64` - if the value is `ppc64le` * `s390_32` - if the value is `s390` * `s390_64` if the value is `s390x` -* `riscv` if the value is `riscv` +* `riscv` if the value is `riscv` or `riscv32` +* `riscv64` if the value is `riscv64` * `e2k` if the value is `e2k` Note: The bitness part of this property relies on the bitness of the JVM binary, e.g. You'll get the property that ends with `_32` if you run a 32-bit JVM on a 64-bit OS. diff --git a/src/main/java/kr/motd/maven/os/Detector.java b/src/main/java/kr/motd/maven/os/Detector.java index 56555c1..f170b9a 100644 --- a/src/main/java/kr/motd/maven/os/Detector.java +++ b/src/main/java/kr/motd/maven/os/Detector.java @@ -245,9 +245,12 @@ private static String normalizeArch(String value) { if ("s390x".equals(value)) { return "s390_64"; } - if ("riscv".equals(value)) { + if (value.matches("^(riscv|riscv32)$")) { return "riscv"; } + if ("riscv64".equals(value)) { + return "riscv64"; + } if ("e2k".equals(value)) { return "e2k"; }