import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl plugins { kotlin("multiplatform") version "2.2.21" kotlin("plugin.serialization") version "2.2.21" id("org.jetbrains.dokka") version "1.9.20" id("com.android.library") version "8.7.2" `maven-publish` } group = "net.sergeych" version = "0.3.2" repositories { google() mavenCentral() mavenLocal() maven("https://maven.universablockchain.com/") } kotlin { jvmToolchain(17) jvm() androidTarget() { // Ensure Android variant is published to Maven so consumers get androidMain APIs publishLibraryVariants("release") } js { browser() nodejs() } macosArm64() iosX64() iosArm64() macosX64() iosSimulatorArm64() linuxX64() linuxArm64() @OptIn(ExperimentalWasmDsl::class) wasmJs { browser() binaries.executable() } mingwX64() { binaries.staticLib { baseName = "mp_bintools" } } sourceSets { all { languageSettings.optIn("kotlinx.serialization.ExperimentalSerializationApi") languageSettings.optIn("kotlin.ExperimentalUnsignedTypes") languageSettings.optIn("kotlin.contracts.ExperimentalContracts") languageSettings.optIn("kotlin.time.ExperimentalTime") } val commonMain by getting { dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2") // this is actually a bug: we need only the core, but bare core causes strange errors implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0") api("net.sergeych:mp_stools:[1.6.3,)") implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.7.1") } } val nativeMain by creating { dependsOn(commonMain) dependencies { } } val linuxX64Main by getting { dependsOn(nativeMain) } val linuxArm64Main by getting { dependsOn(nativeMain) } val commonTest by getting { dependencies { implementation(kotlin("test")) implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0") } } val jvmMain by getting val jvmTest by getting val androidMain by getting { dependencies { // Android base64 and preferences are in the SDK; no extra deps required } } val jsMain by getting { dependencies { } } val jsTest by getting // val nativeTest by getting val wasmJsMain by getting { dependencies { implementation("org.jetbrains.kotlinx:kotlinx-browser-wasm-js:0.5.0") } } val wasmJsTest by getting { dependencies { // implementation("org.jetbrains.kotlinx:kotlinx-browser:0.3") } } } } 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) } } } } android { namespace = "net.sergeych.bintools" compileSdk = 34 defaultConfig { minSdk = 21 } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } // Publish only release variant of the Android target so consumers (Android apps) // resolve the platform artifact instead of common metadata, which is required // to access Android-only APIs like net.sergeych.bintools.AndroidKV publishing { singleVariant("release") { withSourcesJar() } } } tasks.dokkaHtml.configure { outputDirectory.set(buildDir.resolve("dokka")) dokkaSourceSets { configureEach { includes.from("docs/bipack.md") } } }