diff --git a/ansi/build.gradle.kts b/ansi/build.gradle.kts index 0863746..1eb02ac 100644 --- a/ansi/build.gradle.kts +++ b/ansi/build.gradle.kts @@ -17,8 +17,12 @@ * along with this program. If not, see . */ -// Dependencies -dependencies { - // sos!engine - implementation(project(":base")) +kotlin { + // Dependencies + sourceSets { + commonMain.dependencies { + // sos!engine + implementation(project(":base")) + } + } } diff --git a/ansi/src/main/kotlin/de/staropensource/engine/ansi/AnsiFormatter.kt b/ansi/src/commonMain/kotlin/de/staropensource/engine/ansi/AnsiFormatter.kt similarity index 99% rename from ansi/src/main/kotlin/de/staropensource/engine/ansi/AnsiFormatter.kt rename to ansi/src/commonMain/kotlin/de/staropensource/engine/ansi/AnsiFormatter.kt index 1c94b55..87612c9 100644 --- a/ansi/src/main/kotlin/de/staropensource/engine/ansi/AnsiFormatter.kt +++ b/ansi/src/commonMain/kotlin/de/staropensource/engine/ansi/AnsiFormatter.kt @@ -21,6 +21,7 @@ package de.staropensource.engine.ansi import de.staropensource.engine.ansi.AnsiSubsystem.Companion.logger import de.staropensource.engine.base.implementable.formatter.TwoCycleFormatterImpl +import kotlin.jvm.JvmStatic /** * Formats a string using ANSI diff --git a/ansi/src/main/kotlin/de/staropensource/engine/ansi/AnsiSubsystem.kt b/ansi/src/commonMain/kotlin/de/staropensource/engine/ansi/AnsiSubsystem.kt similarity index 99% rename from ansi/src/main/kotlin/de/staropensource/engine/ansi/AnsiSubsystem.kt rename to ansi/src/commonMain/kotlin/de/staropensource/engine/ansi/AnsiSubsystem.kt index 59a1aed..c7caacb 100644 --- a/ansi/src/main/kotlin/de/staropensource/engine/ansi/AnsiSubsystem.kt +++ b/ansi/src/commonMain/kotlin/de/staropensource/engine/ansi/AnsiSubsystem.kt @@ -24,6 +24,7 @@ import de.staropensource.engine.base.implementable.Subsystem import de.staropensource.engine.base.logging.Logger import de.staropensource.engine.base.type.logging.ChannelSettings import de.staropensource.engine.base.utility.dnihbd.BuildInformation +import kotlin.jvm.JvmStatic /** * The ANSI subsystem. diff --git a/ansi/src/main/resources/.gitignore b/ansi/src/commonMain/resources/.gitignore similarity index 100% rename from ansi/src/main/resources/.gitignore rename to ansi/src/commonMain/resources/.gitignore diff --git a/base/build.gradle.kts b/base/build.gradle.kts index 0400252..bd4bba9 100644 --- a/base/build.gradle.kts +++ b/base/build.gradle.kts @@ -17,8 +17,12 @@ * along with this program. If not, see . */ -// Dependencies -dependencies { - // OSHI - implementation("${property("dependencyOshiIdentifier") as String}:${property("dependencyOshiVersion") as String}") +kotlin { + // Dependencies + sourceSets { + jvmMain.dependencies { + // OSHI + implementation("${property("dependencyOshiIdentifier") as String}:${property("dependencyOshiVersion") as String}") + } + } } diff --git a/base/src/main/kotlin/de/staropensource/engine/base/Engine.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/Engine.kt similarity index 97% rename from base/src/main/kotlin/de/staropensource/engine/base/Engine.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/Engine.kt index ffd861b..7f5560e 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/Engine.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/Engine.kt @@ -27,6 +27,7 @@ import de.staropensource.engine.base.utility.FileAccess import de.staropensource.engine.base.utility.dnihbd.BuildInformation import java.nio.charset.Charset import java.nio.charset.StandardCharsets +import kotlin.jvm.JvmStatic import kotlin.reflect.KClass /** @@ -50,6 +51,7 @@ class Engine private constructor() { * * @since v1-alpha10 */ + @JvmStatic internal val logger: Logger = Logger(channel = "engine-core") /** @@ -57,6 +59,7 @@ class Engine private constructor() { * * @since v1-alpha10 */ + @JvmStatic var state: State = State.UNINITIALIZED internal set @@ -73,6 +76,7 @@ class Engine private constructor() { * @see bootstrap * @since v1-alpha10 */ + @JvmStatic var bootstrapping: Boolean? = null /** @@ -81,6 +85,7 @@ class Engine private constructor() { * @see Subsystem * @since v1-alpha10 */ + @JvmStatic private val subsystems: MutableSet = mutableSetOf() /** @@ -91,6 +96,7 @@ class Engine private constructor() { * @see BuildInformation * @since v1-alpha10 */ + @JvmStatic var info: BuildInformation? = null @@ -102,6 +108,7 @@ class Engine private constructor() { * @return array of registered [Subsystem]s * @since v1-alpha10 */ + @JvmStatic fun getSubsystems(): Array = subsystems.toTypedArray() /** @@ -110,11 +117,14 @@ class Engine private constructor() { * * @since v1-alpha10 */ - fun getSubsystem(subsystemClass: KClass): Subsystem? = getSubsystems().find { subsystem -> try { - subsystem::class.qualifiedName!! == subsystemClass.qualifiedName!! - } catch (_: NullPointerException) { - false - } } + @JvmStatic + fun getSubsystem(subsystemClass: KClass): Subsystem? { + return getSubsystems().find { subsystem -> try { + subsystem::class.qualifiedName!! == subsystemClass.qualifiedName!! + } catch (_: NullPointerException) { + false + } } + } /** * Registers the specified subsystem. @@ -128,6 +138,7 @@ class Engine private constructor() { * @see Subsystem * @since v1-alpha10 */ + @JvmStatic fun registerSubsystem(subsystem: Subsystem) { // Check for state if (bootstrapping == true) diff --git a/base/src/main/kotlin/de/staropensource/engine/base/EngineConfiguration.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/EngineConfiguration.kt similarity index 99% rename from base/src/main/kotlin/de/staropensource/engine/base/EngineConfiguration.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/EngineConfiguration.kt index c5f1d7b..a691bf5 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/EngineConfiguration.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/EngineConfiguration.kt @@ -35,6 +35,7 @@ import de.staropensource.engine.base.type.logging.Feature import de.staropensource.engine.base.type.logging.Level import de.staropensource.engine.base.type.logging.OperationMode import kotlinx.datetime.TimeZone +import kotlin.jvm.JvmStatic import kotlin.reflect.KClass /** diff --git a/base/src/main/kotlin/de/staropensource/engine/base/annotation/NonKotlinContact.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/annotation/NonKotlinContact.kt similarity index 91% rename from base/src/main/kotlin/de/staropensource/engine/base/annotation/NonKotlinContact.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/annotation/NonKotlinContact.kt index 914abcd..64b8b18 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/annotation/NonKotlinContact.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/annotation/NonKotlinContact.kt @@ -25,10 +25,9 @@ package de.staropensource.engine.base.annotation * the public API. * * Using anything non-Kotlin in conjunction with - * the StarOpenSource Engine is highly discouraged, - * as the engine may be multiplatform in future - * releases and will not support using other - * languages. + * the StarOpenSource Engine is highly + * discouraged, as the engine is optimized for + * multiplatform usage. * * Using anything in contact with non-Kotlin code * is therefore deemed unsafe and should be diff --git a/base/src/main/kotlin/de/staropensource/engine/base/annotation/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/annotation/package-info.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/annotation/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/annotation/package-info.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/exception/EngineInitializationFailureException.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/exception/EngineInitializationFailureException.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/exception/EngineInitializationFailureException.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/exception/EngineInitializationFailureException.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/exception/VerificationFailedException.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/exception/VerificationFailedException.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/exception/VerificationFailedException.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/exception/VerificationFailedException.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/exception/io/FileOrDirectoryNotFoundException.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/exception/io/FileOrDirectoryNotFoundException.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/exception/io/FileOrDirectoryNotFoundException.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/exception/io/FileOrDirectoryNotFoundException.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/exception/io/FileTooLargeException.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/exception/io/FileTooLargeException.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/exception/io/FileTooLargeException.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/exception/io/FileTooLargeException.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/exception/io/IOAccessException.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/exception/io/IOAccessException.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/exception/io/IOAccessException.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/exception/io/IOAccessException.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/exception/io/StreamClosedException.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/exception/io/StreamClosedException.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/exception/io/StreamClosedException.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/exception/io/StreamClosedException.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/exception/io/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/exception/io/package-info.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/exception/io/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/exception/io/package-info.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/exception/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/exception/package-info.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/exception/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/exception/package-info.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/ShutdownHandler.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/ShutdownHandler.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/ShutdownHandler.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/ShutdownHandler.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/Subsystem.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/Subsystem.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/Subsystem.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/Subsystem.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/formatter/Formatter.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/formatter/Formatter.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/formatter/Formatter.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/formatter/Formatter.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/formatter/OneCycleFormatter.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/formatter/OneCycleFormatter.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/formatter/OneCycleFormatter.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/formatter/OneCycleFormatter.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/formatter/TwoCycleFormatter.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/formatter/TwoCycleFormatter.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/formatter/TwoCycleFormatter.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/formatter/TwoCycleFormatter.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/formatter/TwoCycleFormatterImpl.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/formatter/TwoCycleFormatterImpl.kt similarity index 98% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/formatter/TwoCycleFormatterImpl.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/formatter/TwoCycleFormatterImpl.kt index 53af026..5021ff1 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementable/formatter/TwoCycleFormatterImpl.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/formatter/TwoCycleFormatterImpl.kt @@ -44,7 +44,7 @@ import kotlin.text.iterator * @since v1-alpha10 */ abstract class TwoCycleFormatterImpl: TwoCycleFormatter() { - @Suppress("NestedBlockDepth") + @Suppress("NestedBlockDepth", "CyclomaticComplexMethod") override fun parse(message: String): Array { val components: MutableList = mutableListOf() var currentComponent: StringBuilder = StringBuilder() diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/formatter/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/formatter/package-info.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/formatter/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/formatter/package-info.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/Adapter.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/logging/Adapter.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/Adapter.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/logging/Adapter.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/CrashCategory.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/logging/CrashCategory.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/CrashCategory.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/logging/CrashCategory.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/Filter.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/logging/Filter.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/Filter.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/logging/Filter.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/FormatBuilder.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/logging/FormatBuilder.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/FormatBuilder.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/logging/FormatBuilder.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/LoggerThreadingHandler.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/logging/LoggerThreadingHandler.kt similarity index 97% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/LoggerThreadingHandler.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/logging/LoggerThreadingHandler.kt index 7470ba5..50ca51e 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/LoggerThreadingHandler.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/logging/LoggerThreadingHandler.kt @@ -19,7 +19,6 @@ package de.staropensource.engine.base.implementable.logging -import de.staropensource.engine.base.logging.Processor import de.staropensource.engine.base.type.logging.Call /** diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/logging/package-info.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/logging/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/logging/package-info.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/package-info.kt similarity index 94% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/package-info.kt index a0c08dc..e12d754 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementable/package-info.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/package-info.kt @@ -22,4 +22,4 @@ * * @since v1-alpha10 */ -package de.staropensource.engine.base.implementable; +package de.staropensource.engine.base.implementable diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/ReadStream.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/stream/ReadStream.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/ReadStream.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/stream/ReadStream.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/Stream.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/stream/Stream.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/Stream.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/stream/Stream.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/WriteStream.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/stream/WriteStream.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/WriteStream.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/stream/WriteStream.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/stream/package-info.kt similarity index 98% rename from base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/stream/package-info.kt index 47851c2..cfc56d2 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementable/stream/package-info.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementable/stream/package-info.kt @@ -18,7 +18,7 @@ */ /** - * [Streams]. + * [Stream]s. * * @since v1-alpha10 */ diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/KotlinShutdownHandler.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/KotlinShutdownHandler.kt similarity index 98% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/KotlinShutdownHandler.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/KotlinShutdownHandler.kt index c898ef2..e8b8bf6 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/KotlinShutdownHandler.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/KotlinShutdownHandler.kt @@ -20,6 +20,7 @@ package de.staropensource.engine.base.implementation.logging import de.staropensource.engine.base.implementable.ShutdownHandler +import kotlin.jvm.JvmStatic import kotlin.system.exitProcess /** diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/NoOperationFormatter.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/NoOperationFormatter.kt similarity index 99% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/NoOperationFormatter.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/NoOperationFormatter.kt index 852c201..2913d35 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/NoOperationFormatter.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/NoOperationFormatter.kt @@ -21,6 +21,7 @@ package de.staropensource.engine.base.implementation.logging import de.staropensource.engine.base.implementable.formatter.Formatter import de.staropensource.engine.base.implementable.formatter.OneCycleFormatter +import kotlin.jvm.JvmStatic import kotlin.text.iterator /** diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/adapter/FileWriteAdapter.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/adapter/FileWriteAdapter.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/adapter/FileWriteAdapter.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/adapter/FileWriteAdapter.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/adapter/PrintlnAdapter.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/adapter/PrintlnAdapter.kt similarity index 98% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/adapter/PrintlnAdapter.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/adapter/PrintlnAdapter.kt index c515714..0b7123b 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/adapter/PrintlnAdapter.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/adapter/PrintlnAdapter.kt @@ -21,6 +21,7 @@ package de.staropensource.engine.base.implementation.logging.adapter import de.staropensource.engine.base.implementable.logging.Adapter import de.staropensource.engine.base.type.logging.Call +import kotlin.jvm.JvmStatic /** * [Adapter] for printing messages diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/adapter/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/adapter/package-info.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/adapter/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/adapter/package-info.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/EngineCrashCategory.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/EngineCrashCategory.kt similarity index 98% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/EngineCrashCategory.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/EngineCrashCategory.kt index fa3af05..0954644 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/EngineCrashCategory.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/EngineCrashCategory.kt @@ -21,6 +21,7 @@ package de.staropensource.engine.base.implementation.logging.crashcategory import de.staropensource.engine.base.implementable.logging.CrashCategory import de.staropensource.engine.base.utility.dnihbd.BuildInformation +import kotlin.jvm.JvmStatic /** * [CrashCategory] implementation diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/EnvironmentCrashCategory.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/EnvironmentCrashCategory.kt similarity index 97% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/EnvironmentCrashCategory.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/EnvironmentCrashCategory.kt index abb3803..b4006cf 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/EnvironmentCrashCategory.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/EnvironmentCrashCategory.kt @@ -23,9 +23,7 @@ import de.staropensource.engine.base.implementable.logging.CrashCategory import de.staropensource.engine.base.type.logging.Call import de.staropensource.engine.base.type.logging.ChannelSettings import de.staropensource.engine.base.utility.Environment -import kotlinx.datetime.LocalDateTime -import kotlinx.datetime.TimeZone -import kotlinx.datetime.toLocalDateTime +import kotlin.jvm.JvmStatic /** * [CrashCategory] implementation diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/InfoCrashCategory.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/InfoCrashCategory.kt similarity index 98% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/InfoCrashCategory.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/InfoCrashCategory.kt index a8de561..8ee3e86 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/InfoCrashCategory.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/InfoCrashCategory.kt @@ -23,6 +23,7 @@ import de.staropensource.engine.base.implementable.logging.CrashCategory import de.staropensource.engine.base.type.logging.Call import de.staropensource.engine.base.type.logging.ChannelSettings import de.staropensource.engine.base.utility.misc.StackTraceUtils +import kotlin.jvm.JvmStatic /** * [CrashCategory] implementation diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/package-info.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/crashcategory/package-info.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/formatbuilder/SOSLSv2FormatBuilder.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/formatbuilder/SOSLSv2FormatBuilder.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/formatbuilder/SOSLSv2FormatBuilder.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/formatbuilder/SOSLSv2FormatBuilder.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/formatbuilder/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/formatbuilder/package-info.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/formatbuilder/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/formatbuilder/package-info.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/package-info.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/logging/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/logging/package-info.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/package-info.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/package-info.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteReadStream.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/ByteReadStream.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteReadStream.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/ByteReadStream.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteStream.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/ByteStream.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteStream.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/ByteStream.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteWriteStream.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/ByteWriteStream.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/ByteWriteStream.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/ByteWriteStream.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/FileAccessStream.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/FileAccessStream.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/FileAccessStream.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/FileAccessStream.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/LoggerStream.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/LoggerStream.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/LoggerStream.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/LoggerStream.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/NullStream.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/NullStream.kt similarity index 98% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/NullStream.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/NullStream.kt index d64fa3a..0eb3cf5 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/NullStream.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/NullStream.kt @@ -20,6 +20,7 @@ package de.staropensource.engine.base.implementation.stream import de.staropensource.engine.base.implementable.stream.Stream +import kotlin.jvm.JvmStatic /** * A [Stream] which does nothing diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringReadStream.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/StringReadStream.kt similarity index 96% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringReadStream.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/StringReadStream.kt index 98840bb..96c07aa 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringReadStream.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/StringReadStream.kt @@ -29,4 +29,4 @@ import de.staropensource.engine.base.implementable.stream.Stream * @param stringRead string to provide for reading * @since v1-alpha10 */ -open class StringReadStream(val stringRead: String) : ByteReadStream(bytesRead = stringRead.toByteArray()) +open class StringReadStream(val stringRead: String) : ByteReadStream(bytesRead = stringRead.encodeToByteArray()) diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringStream.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/StringStream.kt similarity index 96% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringStream.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/StringStream.kt index 146f094..b9aa463 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringStream.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/StringStream.kt @@ -29,7 +29,7 @@ import de.staropensource.engine.base.implementable.stream.Stream * @param stringRead string to provide for reading * @since v1-alpha10 */ -open class StringStream(val stringRead: String) : ByteStream(bytesRead = stringRead.toByteArray()) { +open class StringStream(val stringRead: String) : ByteStream(bytesRead = stringRead.encodeToByteArray()) { /** * Returns the written string. * diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringWriteStream.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/StringWriteStream.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/StringWriteStream.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/StringWriteStream.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/package-info.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/implementation/stream/package-info.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/logging/CrashHandler.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/logging/CrashHandler.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/logging/CrashHandler.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/logging/CrashHandler.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/logging/Filterer.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/logging/Filterer.kt similarity index 98% rename from base/src/main/kotlin/de/staropensource/engine/base/logging/Filterer.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/logging/Filterer.kt index 710d904..4ad837b 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/logging/Filterer.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/logging/Filterer.kt @@ -21,6 +21,7 @@ package de.staropensource.engine.base.logging import de.staropensource.engine.base.implementable.logging.Filter import de.staropensource.engine.base.type.logging.Call +import kotlin.jvm.JvmStatic /** * Handles call filtering. diff --git a/base/src/main/kotlin/de/staropensource/engine/base/logging/Logger.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/logging/Logger.kt similarity index 95% rename from base/src/main/kotlin/de/staropensource/engine/base/logging/Logger.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/logging/Logger.kt index 29e5369..9ddab8b 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/logging/Logger.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/logging/Logger.kt @@ -30,6 +30,8 @@ import de.staropensource.engine.base.type.logging.Level import de.staropensource.engine.base.utility.misc.StackTraceUtils import kotlinx.datetime.Clock import kotlinx.datetime.Instant +import kotlin.jvm.JvmName +import kotlin.jvm.JvmStatic /** * Frontend for sos!engine's logging system. @@ -119,7 +121,7 @@ class Logger { * @param callerDepth determines the depth at which to discover the method caller * @since v1-alpha10 */ - fun log(level: Level, message: String, levelData: Map = emptyMap(), callerDepth: UInt = 0u) { + fun log(level: Level, message: String, levelData: Map = emptyMap(), callerDepth: UInt = 0u) { // Create 'Call' instance var call: Call = Call( StackTraceUtils.methodCaller(depth = callerDepth.plus(1u)), @@ -130,7 +132,7 @@ class Logger { // Run processing if (level == Level.CRASH) - CrashHandler.handle(call, levelData["throwable"] as Throwable?, levelData.getOrDefault("fatal", true) as Boolean) + CrashHandler.handle(call, levelData["throwable"] as Throwable?, levelData.getOrElse("fatal") { true } as Boolean) else { if (Processor.check(call)) return @@ -210,8 +212,8 @@ class Logger { */ fun crash(error: String, throwable: Throwable? = null, fatal: Boolean = true) { log(Level.CRASH, error, levelData = mapOf( - Pair("throwable", throwable as Object?), - Pair("fatal", fatal as Object?) + Pair("throwable", throwable as Any?), + Pair("fatal", fatal as Any?) ), callerDepth = 1u) } @@ -242,5 +244,5 @@ class Logger { * @return [FileAccessStream] instance * @since v1-alpha10 */ - fun toStream(level: Level): LoggerStream = stream.computeIfAbsent(level) { level -> LoggerStream(this, level) } + fun toStream(level: Level): LoggerStream = stream[level] ?: LoggerStream(this, level) } diff --git a/base/src/main/kotlin/de/staropensource/engine/base/logging/Processor.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/logging/Processor.kt similarity index 98% rename from base/src/main/kotlin/de/staropensource/engine/base/logging/Processor.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/logging/Processor.kt index 75045c8..4df346f 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/logging/Processor.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/logging/Processor.kt @@ -29,6 +29,7 @@ import de.staropensource.engine.base.type.logging.ChannelSettings import de.staropensource.engine.base.type.logging.Feature import de.staropensource.engine.base.type.logging.OperationMode import de.staropensource.engine.base.utility.misc.StackTraceUtils +import kotlin.jvm.JvmStatic import kotlin.reflect.full.primaryConstructor /** @@ -87,7 +88,7 @@ class Processor private constructor() { * @param call [Call] metadata * @see EngineConfiguration.logThreadingHandler * @see ChannelSettings.formatter - * @see ChannelSettings.adapter + * @see ChannelSettings.adapters * @since v1-alpha10 */ @JvmStatic diff --git a/base/src/main/kotlin/de/staropensource/engine/base/logging/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/logging/package-info.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/logging/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/logging/package-info.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/package-info.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/package-info.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/type/Origin.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/type/Origin.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/type/Origin.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/type/Origin.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/type/Tristate.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/type/Tristate.kt similarity index 99% rename from base/src/main/kotlin/de/staropensource/engine/base/type/Tristate.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/type/Tristate.kt index e04d67d..4dac3cb 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/type/Tristate.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/type/Tristate.kt @@ -20,6 +20,7 @@ package de.staropensource.engine.base.type import de.staropensource.engine.base.EngineConfiguration +import kotlin.jvm.JvmStatic /** * Defines a data type which can have diff --git a/base/src/main/kotlin/de/staropensource/engine/base/type/logging/Call.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/type/logging/Call.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/type/logging/Call.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/type/logging/Call.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/type/logging/ChannelSettings.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/type/logging/ChannelSettings.kt similarity index 99% rename from base/src/main/kotlin/de/staropensource/engine/base/type/logging/ChannelSettings.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/type/logging/ChannelSettings.kt index e0519f7..f62dfb5 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/type/logging/ChannelSettings.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/type/logging/ChannelSettings.kt @@ -24,6 +24,7 @@ import de.staropensource.engine.base.implementable.logging.Adapter import de.staropensource.engine.base.implementable.formatter.Formatter import de.staropensource.engine.base.implementation.logging.NoOperationFormatter import de.staropensource.engine.base.implementation.logging.adapter.PrintlnAdapter +import kotlin.jvm.JvmStatic /** * Holds the configuration of one diff --git a/base/src/main/kotlin/de/staropensource/engine/base/type/logging/Feature.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/type/logging/Feature.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/type/logging/Feature.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/type/logging/Feature.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/type/logging/Level.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/type/logging/Level.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/type/logging/Level.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/type/logging/Level.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/type/logging/OperationMode.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/type/logging/OperationMode.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/type/logging/OperationMode.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/type/logging/OperationMode.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/type/logging/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/type/logging/package-info.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/type/logging/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/type/logging/package-info.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/type/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/type/package-info.kt similarity index 95% rename from base/src/main/kotlin/de/staropensource/engine/base/type/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/type/package-info.kt index c532b5a..fa63afe 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/type/package-info.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/type/package-info.kt @@ -22,4 +22,4 @@ * * @since v1-alpha10 */ -package de.staropensource.engine.base.type; +package de.staropensource.engine.base.type diff --git a/base/src/main/kotlin/de/staropensource/engine/base/type/versioning/VersionType.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/type/versioning/VersionType.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/type/versioning/VersionType.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/type/versioning/VersionType.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/type/versioning/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/type/versioning/package-info.kt similarity index 94% rename from base/src/main/kotlin/de/staropensource/engine/base/type/versioning/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/type/versioning/package-info.kt index 5e36d81..a515c67 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/type/versioning/package-info.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/type/versioning/package-info.kt @@ -23,4 +23,4 @@ * * @since v1-alpha10 */ -package de.staropensource.engine.base.type.versioning; +package de.staropensource.engine.base.type.versioning diff --git a/base/src/main/kotlin/de/staropensource/engine/base/utility/DataSize.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/utility/DataSize.kt similarity index 99% rename from base/src/main/kotlin/de/staropensource/engine/base/utility/DataSize.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/utility/DataSize.kt index 1dd92e9..c24dd52 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/utility/DataSize.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/utility/DataSize.kt @@ -23,6 +23,7 @@ import java.math.RoundingMode import java.text.DecimalFormat import java.text.DecimalFormatSymbols import java.util.Locale +import kotlin.jvm.JvmStatic /** * Converts between various data size units. diff --git a/base/src/main/kotlin/de/staropensource/engine/base/utility/Environment.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/utility/Environment.kt similarity index 99% rename from base/src/main/kotlin/de/staropensource/engine/base/utility/Environment.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/utility/Environment.kt index d7c3770..c848387 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/utility/Environment.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/utility/Environment.kt @@ -26,6 +26,7 @@ import kotlinx.datetime.Instant import oshi.PlatformEnum import oshi.SystemInfo import oshi.hardware.HardwareAbstractionLayer +import kotlin.jvm.JvmStatic /** * Provides information about the diff --git a/base/src/main/kotlin/de/staropensource/engine/base/utility/FileAccess.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/utility/FileAccess.kt similarity index 99% rename from base/src/main/kotlin/de/staropensource/engine/base/utility/FileAccess.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/utility/FileAccess.kt index 5126518..735e474 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/utility/FileAccess.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/utility/FileAccess.kt @@ -36,6 +36,7 @@ import java.io.IOException import java.nio.file.* import java.nio.file.attribute.BasicFileAttributes import java.nio.file.attribute.PosixFilePermissions +import kotlin.jvm.JvmStatic /** * Provides a simplified way of diff --git a/base/src/main/kotlin/de/staropensource/engine/base/utility/Process.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/utility/Process.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/utility/Process.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/utility/Process.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/utility/dnihbd/BuildInformation.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/utility/dnihbd/BuildInformation.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/utility/dnihbd/BuildInformation.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/utility/dnihbd/BuildInformation.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/utility/dnihbd/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/utility/dnihbd/package-info.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/utility/dnihbd/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/utility/dnihbd/package-info.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/utility/misc/Miscellaneous.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/utility/misc/Miscellaneous.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/utility/misc/Miscellaneous.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/utility/misc/Miscellaneous.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/utility/misc/StackTraceUtils.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/utility/misc/StackTraceUtils.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/utility/misc/StackTraceUtils.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/utility/misc/StackTraceUtils.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/utility/misc/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/utility/misc/package-info.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/utility/misc/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/utility/misc/package-info.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/utility/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/base/utility/package-info.kt similarity index 94% rename from base/src/main/kotlin/de/staropensource/engine/base/utility/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/base/utility/package-info.kt index b0b303b..358ec07 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/utility/package-info.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/base/utility/package-info.kt @@ -22,4 +22,4 @@ * * @since v1-alpha10 */ -package de.staropensource.engine.base.utility; +package de.staropensource.engine.base.utility diff --git a/base/src/main/kotlin/de/staropensource/engine/package-info.kt b/base/src/commonMain/kotlin/de/staropensource/engine/package-info.kt similarity index 96% rename from base/src/main/kotlin/de/staropensource/engine/package-info.kt rename to base/src/commonMain/kotlin/de/staropensource/engine/package-info.kt index ae9e4c4..33fd576 100644 --- a/base/src/main/kotlin/de/staropensource/engine/package-info.kt +++ b/base/src/commonMain/kotlin/de/staropensource/engine/package-info.kt @@ -25,4 +25,4 @@ * * @since v1-alpha10 */ -package de.staropensource.engine; +package de.staropensource.engine diff --git a/base/src/main/resources/.gitignore b/base/src/commonMain/resources/.gitignore similarity index 100% rename from base/src/main/resources/.gitignore rename to base/src/commonMain/resources/.gitignore diff --git a/base/src/test/kotlin/de/staropensource/engine/base/EngineTest.kt b/base/src/commonTest/kotlin/de/staropensource/engine/base/EngineTest.kt similarity index 100% rename from base/src/test/kotlin/de/staropensource/engine/base/EngineTest.kt rename to base/src/commonTest/kotlin/de/staropensource/engine/base/EngineTest.kt diff --git a/base/src/test/kotlin/de/staropensource/engine/base/TestBase.kt b/base/src/commonTest/kotlin/de/staropensource/engine/base/TestBase.kt similarity index 100% rename from base/src/test/kotlin/de/staropensource/engine/base/TestBase.kt rename to base/src/commonTest/kotlin/de/staropensource/engine/base/TestBase.kt diff --git a/base/src/test/kotlin/de/staropensource/engine/base/utility/DataSizeTest.kt b/base/src/commonTest/kotlin/de/staropensource/engine/base/utility/DataSizeTest.kt similarity index 100% rename from base/src/test/kotlin/de/staropensource/engine/base/utility/DataSizeTest.kt rename to base/src/commonTest/kotlin/de/staropensource/engine/base/utility/DataSizeTest.kt diff --git a/base/src/test/kotlin/de/staropensource/engine/base/utility/FileAccessTest.kt b/base/src/commonTest/kotlin/de/staropensource/engine/base/utility/FileAccessTest.kt similarity index 100% rename from base/src/test/kotlin/de/staropensource/engine/base/utility/FileAccessTest.kt rename to base/src/commonTest/kotlin/de/staropensource/engine/base/utility/FileAccessTest.kt diff --git a/base/src/test/kotlin/de/staropensource/engine/base/utility/misc/StackTraceUtilsTest.kt b/base/src/commonTest/kotlin/de/staropensource/engine/base/utility/misc/StackTraceUtilsTest.kt similarity index 100% rename from base/src/test/kotlin/de/staropensource/engine/base/utility/misc/StackTraceUtilsTest.kt rename to base/src/commonTest/kotlin/de/staropensource/engine/base/utility/misc/StackTraceUtilsTest.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/JavaReadStream.kt b/base/src/jvmMain/kotlin/de/staropensource/engine/base/implementation/stream/JavaReadStream.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/JavaReadStream.kt rename to base/src/jvmMain/kotlin/de/staropensource/engine/base/implementation/stream/JavaReadStream.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/JavaStream.kt b/base/src/jvmMain/kotlin/de/staropensource/engine/base/implementation/stream/JavaStream.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/JavaStream.kt rename to base/src/jvmMain/kotlin/de/staropensource/engine/base/implementation/stream/JavaStream.kt diff --git a/base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/JavaWriteStream.kt b/base/src/jvmMain/kotlin/de/staropensource/engine/base/implementation/stream/JavaWriteStream.kt similarity index 100% rename from base/src/main/kotlin/de/staropensource/engine/base/implementation/stream/JavaWriteStream.kt rename to base/src/jvmMain/kotlin/de/staropensource/engine/base/implementation/stream/JavaWriteStream.kt diff --git a/build.gradle.kts b/build.gradle.kts index 331df3e..cb199af 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -48,7 +48,7 @@ plugins { id("maven-publish") // Kotlin support - id("org.jetbrains.kotlin.jvm") version("2.0.0") + id("org.jetbrains.kotlin.multiplatform") version("2.0.0") // Dokka id("org.jetbrains.dokka") version("1.9.20") @@ -67,7 +67,7 @@ allprojects { // Plugins apply(plugin = "java-library") apply(plugin = "maven-publish") - apply(plugin = "org.jetbrains.kotlin.jvm") + apply(plugin = "org.jetbrains.kotlin.multiplatform") apply(plugin = "org.jetbrains.dokka") apply(plugin = "com.gorylenko.gradle-git-properties") apply(plugin = "ca.solo-studios.nyx") @@ -125,12 +125,7 @@ allprojects { withDistributeLicense() encoding = "UTF-8" withZip64() - withBuildDependsOnJar() withSuppressWarnings() - jvmToolchain = (property("languageJava") as String).toInt() - jvmTarget = (property("languageJava") as String).toInt() - withSourcesJar() - withJavadocJar() withReproducibleBuilds() // Kotlin-specific settings @@ -141,6 +136,14 @@ allprojects { "-progressive" ) } + + // JVM-specific settings + java { + jvmToolchain = (property("languageJava") as String).toInt() + jvmTarget = (property("languageJava") as String).toInt() + //withSourcesJar() + withJavadocJar() + } } } @@ -150,22 +153,31 @@ allprojects { mavenCentral() } - // Dependencies - dependencies { - // Kotlin support - implementation("${property("dependencyKotlin_ReflectIdentifier") as String}:${property("dependencyKotlinVersion") as String}") - implementation("${property("dependencyKotlin_CoroutinesIdentifier") as String}:${property("dependencyKotlin_CoroutinesVersion") as String}") - implementation("${property("dependencyKotlin_DateTimeIdentifier") as String}:${property("dependencyKotlin_DateTimeVersion") as String}") + // Kotlin + kotlin { + // Targets + // -> JVM + jvm() + // -> Native + linuxX64() + linuxArm64() + mingwX64() - // Unit testing - // -> Kotlin - testImplementation(kotlin("test")) - // -> JUnit - testImplementation(platform("${property("testDependencyJUnit_BOMIdentifier")}:${property("testDependencyJUnitVersion")}")) - testImplementation("${property("testDependencyJUnit_JupiterIdentifier")}") - testRuntimeOnly("${property("testDependencyJUnit_PlatformIdentifier")}") - // -> sos!engine - testImplementation(project(":testing")) + // Dependencies + sourceSets { + commonMain.dependencies { + // Kotlin support + implementation("${property("dependencyKotlin_ReflectIdentifier") as String}:${property("dependencyKotlinVersion") as String}") + implementation("${property("dependencyKotlin_CoroutinesIdentifier") as String}:${property("dependencyKotlin_CoroutinesVersion") as String}") + implementation("${property("dependencyKotlin_DateTimeIdentifier") as String}:${property("dependencyKotlin_DateTimeVersion") as String}") + } + commonTest.dependencies { + // -> Kotlin + implementation(kotlin("test")) + // -> sos!engine + implementation(project(":testing")) + } + } } // Unit testing diff --git a/dist/detekt.yml b/dist/detekt.yml index 584c1fc..cfcee3b 100644 --- a/dist/detekt.yml +++ b/dist/detekt.yml @@ -28,6 +28,8 @@ complexity: naming: MemberNameEqualsClassName: active: false + MatchingDeclarationName: + active: false exceptions: SwallowedException: diff --git a/settings.gradle.kts b/settings.gradle.kts index 87fb51d..a69aae7 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1,3 @@ -import java.net.URI - /* * STAROPENSOURCE ENGINE SOURCE FILE * Copyright (c) 2024 The StarOpenSource Engine Authors diff --git a/testapp/build.gradle.kts b/testapp/build.gradle.kts index 90be08c..d5a8667 100644 --- a/testapp/build.gradle.kts +++ b/testapp/build.gradle.kts @@ -24,11 +24,15 @@ plugins { id("com.gradleup.shadow") version ("8.3.5") } -// Dependencies -dependencies { - // sos!engine - implementation(project(":base")) - implementation(project(":ansi")) +kotlin { + // Dependencies + sourceSets { + commonMain.dependencies { + // sos!engine + implementation(project(":base")) + implementation(project(":ansi")) + } + } } // Configure JAR diff --git a/testapp/src/main/kotlin/de/staropensource/engine/testapp/Main.kt b/testapp/src/commonMain/kotlin/de/staropensource/engine/testapp/Main.kt similarity index 98% rename from testapp/src/main/kotlin/de/staropensource/engine/testapp/Main.kt rename to testapp/src/commonMain/kotlin/de/staropensource/engine/testapp/Main.kt index 61183e6..4ecb69f 100644 --- a/testapp/src/main/kotlin/de/staropensource/engine/testapp/Main.kt +++ b/testapp/src/commonMain/kotlin/de/staropensource/engine/testapp/Main.kt @@ -24,6 +24,7 @@ import de.staropensource.engine.base.Engine import de.staropensource.engine.base.EngineConfiguration import de.staropensource.engine.base.logging.Logger import de.staropensource.engine.base.type.logging.Level +import kotlin.jvm.JvmStatic /** * Testing program for the StarOpenSource Engine. diff --git a/testapp/src/main/kotlin/de/staropensource/engine/testapp/package-info.kt b/testapp/src/commonMain/kotlin/de/staropensource/engine/testapp/package-info.kt similarity index 100% rename from testapp/src/main/kotlin/de/staropensource/engine/testapp/package-info.kt rename to testapp/src/commonMain/kotlin/de/staropensource/engine/testapp/package-info.kt diff --git a/testapp/src/main/resources/.gitignore b/testapp/src/commonMain/resources/.gitignore similarity index 100% rename from testapp/src/main/resources/.gitignore rename to testapp/src/commonMain/resources/.gitignore diff --git a/testing/build.gradle.kts b/testing/build.gradle.kts index dd71b68..11b1424 100644 --- a/testing/build.gradle.kts +++ b/testing/build.gradle.kts @@ -17,15 +17,15 @@ * along with this program. If not, see . */ -// Dependencies -dependencies { - // sos!engine - implementation(project(":base")) +kotlin { + // Dependencies + sourceSets { + commonMain.dependencies { + // sos!engine + implementation(project(":base")) - // Unit testing - // -> Kotlin - implementation(kotlin("test")) - // -> JUnit - implementation(platform("${property("testDependencyJUnit_BOMIdentifier")}:${property("testDependencyJUnitVersion")}")) - implementation("${property("testDependencyJUnit_JupiterIdentifier")}") + // -> Kotlin + implementation(kotlin("test")) + } + } } diff --git a/testing/src/main/kotlin/de/staropensource/engine/testing/TestBase.kt b/testing/src/commonMain/kotlin/de/staropensource/engine/testing/TestBase.kt similarity index 93% rename from testing/src/main/kotlin/de/staropensource/engine/testing/TestBase.kt rename to testing/src/commonMain/kotlin/de/staropensource/engine/testing/TestBase.kt index 6145874..7fd2e18 100644 --- a/testing/src/main/kotlin/de/staropensource/engine/testing/TestBase.kt +++ b/testing/src/commonMain/kotlin/de/staropensource/engine/testing/TestBase.kt @@ -26,13 +26,9 @@ import de.staropensource.engine.base.type.logging.ChannelSettings import de.staropensource.engine.base.type.logging.Level import de.staropensource.engine.testing.implementation.FailureShutdownHandler import de.staropensource.engine.testing.implementation.NoOperationShutdownHandler -import org.junit.jupiter.api.AfterEach -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.TestInfo -import org.junit.jupiter.api.fail -import kotlin.concurrent.fixedRateTimer -import kotlin.jvm.optionals.getOrDefault -import kotlin.jvm.optionals.getOrNull +import kotlin.test.AfterTest +import kotlin.test.BeforeTest +import kotlin.test.fail /** * Base class for implementing tests. @@ -61,8 +57,8 @@ abstract class TestBase( * * @since v1-alpha10 */ - @BeforeEach - fun beforeTask(testInfo: TestInfo) { + @BeforeTest + fun beforeTest() { when (Engine.state) { State.INITIALIZING, State.SHUTTING_DOWN -> fail("Engine is in invalid state 'Engine.State.${Engine.state.name}'") State.CRASHED -> fail("The StarOpenSource Engine has crashed") @@ -73,8 +69,10 @@ abstract class TestBase( initializeEngine() // Print test starting + /* if (printTestExecution) println("-> STARTING test '${testInfo.displayName}' [${testInfo.testClass.getOrNull()?.name ?: ""}#${testInfo.testMethod.getOrNull()?.name ?: ""}]") + */ } /** @@ -82,8 +80,8 @@ abstract class TestBase( * * @since v1-alpha10 */ - @AfterEach - fun afterTask(testInfo: TestInfo) { + @AfterTest + fun afterTest() { when (Engine.state) { State.UNINITIALIZED -> fail("Internal inconsistency detected: Engine configuration was not performed") State.INITIALIZING, State.SHUTTING_DOWN -> fail("Engine is in invalid state 'Engine.State.${Engine.state.name}'") @@ -95,8 +93,10 @@ abstract class TestBase( shutdownEngine() // Print test ending + /* if (printTestExecution) println("-> FINISHED test '${testInfo.displayName}' [${testInfo.testClass.getOrNull()?.name ?: ""}#${testInfo.testMethod.getOrNull()?.name ?: ""}]") + */ } diff --git a/testing/src/main/kotlin/de/staropensource/engine/testing/implementation/FailureShutdownHandler.kt b/testing/src/commonMain/kotlin/de/staropensource/engine/testing/implementation/FailureShutdownHandler.kt similarity index 98% rename from testing/src/main/kotlin/de/staropensource/engine/testing/implementation/FailureShutdownHandler.kt rename to testing/src/commonMain/kotlin/de/staropensource/engine/testing/implementation/FailureShutdownHandler.kt index b10ce01..dff8002 100644 --- a/testing/src/main/kotlin/de/staropensource/engine/testing/implementation/FailureShutdownHandler.kt +++ b/testing/src/commonMain/kotlin/de/staropensource/engine/testing/implementation/FailureShutdownHandler.kt @@ -20,6 +20,7 @@ package de.staropensource.engine.testing.implementation import de.staropensource.engine.base.implementable.ShutdownHandler +import kotlin.jvm.JvmStatic import kotlin.test.fail /** diff --git a/testing/src/main/kotlin/de/staropensource/engine/testing/implementation/NoOperationShutdownHandler.kt b/testing/src/commonMain/kotlin/de/staropensource/engine/testing/implementation/NoOperationShutdownHandler.kt similarity index 98% rename from testing/src/main/kotlin/de/staropensource/engine/testing/implementation/NoOperationShutdownHandler.kt rename to testing/src/commonMain/kotlin/de/staropensource/engine/testing/implementation/NoOperationShutdownHandler.kt index f39e8e0..bc43ea7 100644 --- a/testing/src/main/kotlin/de/staropensource/engine/testing/implementation/NoOperationShutdownHandler.kt +++ b/testing/src/commonMain/kotlin/de/staropensource/engine/testing/implementation/NoOperationShutdownHandler.kt @@ -20,7 +20,7 @@ package de.staropensource.engine.testing.implementation import de.staropensource.engine.base.implementable.ShutdownHandler -import kotlin.test.fail +import kotlin.jvm.JvmStatic /** * [ShutdownHandler] implementation which diff --git a/testing/src/main/kotlin/de/staropensource/engine/testing/implementation/package-info.kt b/testing/src/commonMain/kotlin/de/staropensource/engine/testing/implementation/package-info.kt similarity index 100% rename from testing/src/main/kotlin/de/staropensource/engine/testing/implementation/package-info.kt rename to testing/src/commonMain/kotlin/de/staropensource/engine/testing/implementation/package-info.kt diff --git a/testing/src/main/resources/.gitignore b/testing/src/commonMain/resources/.gitignore similarity index 100% rename from testing/src/main/resources/.gitignore rename to testing/src/commonMain/resources/.gitignore