Umstellung auf Kotlin Multiplatform

This commit is contained in:
Hartmut Bauer committed 2026-01-18 17:17:53 +01:00
1 parent 1ee8dd356f
commit 4a73301eb3
35 files changed
+245 -46

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidProjectSystem">
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
</component>
</project>
+8
View File
@@ -0,0 +1,8 @@
<component name="ArtifactManager">
<artifact type="jar" name="util-js-0.2.8">
<output-path>$PROJECT_DIR$/build/libs</output-path>
<root id="archive" name="util-js-0.2.8.jar">
<element id="module-output" name="util.jsMain" />
</root>
</artifact>
</component>
+8
View File
@@ -0,0 +1,8 @@
<component name="ArtifactManager">
<artifact type="jar" name="util-js-0.3.0-beta.1">
<output-path>$PROJECT_DIR$/build/libs</output-path>
<root id="archive" name="util-js-0.3.0-beta.1.jar">
<element id="module-output" name="util.jsMain" />
</root>
</artifact>
</component>
+8
View File
@@ -0,0 +1,8 @@
<component name="ArtifactManager">
<artifact type="jar" name="util-jvm-0.2.8">
<output-path>$PROJECT_DIR$/build/libs</output-path>
<root id="archive" name="util-jvm-0.2.8.jar">
<element id="module-output" name="util.jvmMain" />
</root>
</artifact>
</component>
+8
View File
@@ -0,0 +1,8 @@
<component name="ArtifactManager">
<artifact type="jar" name="util-jvm-0.3.0-beta.1">
<output-path>$PROJECT_DIR$/build/libs</output-path>
<root id="archive" name="util-jvm-0.3.0-beta.1.jar">
<element id="module-output" name="util.jvmMain" />
</root>
</artifact>
</component>
+8
View File
@@ -0,0 +1,8 @@
<component name="ArtifactManager">
<artifact type="jar" name="util-wasm-js-0.2.8">
<output-path>$PROJECT_DIR$/build/libs</output-path>
<root id="archive" name="util-wasm-js-0.2.8.jar">
<element id="module-output" name="util.wasmJsMain" />
</root>
</artifact>
</component>
+8
View File
@@ -0,0 +1,8 @@
<component name="ArtifactManager">
<artifact type="jar" name="util-wasm-js-0.3.0-beta.1">
<output-path>$PROJECT_DIR$/build/libs</output-path>
<root id="archive" name="util-wasm-js-0.3.0-beta.1.jar">
<element id="module-output" name="util.wasmJsMain" />
</root>
</artifact>
</component>
+8
View File
@@ -0,0 +1,8 @@
<component name="ArtifactManager">
<artifact type="jar" name="util-wasm-wasi-0.2.8">
<output-path>$PROJECT_DIR$/build/libs</output-path>
<root id="archive" name="util-wasm-wasi-0.2.8.jar">
<element id="module-output" name="util.wasmWasiMain" />
</root>
</artifact>
</component>
+8
View File
@@ -0,0 +1,8 @@
<component name="ArtifactManager">
<artifact type="jar" name="util-wasm-wasi-0.3.0-beta.1">
<output-path>$PROJECT_DIR$/build/libs</output-path>
<root id="archive" name="util-wasm-wasi-0.3.0-beta.1.jar">
<element id="module-output" name="util.wasmWasiMain" />
</root>
</artifact>
</component>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="25" />
</component>
</project>
+1 -1
View File
@@ -4,5 +4,5 @@
<component name="FrameworkDetectionExcludesConfiguration"> <component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" /> <file type="web" url="file://$PROJECT_DIR$" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK" /> <component name="ProjectRootManager" version="2" languageLevel="JDK_25" project-jdk-name="21" project-jdk-type="JavaSDK" />
</project> </project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/modules/util.jvmMain.iml" filepath="$PROJECT_DIR$/.idea/modules/util.jvmMain.iml" />
</modules>
</component>
</project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="AdditionalModuleElements">
<content url="file://$MODULE_DIR$/../../src/jvmMain" dumb="true">
<sourceFolder url="file://$MODULE_DIR$/../../src/jvmMain/kotlin" isTestSource="false" />
</content>
</component>
</module>
+98 -24
View File
@@ -1,12 +1,15 @@
@file:OptIn(ExperimentalKotlinGradlePluginApi::class) //@file:OptIn(ExperimentalKotlinGradlePluginApi::class)
@file:OptIn(ExperimentalWasmDsl::class)
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins { plugins {
kotlin("jvm") version masterLibs.versions.kotlinVersion // kotlin("jvm") version masterLibs.versions.kotlinVersion
`java-library` // `java-library`
`maven-publish` `maven-publish`
alias(masterLibs.plugins.dokkaPlugin) alias(masterLibs.plugins.dokkaPlugin)
alias(masterLibs.plugins.kotlinMultiplatformPlugin)
alias(masterLibs.plugins.versionPlugin) alias(masterLibs.plugins.versionPlugin)
} }
@@ -20,27 +23,98 @@ repositories {
maven("https://nexus.keinekekse.net/repository/maven-public/") maven("https://nexus.keinekekse.net/repository/maven-public/")
} }
dependencies { //dependencies {
implementation(masterLibs.kotlinxSerialization) // implementation(masterLibs.kotlinxSerialization)
// f. cmd line via annotation KMP? // // f. cmd line via annotation KMP?
implementation(kotlin("reflect")) // implementation(kotlin("reflect"))
//
} //}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(masterLibs.versions.javaVersion.get()))
}
withSourcesJar()
}
kotlin { kotlin {
jvmToolchain(masterLibs.versions.javaVersion.get().toInt()) // explicitApi()
// compilerOptions {
// languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_3) jvm {
compilerOptions.jvmTarget =
JvmTarget.valueOf("JVM_" + masterLibs.versions.javaVersion.get()) //JvmTarget.JVM_1_8
}
js {
browser {
testTask {
useKarma {
useChromeHeadless()
}
}
}
nodejs()
}
wasmJs {
browser {
testTask {
useKarma {
useChromeHeadless()
}
}
}
nodejs()
}
wasmWasi {
nodejs()
}
// macosX64()
macosArm64()
// iosX64()
// iosArm64()
// iosSimulatorArm64()
// watchosArm32()
// watchosArm64()
// watchosX64()
// watchosSimulatorArm64()
// watchosDeviceArm64()
// tvosArm64()
// tvosX64()
// tvosSimulatorArm64()
// mingwX64()
linuxX64()
// linuxArm64()
// androidNativeArm32()
// androidNativeArm64()
// androidNativeX86()
// androidNativeX64()
applyDefaultHierarchyTemplate()
sourceSets {
commonMain.dependencies {
implementation(masterLibs.kotlinxSerialization)
}
jvmMain.dependencies {
implementation(kotlin("reflect"))
}
// commonTest.dependencies {
// implementation(libs.kotlin.test)
// implementation(libs.serialization.json)
// } // }
}
} }
//kotlin {
// jvmToolchain(masterLibs.versions.javaVersion.get().toInt())
//// compilerOptions {
//// languageVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_3)
//// }
//}
/* Generierte Dokka-Doku als javadoc.jar ausgeben (s.a. "publishing") /* Generierte Dokka-Doku als javadoc.jar ausgeben (s.a. "publishing")
tasks.register<Jar>("dokkaJar") { tasks.register<Jar>("dokkaJar") {
group = "build" group = "build"
@@ -62,10 +136,10 @@ publishing {
url = uri("https://nexus.keinekekse.net/repository/maven-releases/") url = uri("https://nexus.keinekekse.net/repository/maven-releases/")
} }
} }
publications.create<MavenPublication>("maven") { // publications.create<MavenPublication>("maven") {
from(components["java"]) // from(components["java"])
// artifact(tasks["dokkaJar"]) //// artifact(tasks["dokkaJar"])
} // }
} }
// ./gradlew dokkaGenerate // ./gradlew dokkaGenerate
+2 -2
View File
@@ -1,3 +1,3 @@
#auto generated #auto generated
#Sun Jan 18 02:02:24 CET 2026 #Sun Jan 18 17:08:09 CET 2026
build.number=106 build.number=109
+1 -1
View File
@@ -19,7 +19,7 @@ dependencyResolutionManagement {
versionCatalogs { versionCatalogs {
create("masterLibs") { create("masterLibs") {
// from(files("gradle/masterlibs.versions.toml")) // from(files("gradle/masterlibs.versions.toml"))
from("net.keinekekse:version-catalog:107") from("net.keinekekse:version-catalog:109")
} }
} }
} }
@@ -1,13 +1,14 @@
package net.keinekekse.args package net.keinekekse.args
import net.keinekekse.version.Version import net.keinekekse.version.Version
import kotlin.system.exitProcess
expect fun exitApplication(rc: Int = 0): Nothing
class VerifyParameterException(message: String) : RuntimeException(message) class VerifyParameterException(message: String) : RuntimeException(message)
fun showParsingError(msg: String): Nothing { fun showParsingError(msg: String): Nothing {
println(ArgumentParserException.PARSING_ERROR_MSG.format(msg)) println(ArgumentParserException.PARSING_ERROR_MSG + msg + "\n")
exitProcess(2) exitApplication(2)
} }
/** /**
@@ -311,10 +312,10 @@ class CommandLine(
} }
e?.message?.let { e?.message?.let {
println() println()
println(ArgumentParserException.PARSING_ERROR_MSG.format(it)) println(ArgumentParserException.PARSING_ERROR_MSG + it + "\n")
println() println()
} }
exitProcess(0) exitApplication(0)
} }
private fun showSubcommands(parameters: MutableMap<String, SubCommandData>) { private fun showSubcommands(parameters: MutableMap<String, SubCommandData>) {
@@ -346,7 +347,7 @@ class CommandLine(
private fun showVersion(): Nothing { private fun showVersion(): Nothing {
println("${programVersion.displayName} ${programVersion.fullVersion}, ${programVersion.copyright}\n") println("${programVersion.displayName} ${programVersion.fullVersion}, ${programVersion.copyright}\n")
exitProcess(0) exitApplication(0)
} }
} }
@@ -1,7 +1,6 @@
package net.keinekekse.args package net.keinekekse.args
import kotlin.reflect.KProperty import kotlin.reflect.KProperty
import kotlin.system.exitProcess
interface ValueDelegate<T> { interface ValueDelegate<T> {
var value: T? var value: T?
@@ -152,8 +151,8 @@ interface AddParameter {
// Fehler beim Check der Parameter-Definitionen und beim Parsen der Kommandozeile // Fehler beim Check der Parameter-Definitionen und beim Parsen der Kommandozeile
internal class ArgumentParserException(message: String?) : RuntimeException(message) { internal class ArgumentParserException(message: String?) : RuntimeException(message) {
companion object { companion object {
const val PARSING_ERROR_MSG = "\n*** ERROR parsing arguments: %s\n" const val PARSING_ERROR_MSG = "\n*** ERROR parsing arguments: "
const val DEFINITION_ERROR_MSG = "\n*** ERROR defining arguments: %s\n" const val DEFINITION_ERROR_MSG = "\n*** ERROR defining arguments: "
fun showHelp() = ArgumentParserException(null) fun showHelp() = ArgumentParserException(null)
fun noHelpOrVersion() = fun noHelpOrVersion() =
ArgumentParserException("Option 'help' and option 'version' are not allowed.") ArgumentParserException("Option 'help' and option 'version' are not allowed.")
@@ -226,6 +225,6 @@ internal fun matchArgument(arg: String): Pair<String, String>? =
ARGUMENT_PATTERN.matchEntire(arg)?.groupValues?.let { Pair(it[1] + it[2], it[3]) } ARGUMENT_PATTERN.matchEntire(arg)?.groupValues?.let { Pair(it[1] + it[2], it[3]) }
internal fun showDefiningError(msg: String): Nothing { internal fun showDefiningError(msg: String): Nothing {
println(ArgumentParserException.DEFINITION_ERROR_MSG.format(msg)) println(ArgumentParserException.DEFINITION_ERROR_MSG + msg + "\n")
exitProcess(1) exitApplication(1)
} }
@@ -3,14 +3,14 @@ package net.keinekekse.util
import net.keinekekse.version.Version import net.keinekekse.version.Version
object VERSION: Version { object VERSION: Version {
override val version = "0.2.8" override val version = "0.3.0-beta.1+build.109"
override val fullVersion = "0.2.8+build.106" override val fullVersion = "0.3.0-beta.1+build.109"
override val major = 0 override val major = 0
override val minor = 2 override val minor = 3
override val patch = 8 override val patch = 0
override val preRelease = "" override val preRelease = "beta.1"
override val buildMetadata = "build.106" override val buildMetadata = "build.109"
override val buildDate = "2026-01-18T01:02:24.139170Z" override val buildDate = "2026-01-18T16:08:09.445707Z"
override val displayName = "Utility Library" override val displayName = "Utility Library"
override val copyright = "Copyright (c) 2025-2026 Hartmut Bauer" override val copyright = "Copyright (c) 2025-2026 Hartmut Bauer"
override val name = "util" override val name = "util"
@@ -0,0 +1,7 @@
package net.keinekekse.args
import kotlin.system.exitProcess
actual fun exitApplication(rc: Int): Nothing {
exitProcess(rc)
}
@@ -0,0 +1,8 @@
package net.keinekekse.args
import platform.posix.exit
actual fun exitApplication(rc: Int): Nothing {
exit(rc)
return Unit as Nothing
}
@@ -0,0 +1,8 @@
package net.keinekekse.args
import platform.posix.exit
actual fun exitApplication(rc: Int): Nothing {
exit(rc)
return Unit as Nothing
}
@@ -0,0 +1,5 @@
package net.keinekekse.args
actual fun exitApplication(rc: Int): Nothing {
TODO("Not implemented on this platform")
}
@@ -0,0 +1,5 @@
package net.keinekekse.args
actual fun exitApplication(rc: Int): Nothing {
TODO("Not yet implemented") // js + wasmJs
}