Make engine multiplatform (incomplete)
I've only performed basic steps to allow the engine to be multiplatform. Major classes such as FileAccess, various Stream implementations and so on need to be updated accordingly.
This commit is contained in:
parent
df3ef9829e
commit
06b279e8b6
108 changed files with 138 additions and 87 deletions
|
@ -17,8 +17,12 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Dependencies
|
kotlin {
|
||||||
dependencies {
|
// Dependencies
|
||||||
// sos!engine
|
sourceSets {
|
||||||
implementation(project(":base"))
|
commonMain.dependencies {
|
||||||
|
// sos!engine
|
||||||
|
implementation(project(":base"))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ package de.staropensource.engine.ansi
|
||||||
|
|
||||||
import de.staropensource.engine.ansi.AnsiSubsystem.Companion.logger
|
import de.staropensource.engine.ansi.AnsiSubsystem.Companion.logger
|
||||||
import de.staropensource.engine.base.implementable.formatter.TwoCycleFormatterImpl
|
import de.staropensource.engine.base.implementable.formatter.TwoCycleFormatterImpl
|
||||||
|
import kotlin.jvm.JvmStatic
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats a string using ANSI
|
* Formats a string using ANSI
|
|
@ -24,6 +24,7 @@ import de.staropensource.engine.base.implementable.Subsystem
|
||||||
import de.staropensource.engine.base.logging.Logger
|
import de.staropensource.engine.base.logging.Logger
|
||||||
import de.staropensource.engine.base.type.logging.ChannelSettings
|
import de.staropensource.engine.base.type.logging.ChannelSettings
|
||||||
import de.staropensource.engine.base.utility.dnihbd.BuildInformation
|
import de.staropensource.engine.base.utility.dnihbd.BuildInformation
|
||||||
|
import kotlin.jvm.JvmStatic
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ANSI subsystem.
|
* The ANSI subsystem.
|
|
@ -17,8 +17,12 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Dependencies
|
kotlin {
|
||||||
dependencies {
|
// Dependencies
|
||||||
// OSHI
|
sourceSets {
|
||||||
implementation("${property("dependencyOshiIdentifier") as String}:${property("dependencyOshiVersion") as String}")
|
jvmMain.dependencies {
|
||||||
|
// OSHI
|
||||||
|
implementation("${property("dependencyOshiIdentifier") as String}:${property("dependencyOshiVersion") as String}")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import de.staropensource.engine.base.utility.FileAccess
|
||||||
import de.staropensource.engine.base.utility.dnihbd.BuildInformation
|
import de.staropensource.engine.base.utility.dnihbd.BuildInformation
|
||||||
import java.nio.charset.Charset
|
import java.nio.charset.Charset
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
|
import kotlin.jvm.JvmStatic
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,6 +51,7 @@ class Engine private constructor() {
|
||||||
*
|
*
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
|
@JvmStatic
|
||||||
internal val logger: Logger = Logger(channel = "engine-core")
|
internal val logger: Logger = Logger(channel = "engine-core")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,6 +59,7 @@ class Engine private constructor() {
|
||||||
*
|
*
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
|
@JvmStatic
|
||||||
var state: State = State.UNINITIALIZED
|
var state: State = State.UNINITIALIZED
|
||||||
internal set
|
internal set
|
||||||
|
|
||||||
|
@ -73,6 +76,7 @@ class Engine private constructor() {
|
||||||
* @see bootstrap
|
* @see bootstrap
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
|
@JvmStatic
|
||||||
var bootstrapping: Boolean? = null
|
var bootstrapping: Boolean? = null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,6 +85,7 @@ class Engine private constructor() {
|
||||||
* @see Subsystem
|
* @see Subsystem
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
|
@JvmStatic
|
||||||
private val subsystems: MutableSet<Subsystem> = mutableSetOf()
|
private val subsystems: MutableSet<Subsystem> = mutableSetOf()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,6 +96,7 @@ class Engine private constructor() {
|
||||||
* @see BuildInformation
|
* @see BuildInformation
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
|
@JvmStatic
|
||||||
var info: BuildInformation? = null
|
var info: BuildInformation? = null
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,6 +108,7 @@ class Engine private constructor() {
|
||||||
* @return array of registered [Subsystem]s
|
* @return array of registered [Subsystem]s
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
|
@JvmStatic
|
||||||
fun getSubsystems(): Array<Subsystem> = subsystems.toTypedArray()
|
fun getSubsystems(): Array<Subsystem> = subsystems.toTypedArray()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,11 +117,14 @@ class Engine private constructor() {
|
||||||
*
|
*
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
fun getSubsystem(subsystemClass: KClass<out Subsystem>): Subsystem? = getSubsystems().find { subsystem -> try {
|
@JvmStatic
|
||||||
subsystem::class.qualifiedName!! == subsystemClass.qualifiedName!!
|
fun getSubsystem(subsystemClass: KClass<out Subsystem>): Subsystem? {
|
||||||
} catch (_: NullPointerException) {
|
return getSubsystems().find { subsystem -> try {
|
||||||
false
|
subsystem::class.qualifiedName!! == subsystemClass.qualifiedName!!
|
||||||
} }
|
} catch (_: NullPointerException) {
|
||||||
|
false
|
||||||
|
} }
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers the specified subsystem.
|
* Registers the specified subsystem.
|
||||||
|
@ -128,6 +138,7 @@ class Engine private constructor() {
|
||||||
* @see Subsystem
|
* @see Subsystem
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
|
@JvmStatic
|
||||||
fun registerSubsystem(subsystem: Subsystem) {
|
fun registerSubsystem(subsystem: Subsystem) {
|
||||||
// Check for state
|
// Check for state
|
||||||
if (bootstrapping == true)
|
if (bootstrapping == true)
|
|
@ -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.Level
|
||||||
import de.staropensource.engine.base.type.logging.OperationMode
|
import de.staropensource.engine.base.type.logging.OperationMode
|
||||||
import kotlinx.datetime.TimeZone
|
import kotlinx.datetime.TimeZone
|
||||||
|
import kotlin.jvm.JvmStatic
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -25,10 +25,9 @@ package de.staropensource.engine.base.annotation
|
||||||
* the public API.
|
* the public API.
|
||||||
*
|
*
|
||||||
* Using anything non-Kotlin in conjunction with
|
* Using anything non-Kotlin in conjunction with
|
||||||
* the StarOpenSource Engine is highly discouraged,
|
* the StarOpenSource Engine is highly
|
||||||
* as the engine may be multiplatform in future
|
* discouraged, as the engine is optimized for
|
||||||
* releases and will not support using other
|
* multiplatform usage.
|
||||||
* languages.
|
|
||||||
*
|
*
|
||||||
* Using anything in contact with non-Kotlin code
|
* Using anything in contact with non-Kotlin code
|
||||||
* is therefore deemed unsafe and should be
|
* is therefore deemed unsafe and should be
|
|
@ -44,7 +44,7 @@ import kotlin.text.iterator
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
abstract class TwoCycleFormatterImpl: TwoCycleFormatter() {
|
abstract class TwoCycleFormatterImpl: TwoCycleFormatter() {
|
||||||
@Suppress("NestedBlockDepth")
|
@Suppress("NestedBlockDepth", "CyclomaticComplexMethod")
|
||||||
override fun parse(message: String): Array<String> {
|
override fun parse(message: String): Array<String> {
|
||||||
val components: MutableList<String> = mutableListOf()
|
val components: MutableList<String> = mutableListOf()
|
||||||
var currentComponent: StringBuilder = StringBuilder()
|
var currentComponent: StringBuilder = StringBuilder()
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
package de.staropensource.engine.base.implementable.logging
|
package de.staropensource.engine.base.implementable.logging
|
||||||
|
|
||||||
import de.staropensource.engine.base.logging.Processor
|
|
||||||
import de.staropensource.engine.base.type.logging.Call
|
import de.staropensource.engine.base.type.logging.Call
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -22,4 +22,4 @@
|
||||||
*
|
*
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
package de.staropensource.engine.base.implementable;
|
package de.staropensource.engine.base.implementable
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [Streams].
|
* [Stream]s.
|
||||||
*
|
*
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
|
@ -20,6 +20,7 @@
|
||||||
package de.staropensource.engine.base.implementation.logging
|
package de.staropensource.engine.base.implementation.logging
|
||||||
|
|
||||||
import de.staropensource.engine.base.implementable.ShutdownHandler
|
import de.staropensource.engine.base.implementable.ShutdownHandler
|
||||||
|
import kotlin.jvm.JvmStatic
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -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.Formatter
|
||||||
import de.staropensource.engine.base.implementable.formatter.OneCycleFormatter
|
import de.staropensource.engine.base.implementable.formatter.OneCycleFormatter
|
||||||
|
import kotlin.jvm.JvmStatic
|
||||||
import kotlin.text.iterator
|
import kotlin.text.iterator
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -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.implementable.logging.Adapter
|
||||||
import de.staropensource.engine.base.type.logging.Call
|
import de.staropensource.engine.base.type.logging.Call
|
||||||
|
import kotlin.jvm.JvmStatic
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [Adapter] for printing messages
|
* [Adapter] for printing messages
|
|
@ -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.implementable.logging.CrashCategory
|
||||||
import de.staropensource.engine.base.utility.dnihbd.BuildInformation
|
import de.staropensource.engine.base.utility.dnihbd.BuildInformation
|
||||||
|
import kotlin.jvm.JvmStatic
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [CrashCategory] implementation
|
* [CrashCategory] implementation
|
|
@ -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.Call
|
||||||
import de.staropensource.engine.base.type.logging.ChannelSettings
|
import de.staropensource.engine.base.type.logging.ChannelSettings
|
||||||
import de.staropensource.engine.base.utility.Environment
|
import de.staropensource.engine.base.utility.Environment
|
||||||
import kotlinx.datetime.LocalDateTime
|
import kotlin.jvm.JvmStatic
|
||||||
import kotlinx.datetime.TimeZone
|
|
||||||
import kotlinx.datetime.toLocalDateTime
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [CrashCategory] implementation
|
* [CrashCategory] implementation
|
|
@ -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.Call
|
||||||
import de.staropensource.engine.base.type.logging.ChannelSettings
|
import de.staropensource.engine.base.type.logging.ChannelSettings
|
||||||
import de.staropensource.engine.base.utility.misc.StackTraceUtils
|
import de.staropensource.engine.base.utility.misc.StackTraceUtils
|
||||||
|
import kotlin.jvm.JvmStatic
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [CrashCategory] implementation
|
* [CrashCategory] implementation
|
|
@ -20,6 +20,7 @@
|
||||||
package de.staropensource.engine.base.implementation.stream
|
package de.staropensource.engine.base.implementation.stream
|
||||||
|
|
||||||
import de.staropensource.engine.base.implementable.stream.Stream
|
import de.staropensource.engine.base.implementable.stream.Stream
|
||||||
|
import kotlin.jvm.JvmStatic
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A [Stream] which does nothing
|
* A [Stream] which does nothing
|
|
@ -29,4 +29,4 @@ import de.staropensource.engine.base.implementable.stream.Stream
|
||||||
* @param stringRead string to provide for reading
|
* @param stringRead string to provide for reading
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
open class StringReadStream(val stringRead: String) : ByteReadStream(bytesRead = stringRead.toByteArray())
|
open class StringReadStream(val stringRead: String) : ByteReadStream(bytesRead = stringRead.encodeToByteArray())
|
|
@ -29,7 +29,7 @@ import de.staropensource.engine.base.implementable.stream.Stream
|
||||||
* @param stringRead string to provide for reading
|
* @param stringRead string to provide for reading
|
||||||
* @since v1-alpha10
|
* @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.
|
* Returns the written string.
|
||||||
*
|
*
|
|
@ -21,6 +21,7 @@ package de.staropensource.engine.base.logging
|
||||||
|
|
||||||
import de.staropensource.engine.base.implementable.logging.Filter
|
import de.staropensource.engine.base.implementable.logging.Filter
|
||||||
import de.staropensource.engine.base.type.logging.Call
|
import de.staropensource.engine.base.type.logging.Call
|
||||||
|
import kotlin.jvm.JvmStatic
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles call filtering.
|
* Handles call filtering.
|
|
@ -30,6 +30,8 @@ import de.staropensource.engine.base.type.logging.Level
|
||||||
import de.staropensource.engine.base.utility.misc.StackTraceUtils
|
import de.staropensource.engine.base.utility.misc.StackTraceUtils
|
||||||
import kotlinx.datetime.Clock
|
import kotlinx.datetime.Clock
|
||||||
import kotlinx.datetime.Instant
|
import kotlinx.datetime.Instant
|
||||||
|
import kotlin.jvm.JvmName
|
||||||
|
import kotlin.jvm.JvmStatic
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Frontend for sos!engine's logging system.
|
* 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
|
* @param callerDepth determines the depth at which to discover the method caller
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
fun log(level: Level, message: String, levelData: Map<String, Object?> = emptyMap(), callerDepth: UInt = 0u) {
|
fun log(level: Level, message: String, levelData: Map<String, Any?> = emptyMap(), callerDepth: UInt = 0u) {
|
||||||
// Create 'Call' instance
|
// Create 'Call' instance
|
||||||
var call: Call = Call(
|
var call: Call = Call(
|
||||||
StackTraceUtils.methodCaller(depth = callerDepth.plus(1u)),
|
StackTraceUtils.methodCaller(depth = callerDepth.plus(1u)),
|
||||||
|
@ -130,7 +132,7 @@ class Logger {
|
||||||
|
|
||||||
// Run processing
|
// Run processing
|
||||||
if (level == Level.CRASH)
|
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 {
|
else {
|
||||||
if (Processor.check(call))
|
if (Processor.check(call))
|
||||||
return
|
return
|
||||||
|
@ -210,8 +212,8 @@ class Logger {
|
||||||
*/
|
*/
|
||||||
fun crash(error: String, throwable: Throwable? = null, fatal: Boolean = true) {
|
fun crash(error: String, throwable: Throwable? = null, fatal: Boolean = true) {
|
||||||
log(Level.CRASH, error, levelData = mapOf(
|
log(Level.CRASH, error, levelData = mapOf(
|
||||||
Pair("throwable", throwable as Object?),
|
Pair("throwable", throwable as Any?),
|
||||||
Pair("fatal", fatal as Object?)
|
Pair("fatal", fatal as Any?)
|
||||||
), callerDepth = 1u)
|
), callerDepth = 1u)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,5 +244,5 @@ class Logger {
|
||||||
* @return [FileAccessStream] instance
|
* @return [FileAccessStream] instance
|
||||||
* @since v1-alpha10
|
* @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)
|
||||||
}
|
}
|
|
@ -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.Feature
|
||||||
import de.staropensource.engine.base.type.logging.OperationMode
|
import de.staropensource.engine.base.type.logging.OperationMode
|
||||||
import de.staropensource.engine.base.utility.misc.StackTraceUtils
|
import de.staropensource.engine.base.utility.misc.StackTraceUtils
|
||||||
|
import kotlin.jvm.JvmStatic
|
||||||
import kotlin.reflect.full.primaryConstructor
|
import kotlin.reflect.full.primaryConstructor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,7 +88,7 @@ class Processor private constructor() {
|
||||||
* @param call [Call] metadata
|
* @param call [Call] metadata
|
||||||
* @see EngineConfiguration.logThreadingHandler
|
* @see EngineConfiguration.logThreadingHandler
|
||||||
* @see ChannelSettings.formatter
|
* @see ChannelSettings.formatter
|
||||||
* @see ChannelSettings.adapter
|
* @see ChannelSettings.adapters
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
|
@ -20,6 +20,7 @@
|
||||||
package de.staropensource.engine.base.type
|
package de.staropensource.engine.base.type
|
||||||
|
|
||||||
import de.staropensource.engine.base.EngineConfiguration
|
import de.staropensource.engine.base.EngineConfiguration
|
||||||
|
import kotlin.jvm.JvmStatic
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a data type which can have
|
* Defines a data type which can have
|
|
@ -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.implementable.formatter.Formatter
|
||||||
import de.staropensource.engine.base.implementation.logging.NoOperationFormatter
|
import de.staropensource.engine.base.implementation.logging.NoOperationFormatter
|
||||||
import de.staropensource.engine.base.implementation.logging.adapter.PrintlnAdapter
|
import de.staropensource.engine.base.implementation.logging.adapter.PrintlnAdapter
|
||||||
|
import kotlin.jvm.JvmStatic
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the configuration of one
|
* Holds the configuration of one
|
|
@ -22,4 +22,4 @@
|
||||||
*
|
*
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
package de.staropensource.engine.base.type;
|
package de.staropensource.engine.base.type
|
|
@ -23,4 +23,4 @@
|
||||||
*
|
*
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
package de.staropensource.engine.base.type.versioning;
|
package de.staropensource.engine.base.type.versioning
|
|
@ -23,6 +23,7 @@ import java.math.RoundingMode
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.text.DecimalFormatSymbols
|
import java.text.DecimalFormatSymbols
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
import kotlin.jvm.JvmStatic
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts between various data size units.
|
* Converts between various data size units.
|
|
@ -26,6 +26,7 @@ import kotlinx.datetime.Instant
|
||||||
import oshi.PlatformEnum
|
import oshi.PlatformEnum
|
||||||
import oshi.SystemInfo
|
import oshi.SystemInfo
|
||||||
import oshi.hardware.HardwareAbstractionLayer
|
import oshi.hardware.HardwareAbstractionLayer
|
||||||
|
import kotlin.jvm.JvmStatic
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides information about the
|
* Provides information about the
|
|
@ -36,6 +36,7 @@ import java.io.IOException
|
||||||
import java.nio.file.*
|
import java.nio.file.*
|
||||||
import java.nio.file.attribute.BasicFileAttributes
|
import java.nio.file.attribute.BasicFileAttributes
|
||||||
import java.nio.file.attribute.PosixFilePermissions
|
import java.nio.file.attribute.PosixFilePermissions
|
||||||
|
import kotlin.jvm.JvmStatic
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a simplified way of
|
* Provides a simplified way of
|
|
@ -22,4 +22,4 @@
|
||||||
*
|
*
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
package de.staropensource.engine.base.utility;
|
package de.staropensource.engine.base.utility
|
|
@ -25,4 +25,4 @@
|
||||||
*
|
*
|
||||||
* @since v1-alpha10
|
* @since v1-alpha10
|
||||||
*/
|
*/
|
||||||
package de.staropensource.engine;
|
package de.staropensource.engine
|
|
@ -48,7 +48,7 @@ plugins {
|
||||||
id("maven-publish")
|
id("maven-publish")
|
||||||
|
|
||||||
// Kotlin support
|
// Kotlin support
|
||||||
id("org.jetbrains.kotlin.jvm") version("2.0.0")
|
id("org.jetbrains.kotlin.multiplatform") version("2.0.0")
|
||||||
|
|
||||||
// Dokka
|
// Dokka
|
||||||
id("org.jetbrains.dokka") version("1.9.20")
|
id("org.jetbrains.dokka") version("1.9.20")
|
||||||
|
@ -67,7 +67,7 @@ allprojects {
|
||||||
// Plugins
|
// Plugins
|
||||||
apply(plugin = "java-library")
|
apply(plugin = "java-library")
|
||||||
apply(plugin = "maven-publish")
|
apply(plugin = "maven-publish")
|
||||||
apply(plugin = "org.jetbrains.kotlin.jvm")
|
apply(plugin = "org.jetbrains.kotlin.multiplatform")
|
||||||
apply(plugin = "org.jetbrains.dokka")
|
apply(plugin = "org.jetbrains.dokka")
|
||||||
apply(plugin = "com.gorylenko.gradle-git-properties")
|
apply(plugin = "com.gorylenko.gradle-git-properties")
|
||||||
apply(plugin = "ca.solo-studios.nyx")
|
apply(plugin = "ca.solo-studios.nyx")
|
||||||
|
@ -125,12 +125,7 @@ allprojects {
|
||||||
withDistributeLicense()
|
withDistributeLicense()
|
||||||
encoding = "UTF-8"
|
encoding = "UTF-8"
|
||||||
withZip64()
|
withZip64()
|
||||||
withBuildDependsOnJar()
|
|
||||||
withSuppressWarnings()
|
withSuppressWarnings()
|
||||||
jvmToolchain = (property("languageJava") as String).toInt()
|
|
||||||
jvmTarget = (property("languageJava") as String).toInt()
|
|
||||||
withSourcesJar()
|
|
||||||
withJavadocJar()
|
|
||||||
withReproducibleBuilds()
|
withReproducibleBuilds()
|
||||||
|
|
||||||
// Kotlin-specific settings
|
// Kotlin-specific settings
|
||||||
|
@ -141,6 +136,14 @@ allprojects {
|
||||||
"-progressive"
|
"-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()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dependencies
|
// Kotlin
|
||||||
dependencies {
|
kotlin {
|
||||||
// Kotlin support
|
// Targets
|
||||||
implementation("${property("dependencyKotlin_ReflectIdentifier") as String}:${property("dependencyKotlinVersion") as String}")
|
// -> JVM
|
||||||
implementation("${property("dependencyKotlin_CoroutinesIdentifier") as String}:${property("dependencyKotlin_CoroutinesVersion") as String}")
|
jvm()
|
||||||
implementation("${property("dependencyKotlin_DateTimeIdentifier") as String}:${property("dependencyKotlin_DateTimeVersion") as String}")
|
// -> Native
|
||||||
|
linuxX64()
|
||||||
|
linuxArm64()
|
||||||
|
mingwX64()
|
||||||
|
|
||||||
// Unit testing
|
// Dependencies
|
||||||
// -> Kotlin
|
sourceSets {
|
||||||
testImplementation(kotlin("test"))
|
commonMain.dependencies {
|
||||||
// -> JUnit
|
// Kotlin support
|
||||||
testImplementation(platform("${property("testDependencyJUnit_BOMIdentifier")}:${property("testDependencyJUnitVersion")}"))
|
implementation("${property("dependencyKotlin_ReflectIdentifier") as String}:${property("dependencyKotlinVersion") as String}")
|
||||||
testImplementation("${property("testDependencyJUnit_JupiterIdentifier")}")
|
implementation("${property("dependencyKotlin_CoroutinesIdentifier") as String}:${property("dependencyKotlin_CoroutinesVersion") as String}")
|
||||||
testRuntimeOnly("${property("testDependencyJUnit_PlatformIdentifier")}")
|
implementation("${property("dependencyKotlin_DateTimeIdentifier") as String}:${property("dependencyKotlin_DateTimeVersion") as String}")
|
||||||
// -> sos!engine
|
}
|
||||||
testImplementation(project(":testing"))
|
commonTest.dependencies {
|
||||||
|
// -> Kotlin
|
||||||
|
implementation(kotlin("test"))
|
||||||
|
// -> sos!engine
|
||||||
|
implementation(project(":testing"))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unit testing
|
// Unit testing
|
||||||
|
|
2
dist/detekt.yml
vendored
2
dist/detekt.yml
vendored
|
@ -28,6 +28,8 @@ complexity:
|
||||||
naming:
|
naming:
|
||||||
MemberNameEqualsClassName:
|
MemberNameEqualsClassName:
|
||||||
active: false
|
active: false
|
||||||
|
MatchingDeclarationName:
|
||||||
|
active: false
|
||||||
|
|
||||||
exceptions:
|
exceptions:
|
||||||
SwallowedException:
|
SwallowedException:
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import java.net.URI
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* STAROPENSOURCE ENGINE SOURCE FILE
|
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||||
* Copyright (c) 2024 The StarOpenSource Engine Authors
|
* Copyright (c) 2024 The StarOpenSource Engine Authors
|
||||||
|
|
|
@ -24,11 +24,15 @@ plugins {
|
||||||
id("com.gradleup.shadow") version ("8.3.5")
|
id("com.gradleup.shadow") version ("8.3.5")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dependencies
|
kotlin {
|
||||||
dependencies {
|
// Dependencies
|
||||||
// sos!engine
|
sourceSets {
|
||||||
implementation(project(":base"))
|
commonMain.dependencies {
|
||||||
implementation(project(":ansi"))
|
// sos!engine
|
||||||
|
implementation(project(":base"))
|
||||||
|
implementation(project(":ansi"))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure JAR
|
// Configure JAR
|
||||||
|
|
|
@ -24,6 +24,7 @@ import de.staropensource.engine.base.Engine
|
||||||
import de.staropensource.engine.base.EngineConfiguration
|
import de.staropensource.engine.base.EngineConfiguration
|
||||||
import de.staropensource.engine.base.logging.Logger
|
import de.staropensource.engine.base.logging.Logger
|
||||||
import de.staropensource.engine.base.type.logging.Level
|
import de.staropensource.engine.base.type.logging.Level
|
||||||
|
import kotlin.jvm.JvmStatic
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Testing program for the StarOpenSource Engine.
|
* Testing program for the StarOpenSource Engine.
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue