Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Kotlin to 1.9.20 #466

Merged
merged 2 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions clikt/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@file:Suppress("UNUSED_VARIABLE", "KotlinRedundantDiagnosticSuppress")


plugins {
kotlin("multiplatform")
alias(libs.plugins.publish)
Expand Down Expand Up @@ -38,43 +37,5 @@ kotlin {
api(libs.jimfs)
}
}

val nativeMain by creating {
dependsOn(commonMain)
}
val linuxX64Main by getting {
dependsOn(nativeMain)
}
val mingwX64Main by getting {
dependsOn(nativeMain)
}
val nativeDarwinMain by creating {
dependsOn(nativeMain)
}
val macosX64Main by getting {
dependsOn(nativeDarwinMain)
}
val macosArm64Main by getting {
dependsOn(nativeDarwinMain)
}

val nativeTest by creating {
dependsOn(commonTest)
}
val linuxX64Test by getting {
dependsOn(nativeTest)
}
val mingwX64Test by getting {
dependsOn(nativeTest)
}
val nativeDarwinTest by creating {
dependsOn(nativeTest)
}
val macosX64Test by getting {
dependsOn(nativeDarwinTest)
}
val macosArm64Test by getting {
dependsOn(nativeDarwinTest)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ internal expect fun isWindowsMpp(): Boolean
/** Doesn't return [Nothing], since it's a no-op on the browser */
internal expect fun exitProcessMpp(status: Int)

internal expect fun isLetterOrDigit(c: Char): Boolean

internal expect fun readFileIfExists(filename: String): String?
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.github.ajalt.clikt.parameters.options

import com.github.ajalt.clikt.completion.CompletionCandidates
import com.github.ajalt.clikt.core.*
import com.github.ajalt.clikt.mpp.isLetterOrDigit
import com.github.ajalt.clikt.core.Context
import com.github.ajalt.clikt.core.GroupableOption
import com.github.ajalt.clikt.core.ParameterHolder
import com.github.ajalt.clikt.core.StaticallyGroupedOption
import com.github.ajalt.clikt.output.HelpFormatter
import com.github.ajalt.clikt.parsers.Invocation
import com.github.ajalt.clikt.sources.ValueSource
Expand Down Expand Up @@ -130,7 +132,7 @@ internal fun inferEnvvar(names: Set<String>, envvar: String?, autoEnvvarPrefix:
/** Split an option token into a pair of prefix to simple name. */
internal fun splitOptionPrefix(name: String): Pair<String, String> =
when {
name.length < 2 || isLetterOrDigit(name[0]) -> "" to name
name.length < 2 || name[0] !in "-@/+" -> "" to name
name.length > 2 && name[0] == name[1] -> name.slice(0..1) to name.substring(2)
else -> name.substring(0, 1) to name.substring(1)
}
Expand Down
4 changes: 0 additions & 4 deletions clikt/src/jsMain/kotlin/com/github/ajalt/clikt/mpp/MppImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,8 @@ private val impls: JsMppImpls = try {
BrowserMppImpls
}

private val LETTER_OR_DIGIT_RE = Regex("""[a-zA-Z0-9]""")

internal actual val String.graphemeLengthMpp: Int get() = replace(ANSI_CODE_RE, "").length

internal actual fun isLetterOrDigit(c: Char): Boolean = LETTER_OR_DIGIT_RE.matches(c.toString())

internal actual fun readEnvvar(key: String): String? = impls.readEnvvar(key)
internal actual fun isWindowsMpp(): Boolean = impls.isWindowsMpp()
internal actual fun exitProcessMpp(status: Int): Unit = impls.exitProcessMpp(status)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ internal actual fun exitProcessMpp(status: Int) {
exitProcess(status)
}

internal actual fun isLetterOrDigit(c: Char): Boolean {
return c.isLetterOrDigit()
}

internal actual fun readFileIfExists(filename: String): String? {
val file = File(filename)
if (!file.isFile) return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@ import platform.posix.fopen
import kotlin.experimental.ExperimentalNativeApi
import kotlin.system.exitProcess

private val LETTER_OR_DIGIT_RE = Regex("""[a-zA-Z0-9]""")

internal actual val String.graphemeLengthMpp: Int get() = replace(ANSI_CODE_RE, "").length

internal actual fun isLetterOrDigit(c: Char): Boolean = LETTER_OR_DIGIT_RE.matches(c.toString())

internal actual fun isWindowsMpp(): Boolean = Platform.osFamily == OsFamily.WINDOWS

internal actual fun exitProcessMpp(status: Int): Unit = exitProcess(status)
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
kotlin = "1.9.10"
kotlin = "1.9.20"

[libraries]
mordant = "com.github.ajalt.mordant:mordant:2.2.0"
Expand All @@ -14,5 +14,5 @@ kodein = "org.kodein.di:kodein-di-generic-jvm:5.2.0"
kotlinx-serialization = "org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1"

[plugins]
dokka = "org.jetbrains.dokka:1.9.0"
dokka = "org.jetbrains.dokka:1.9.10"
publish = "com.vanniktech.maven.publish:0.25.3"