diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 6e1a1ff..f066c2d 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -34,7 +34,7 @@ jobs: uses: actions/setup-java@v3 with: distribution: 'temurin' - java-version: '19' + java-version: '27' - name: Compiling java run: ./gradlew --console="verbose" -Pversion=${GITHUB_REF_NAME} :snaploader:build @@ -65,7 +65,7 @@ jobs: uses: actions/setup-java@v3 with: distribution: 'temurin' - java-version: '19' + java-version: '27' - name: Setup maven-3.9 run: | diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 288d784..273b71d 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -56,7 +56,7 @@ jobs: uses: actions/setup-java@v3 with: distribution: 'temurin' - java-version: '19' + java-version: '27' - name: Generate javadoc run: chmod +rwx ./gradlew && ./gradlew :snaploader:generateJavadocJar diff --git a/snaploader/src/main/java/electrostatic4j/snaploader/platform/util/NativeVariant.java b/snaploader/src/main/java/electrostatic4j/snaploader/platform/util/NativeVariant.java index ea09558..88c8228 100644 --- a/snaploader/src/main/java/electrostatic4j/snaploader/platform/util/NativeVariant.java +++ b/snaploader/src/main/java/electrostatic4j/snaploader/platform/util/NativeVariant.java @@ -84,11 +84,14 @@ public enum NativeVariant { */ JVM(System.getProperty("java.vm.name")); - private static final String Linux = "Linux"; - private static final String Windows = "Windows"; - private static final String Mac = "Mac"; - private static final String WebOs = "WebOs"; - private static final String Dalvik = "Dalvik"; + private static final String Linux = "linux"; + private static final String Windows = "windows"; + private static final String Mac = "mac"; + private static final String WebOs = "webos"; + private static final String Web0s = "web0s"; + private static final String Ios = "ios"; + private static final String Iphone = "iphone"; + private static final String Dalvik = "dalvik"; private final String property; @@ -156,7 +159,9 @@ public static boolean isDesktop() { * @return true if web-os; false otherwise. Current value is constantly false. */ public static boolean isWebOs() { - return false; + return NativeVariant.OS_NAME.getProperty() + .contains(NativeVariant.WebOs) || NativeVariant.OS_NAME.getProperty() + .contains(NativeVariant.Web0s); } /** @@ -166,7 +171,8 @@ public static boolean isWebOs() { * @return true if iOS; false otherwise. Current value is constantly false. */ public static boolean isIos() { - return false; + return NativeVariant.OS_NAME.getProperty() + .contains(NativeVariant.Ios) || NativeVariant.OS_NAME.getProperty().contains(NativeVariant.Iphone); } } @@ -302,6 +308,15 @@ public static boolean isARM() { return OS_ARCH.getProperty().contains("arm") || OS_ARCH.getProperty().contains("aarch"); } + /** + * Tests whether the current CPU vendor is a Loongson vendor (i.e., an independent Chinese vendor). + * + * @return true if the current CPU vendor is a Loongson vendor. + */ + public static boolean isLoongArch() { + return OS_ARCH.getProperty().contains("loong"); + } + /** * Reads named CPU features from the OSHI library and parses them into * words. If system commands are executed, this might be an expensive @@ -411,11 +426,11 @@ public static boolean hasExtensions(String... requiredNames) { } /** - * Retrieves the data of this native variant property. + * Retrieves the data of this native variant property in a lowercase style. * * @return the specified property object in a string format. */ public String getProperty() { - return property; + return property.toLowerCase(); } } diff --git a/snaploader/src/main/java/electrostatic4j/snaploader/platform/util/PlatformPredicate.java b/snaploader/src/main/java/electrostatic4j/snaploader/platform/util/PlatformPredicate.java index acf6aeb..c4ca9b3 100644 --- a/snaploader/src/main/java/electrostatic4j/snaploader/platform/util/PlatformPredicate.java +++ b/snaploader/src/main/java/electrostatic4j/snaploader/platform/util/PlatformPredicate.java @@ -81,6 +81,12 @@ public final class PlatformPredicate { */ public static final PlatformPredicate LINUX_RISC_V_64 = new PlatformPredicate(NativeVariant.Os.isLinux() && NativeVariant.Cpu.isRiscV() && NativeVariant.Cpu.is64()); + /** + * Alias object for Linux on Loongson Arch 64 Chipset; a Chinese RISC microprocessor. + */ + public static final PlatformPredicate LINUX_LOONGARCH_64 = new PlatformPredicate(NativeVariant.Os.isDesktop() && + NativeVariant.Os.isLinux() && NativeVariant.Cpu.isLoongArch() && NativeVariant.Cpu.is64()); + /** * Alias object for MacOSX on X86 Chipset. */