diff --git a/CHANGELOG.md b/CHANGELOG.md index a77cc74e0..89f0e8404 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ ### Added - Added `showPulse` parameter to `ProgressLayout.progressBar`, allowing you to disable the pulse animation for a bar. +### Changed +- Update Kotlin to 1.9 + ### Fixed - Fixed exception thrown in environments that are missing required shared native libraries. - Fixed animations clearing too much space when the animation changes size while running. [(#110)](https://github.com/ajalt/mordant/issues/110) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4d6e8126d..322e22aa3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,15 +1,15 @@ [versions] -kotlin = "1.8.22" +kotlin = "1.9.10" [libraries] colormath = "com.github.ajalt.colormath:colormath:3.3.1" -markdown = "org.jetbrains:markdown:0.4.1" +markdown = "org.jetbrains:markdown:0.5.0" jna-core = "net.java.dev.jna:jna:5.13.0" # used in tests -kotest = "io.kotest:kotest-assertions-core:5.6.2" +kotest = "io.kotest:kotest-assertions-core:5.7.2" systemrules = "com.github.stefanbirkner:system-rules:1.19.0" [plugins] -dokka = "org.jetbrains.dokka:1.8.10" -publish = "com.vanniktech.maven.publish:0.25.2" +dokka = "org.jetbrains.dokka:1.9.0" +publish = "com.vanniktech.maven.publish:0.25.3" diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index c1962a79e..7f93135c4 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 37aef8d3f..ac72c34e8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index aeb74cbb4..0adc8e1a5 100755 --- a/gradlew +++ b/gradlew @@ -83,7 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -130,10 +131,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. diff --git a/mordant/src/linuxX64Main/kotlin/com/github/ajalt/mordant/internal/MppImpl.kt b/mordant/src/linuxX64Main/kotlin/com/github/ajalt/mordant/internal/MppImpl.kt index 5494966af..83836a0bd 100644 --- a/mordant/src/linuxX64Main/kotlin/com/github/ajalt/mordant/internal/MppImpl.kt +++ b/mordant/src/linuxX64Main/kotlin/com/github/ajalt/mordant/internal/MppImpl.kt @@ -1,5 +1,6 @@ package com.github.ajalt.mordant.internal +import kotlinx.cinterop.ExperimentalForeignApi import kotlinx.cinterop.alloc import kotlinx.cinterop.memScoped import platform.posix.STDIN_FILENO @@ -7,10 +8,11 @@ import platform.posix.TIOCGWINSZ import platform.posix.ioctl import platform.posix.winsize +@OptIn(ExperimentalForeignApi::class) internal actual fun getTerminalSize(): Pair? { return memScoped { val size = alloc() - if (ioctl(STDIN_FILENO, TIOCGWINSZ, size) < 0) { + if (ioctl(STDIN_FILENO, TIOCGWINSZ.toULong(), size) < 0) { null } else { size.ws_col.toInt() to size.ws_row.toInt() diff --git a/mordant/src/macosMain/kotlin/com/github/ajalt/mordant/internal/MppImpl.kt b/mordant/src/macosMain/kotlin/com/github/ajalt/mordant/internal/MppImpl.kt index 5494966af..95cc2cac8 100644 --- a/mordant/src/macosMain/kotlin/com/github/ajalt/mordant/internal/MppImpl.kt +++ b/mordant/src/macosMain/kotlin/com/github/ajalt/mordant/internal/MppImpl.kt @@ -1,5 +1,6 @@ package com.github.ajalt.mordant.internal +import kotlinx.cinterop.ExperimentalForeignApi import kotlinx.cinterop.alloc import kotlinx.cinterop.memScoped import platform.posix.STDIN_FILENO @@ -7,6 +8,7 @@ import platform.posix.TIOCGWINSZ import platform.posix.ioctl import platform.posix.winsize +@OptIn(ExperimentalForeignApi::class) internal actual fun getTerminalSize(): Pair? { return memScoped { val size = alloc() diff --git a/mordant/src/mingwX64Main/kotlin/com/github/ajalt/mordant/internal/MppImpl.kt b/mordant/src/mingwX64Main/kotlin/com/github/ajalt/mordant/internal/MppImpl.kt index 4f7bb9485..f80ceab50 100644 --- a/mordant/src/mingwX64Main/kotlin/com/github/ajalt/mordant/internal/MppImpl.kt +++ b/mordant/src/mingwX64Main/kotlin/com/github/ajalt/mordant/internal/MppImpl.kt @@ -1,3 +1,5 @@ +@file:OptIn(ExperimentalForeignApi::class) + package com.github.ajalt.mordant.internal import kotlinx.cinterop.* diff --git a/mordant/src/nativeMain/kotlin/com/github/ajalt/mordant/internal/MppImpl.kt b/mordant/src/nativeMain/kotlin/com/github/ajalt/mordant/internal/MppImpl.kt index 2ca9a6260..a0a373c05 100644 --- a/mordant/src/nativeMain/kotlin/com/github/ajalt/mordant/internal/MppImpl.kt +++ b/mordant/src/nativeMain/kotlin/com/github/ajalt/mordant/internal/MppImpl.kt @@ -1,13 +1,17 @@ +@file:OptIn(ExperimentalForeignApi::class, ExperimentalNativeApi::class) + package com.github.ajalt.mordant.internal import com.github.ajalt.mordant.terminal.* import kotlinx.cinterop.* import platform.posix.* -import kotlin.native.concurrent.AtomicReference +import kotlin.concurrent.AtomicInt +import kotlin.concurrent.AtomicReference +import kotlin.experimental.ExperimentalNativeApi internal actual class AtomicInt actual constructor(initial: Int) { - private val backing = kotlin.native.concurrent.AtomicInt(initial) + private val backing = AtomicInt(initial) actual fun getAndIncrement(): Int { return backing.addAndGet(1) - 1 } @@ -64,7 +68,7 @@ internal actual fun makePrintingTerminalCursor(terminal: Terminal): TerminalCurs // These are for the NativeTerminalCursor, but are top-level since atexit and signal require static // functions. -private val registeredAtExit = kotlin.native.concurrent.AtomicInt(0) +private val registeredAtExit = AtomicInt(0) private const val CURSOR_SHOW_STR = "\u001B[?25h" private val CURSOR_SHOW_BUF = CURSOR_SHOW_STR.cstr // .ctr allocates, so we need to do it statically @@ -87,7 +91,7 @@ private fun cursorSigintHandler(signum: Int) { STDOUT_FILENO, CURSOR_SHOW_BUF, // `CURSOR_SHOW_STR.length == 6`. We use a literal since that parameter is a UInt on mingw and a ULong on posix - 6 + 6u ) signal(SIGINT, existingSigintHandler.value ?: SIG_DFL) // reset signal handling to previous value existingSigintHandler.value = null diff --git a/mordant/src/posixMain/kotlin/com/github/ajalt/mordant/internal/tty.kt b/mordant/src/posixMain/kotlin/com/github/ajalt/mordant/internal/tty.kt index a1897bd82..7b1133116 100644 --- a/mordant/src/posixMain/kotlin/com/github/ajalt/mordant/internal/tty.kt +++ b/mordant/src/posixMain/kotlin/com/github/ajalt/mordant/internal/tty.kt @@ -1,9 +1,8 @@ +@file:OptIn(ExperimentalForeignApi::class) + package com.github.ajalt.mordant.internal -import kotlinx.cinterop.alloc -import kotlinx.cinterop.convert -import kotlinx.cinterop.memScoped -import kotlinx.cinterop.ptr +import kotlinx.cinterop.* import platform.posix.* // https://www.gnu.org/software/libc/manual/html_node/getpass.html