From 9565da71d2898daf112b0654d4de2d4d7e0259f9 Mon Sep 17 00:00:00 2001 From: halibobo1205 Date: Thu, 31 Oct 2024 15:01:07 +0800 Subject: [PATCH] feat(arm): limit jdk for x86 and arm --- arch/build.gradle | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/build.gradle b/arch/build.gradle index 3f2689bc7f..f8832a6c36 100644 --- a/arch/build.gradle +++ b/arch/build.gradle @@ -8,6 +8,21 @@ static def isX86() { return Architectures.X86_64.isAlias(arch) || Architectures.X86.isAlias(arch) } +static def isArm64() { + def arch = System.getProperty("os.arch").toLowerCase() + return new Architectures.KnownArchitecture("arm64", "aarch64").isAlias(arch) +} + +if (isArm64() && !JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) { + throw new GradleException("Java 17 or later is required to build Java-Tron for arm64.\n" + + " Detected version ${JavaVersion.current()}") +} + +if (isX86() && !JavaVersion.current().isJava8()) { + throw new GradleException("Java 8 is required to build Java-Tron for x86.\n" + + " Detected version ${JavaVersion.current()}") +} + if (isX86()) { ext { leveldbGroup = "org.fusesource.leveldbjni"