From 3c5c7899103dbacdee4602b314f78e7393bd95e8 Mon Sep 17 00:00:00 2001 From: jaguililla Date: Wed, 29 Nov 2023 22:51:16 +0100 Subject: [PATCH 1/6] Set next release version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index acd240dad5..0e8dea0e4c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ org.gradle.warning.mode=all org.gradle.console=plain # Gradle -version=3.4.4 +version=3.4.5 group=com.hexagonkt description=The atoms of your platform From 074270f5b4ec576a7dc1a7053006209dda7deebf Mon Sep 17 00:00:00 2001 From: jaguililla Date: Wed, 6 Dec 2023 13:53:29 +0100 Subject: [PATCH 2/6] Optimize nightly build execution --- .github/workflows/nightly.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 8a95a5ed32..b524d384fc 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -70,7 +70,9 @@ jobs: java-version: 21 distribution: graalvm-community cache: gradle - - run: ./gradlew --stacktrace nativeTest + - run: echo "COMMIT_COUNT=$(git log --oneline --since '24 hours ago' | wc -l)" >> $GITHUB_ENV + - if: ${{ env.COMMIT_COUNT > 0 }} + run: ./gradlew --stacktrace nativeTest jmh: uses: hexagonkt/.github/.github/workflows/graalvm_gradle.yml@master From 8e2053c57509a5f51e3d1452050112f61c45cbcb Mon Sep 17 00:00:00 2001 From: jaguililla Date: Wed, 6 Dec 2023 13:53:51 +0100 Subject: [PATCH 3/6] Update dependencies --- gradle.properties | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 0e8dea0e4c..06442671e4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -50,7 +50,7 @@ helidonVersion=4.0.1 # http_server_servlet servletVersion=6.0.0 -jettyVersion=12.0.3 +jettyVersion=12.0.4 # rest_tools swaggerRequestValidatorVersion=2.39.0 @@ -60,9 +60,7 @@ slf4jVersion=2.0.9 logbackVersion=1.4.12 # serialization -# TODO -#jacksonVersion=2.16.0 -jacksonVersion=2.15.3 +jacksonVersion=2.16.0 dslJsonVersion=2.0.2 # templates_freemarker From 3c08f08e9aee066a141e97e7931d4243fdba2845 Mon Sep 17 00:00:00 2001 From: jaguililla Date: Wed, 6 Dec 2023 13:54:11 +0100 Subject: [PATCH 4/6] Clean up tests --- .../test/kotlin/com/hexagonkt/core/HelpersTest.kt | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/core/src/test/kotlin/com/hexagonkt/core/HelpersTest.kt b/core/src/test/kotlin/com/hexagonkt/core/HelpersTest.kt index cca454be40..7b3197bfac 100644 --- a/core/src/test/kotlin/com/hexagonkt/core/HelpersTest.kt +++ b/core/src/test/kotlin/com/hexagonkt/core/HelpersTest.kt @@ -41,18 +41,6 @@ internal class HelpersTest { assertEquals("test", "echo test".shell().trim()) } - @Test fun `System setting works ok`() { - System.setProperty("system_property", "value") - - assert(Jvm.systemSetting("system_property") == "value") - - assert(Jvm.systemSetting("PATH").isNotEmpty()) - assertNull(Jvm.systemSettingOrNull("_not_defined_")) - - System.setProperty("PATH", "path override") - assert(Jvm.systemSetting("PATH") == "path override") - } - @Test fun `Multiple retry errors throw an exception`() { val retries = 3 try { From 8201dd8b6db2837a8109f1d387694acd911b06c9 Mon Sep 17 00:00:00 2001 From: jaguililla Date: Thu, 7 Dec 2023 08:07:53 +0100 Subject: [PATCH 5/6] Change system loading logic --- core/README.md | 8 +++++++- core/src/main/kotlin/com/hexagonkt/core/Jvm.kt | 14 +++++++------- core/src/test/kotlin/com/hexagonkt/core/JvmTest.kt | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/core/README.md b/core/README.md index 340db727fe..68a8951fc6 100644 --- a/core/README.md +++ b/core/README.md @@ -30,7 +30,10 @@ application), you can import it with the following code: ``` # Package com.hexagonkt.core -JVM information and other useful utilities. +JVM information and other useful utilities. Includes basic program settings support at the [Jvm] +object (like loading and retrieving system settings). + +[Jvm]: /api/core/com.hexagonkt.core/-jvm # Package com.hexagonkt.core.logging Provides a logging management capabilities abstracting the application from logging libraries. @@ -55,3 +58,6 @@ Media types definitions and constants for default media types. # Package com.hexagonkt.core.security Cryptography and key stores utilities. + +# Package com.hexagonkt.core.text +Text utilities to allow the use of ANSI escape codes and case converting tools among other features. diff --git a/core/src/main/kotlin/com/hexagonkt/core/Jvm.kt b/core/src/main/kotlin/com/hexagonkt/core/Jvm.kt index a269af5da9..9f3a3711e4 100644 --- a/core/src/main/kotlin/com/hexagonkt/core/Jvm.kt +++ b/core/src/main/kotlin/com/hexagonkt/core/Jvm.kt @@ -105,14 +105,14 @@ object Jvm { } /** - * Retrieve a setting by name by looking in the JVM system properties first and in OS - * environment variables if not found. + * Retrieve a setting by name by looking in OS environment variables first and in the JVM system + * properties if not found. * * @param type Type of the requested parameter. Supported types are: boolean, int, long, float, * double and string, throw an error if other type is supplied. * @param name Name of the searched parameter, can not be blank. * @return Value of the searched parameter in the requested type, `null` if the parameter is not - * found on the JVM system properties and in OS environment variables. + * found on the OS environment variables or in JVM system properties. */ fun systemSettingOrNull(type: KClass, name: String): T? = systemSettingRaw(name).let { it.parseOrNull(type) } @@ -122,8 +122,8 @@ object Jvm { ?: error("Required '${type.simpleName}' system setting '$name' not found") /** - * Retrieve a flag (boolean parameter) by name by looking in the JVM system properties first and - * in OS environment variables if not found. + * Retrieve a flag (boolean parameter) by name by looking in OS environment variables first and + * in the JVM system properties if not found. * * @param name Name of the searched parameter, can not be blank. * @return True if the parameter is found and its value is exactly 'true', false otherwise. @@ -138,7 +138,7 @@ object Jvm { * double and string, throw an error if other type is supplied. * @param name Name of the searched parameter, can not be blank. * @return Value of the searched parameter in the requested type, `null` if the parameter is not - * found on the JVM system properties and in OS environment variables. + * found on the OS environment variables or in JVM system properties. */ inline fun systemSettingOrNull(name: String): T? = systemSettingOrNull(T::class, name) @@ -149,7 +149,7 @@ object Jvm { private fun systemSettingRaw(name: String): String? { val correctName = name.matches(systemSettingPattern) require(correctName) { "Setting name must match $systemSettingPattern" } - return System.getProperty(name, System.getenv(name)) + return System.getenv(name) ?: System.getProperty(name) } /** Operating system name ('os.name' property). If `null` throws an exception. */ diff --git a/core/src/test/kotlin/com/hexagonkt/core/JvmTest.kt b/core/src/test/kotlin/com/hexagonkt/core/JvmTest.kt index 3e6dc9cc75..42cdae7717 100644 --- a/core/src/test/kotlin/com/hexagonkt/core/JvmTest.kt +++ b/core/src/test/kotlin/com/hexagonkt/core/JvmTest.kt @@ -216,7 +216,7 @@ internal class JvmTest { assertNull(Jvm.systemSettingOrNull("_not_defined_")) System.setProperty("PATH", "path override") - assert(Jvm.systemSetting("PATH") == "path override") + assert(Jvm.systemSetting("PATH") != "path override") } private fun checkOsKind(osName: String, osKind: OsKind) { From dfbf0582c582d68c237ddd13b25dc02b4ee177da Mon Sep 17 00:00:00 2001 From: jaguililla Date: Thu, 7 Dec 2023 08:13:19 +0100 Subject: [PATCH 6/6] Update dependencies --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 06442671e4..bb2318b6df 100644 --- a/gradle.properties +++ b/gradle.properties @@ -57,7 +57,7 @@ swaggerRequestValidatorVersion=2.39.0 # logging slf4jVersion=2.0.9 -logbackVersion=1.4.12 +logbackVersion=1.4.14 # serialization jacksonVersion=2.16.0