plugins { kotlin("multiplatform") version "1.9.22" kotlin("plugin.serialization") version "1.9.22" id("org.jetbrains.dokka") version "1.9.10" `maven-publish` } val serialization_version = "1.3.4" group = "net.sergeych" version = "0.1.1" repositories { mavenCentral() mavenLocal() maven("https://maven.universablockchain.com/") } kotlin { jvmToolchain(8) jvm { compilations.all { kotlinOptions.jvmTarget = "1.8" } withJava() testRuns["test"].executionTask.configure { useJUnitPlatform() } } js(IR) { browser { testTask { useKarma { // /home/sergeych/snap/firefox/common/.mozilla/firefox/iff469o9.default // /home/sergeych/snap/firefox/common/.mozilla/firefox/iff469o9.default // useFirefox() useChromeHeadless() // useSafari() } } // commonWebpackConfig { // cssSupport.enabled = true // } } nodejs { testTask { } } } // val hostOs = System.getProperty("os.name") // val isMingwX64 = hostOs.startsWith("Windows") // val nativeTarget = when { // hostOs == "Mac OS X" -> macosX64("native") // hostOs == "Linux" -> linuxX64("native") // isMingwX64 -> mingwX64("native") // else -> throw GradleException("Host OS is not supported in Kotlin/Native.") // } linuxX64("native") { binaries.staticLib { baseName = "mp_bintools" } } wasmJs { browser() binaries.executable() } mingwX64() { binaries.staticLib { baseName = "mp_bintools" } } listOf( iosX64(), iosArm64(), iosSimulatorArm64() ).forEach { it.binaries.framework { baseName = "mp_bintools" isStatic = true } } listOf( macosX64(), macosArm64() ).forEach { it.binaries.framework { baseName = "mp_bintools" isStatic = true } } sourceSets { all { languageSettings.optIn("kotlinx.serialization.ExperimentalSerializationApi") languageSettings.optIn("kotlin.ExperimentalUnsignedTypes") languageSettings.optIn("kotlin.contracts.ExperimentalContracts") } val commonMain by getting { dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0") // this is actually a bug: we need only the core, but bare core causes strange errors implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3") // api("net.sergeych:mp_stools:[1.3.3,)") implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0") } } val commonTest by getting { dependencies { implementation(kotlin("test")) implementation("net.sergeych:mp_stools:1.4.7") } } val jvmMain by getting val jvmTest by getting val jsMain by getting { dependencies { implementation("net.sergeych:mp_stools:1.4.7") } } val jsTest by getting val nativeMain by getting val nativeTest by getting val wasmJsMain by getting { dependencies { implementation("net.sergeych:mp_stools:1.4.7") } } val wasmJsTest by getting } publishing { val mavenToken by lazy { File("${System.getProperty("user.home")}/.gitea_token").readText() } repositories { maven { credentials(HttpHeaderCredentials::class) { name = "Authorization" value = mavenToken } url = uri("https://gitea.sergeych.net/api/packages/SergeychWorks/maven") authentication { create("Authorization", HttpHeaderAuthentication::class) } } } } } tasks.dokkaHtml.configure { outputDirectory.set(buildDir.resolve("dokka")) dokkaSourceSets { configureEach { includes.from("docs/bipack.md") } } }