From 6e49388d81748be6f28cfbefe64c4fa1bb5f374a Mon Sep 17 00:00:00 2001 From: Sam Cao Date: Wed, 23 Oct 2024 06:46:51 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=B3=20chore:=20Upgrade=20Javet=20and?= =?UTF-8?q?=20JUnit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Upgrade Javet to v4.0.0 * Upgrade JUnit to v5.11.3 --- build.gradle.kts | 58 +++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 2b42ce3..257d8e5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -49,24 +49,22 @@ object Config { } object Projects { - const val JAVET = "com.caoccao.javet:javet:${Versions.JAVET}" - const val JAVET_LINUX_ARM64 = "com.caoccao.javet:javet-linux-arm64:${Versions.JAVET}" - const val JAVET_MACOS = "com.caoccao.javet:javet-macos:${Versions.JAVET}" - - // https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api - const val JUNIT_JUPITER_API = "org.junit.jupiter:junit-jupiter-api:${Versions.JUNIT}" - - // https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine - const val JUNIT_JUPITER_ENGINE = "org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT}" - - // https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-params - const val JUNIT_JUPITER_PARAMS = "org.junit.jupiter:junit-jupiter-params:${Versions.JUNIT}" + const val JAVET = "com.caoccao.javet:javet-core:${Versions.JAVET}" + val JAVET_BINARY = { + val os = OperatingSystem.current() + val arch = System.getProperty("os.arch") + val osType = if (os.isWindows) "windows" else + if (os.isMacOsX) "macos" else + if (os.isLinux) "linux" else "" + val archType = if (arch == "aarch64" || arch == "arm64") "arm64" else "x86_64" + "com.caoccao.javet:javet-v8-$osType-$archType:${Versions.JAVET}" + } } object Versions { const val JAVA_VERSION = "1.8" - const val JAVET = "3.1.8" - const val JUNIT = "5.10.1" + const val JAVET = "4.0.0" + const val JUNIT = "5.11.3" const val SWC4J = "1.2.0" } } @@ -95,17 +93,17 @@ java { dependencies { val os = OperatingSystem.current() - val cpuArch = System.getProperty("os.arch") - if (os.isMacOsX) { - testImplementation(Config.Projects.JAVET_MACOS) - } else if (os.isLinux && (cpuArch == "aarch64" || cpuArch == "arm64")) { - testImplementation(Config.Projects.JAVET_LINUX_ARM64) - } else { - testImplementation(Config.Projects.JAVET) - } - testImplementation(Config.Projects.JUNIT_JUPITER_API) - testImplementation(Config.Projects.JUNIT_JUPITER_PARAMS) - testRuntimeOnly(Config.Projects.JUNIT_JUPITER_ENGINE) + val arch = System.getProperty("os.arch") + val isI18n = false + val isNode = false + val i18nType = if (isI18n) "-i18n" else "" + val jsRuntimeTimeType = if (isNode) "node" else "v8" + val osType = if (os.isWindows) "windows" else + if (os.isMacOsX) "macos" else + if (os.isLinux) "linux" else "" + val archType = if (arch == "aarch64" || arch == "arm64") "arm64" else "x86_64" + testImplementation(Config.Projects.JAVET) + testImplementation(Config.Projects.JAVET_BINARY()) } afterEvaluate { @@ -137,6 +135,16 @@ tasks.jar { } } +testing { + suites { + // Configure the built-in test suite + val test by getting(JvmTestSuite::class) { + // Use JUnit Jupiter test framework + useJUnitJupiter(Config.Versions.JUNIT) + } + } +} + tasks.test { useJUnitPlatform { excludeTags("performance")