/* * Copyright (c) 2025. Sergey S. Chernov - All Rights Reserved * * You may use, distribute and modify this code under the * terms of the private license, which you must obtain from the author * * To obtain the license, contact the author: https://t.me/real_sergeych or email to * real dot sergeych at gmail. */ import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { kotlin("multiplatform") version "2.1.0" id("org.jetbrains.kotlin.plugin.serialization") version "2.1.0" id("com.android.library") version "8.5.2" apply true `maven-publish` id("org.jetbrains.dokka") version "1.9.20" } group = "net.sergeych" version = "0.6.8-SNAPSHOT" repositories { mavenCentral() mavenLocal() maven("https://maven.universablockchain.com/") maven("https://gitea.sergeych.net/api/packages/SergeychWorks/maven") maven("https://gitea.sergeych.net/api/packages/YoungBlood/maven") } kotlin { jvmToolchain(17) jvm() js { browser { } nodejs() } macosArm64() iosX64() iosArm64() iosSimulatorArm64() linuxX64() linuxArm64() macosX64() macosX64() mingwX64() @OptIn(ExperimentalWasmDsl::class) wasmJs { browser() } val ktor_version = "3.1.1" sourceSets { all { languageSettings.optIn("kotlinx.serialization.ExperimentalSerializationApi") languageSettings.optIn("kotlinx.coroutines.ExperimentalCoroutinesApi") languageSettings.optIn("kotlin.ExperimentalUnsignedTypes") } val commonMain by getting { dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1") implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.2") api("io.ktor:ktor-client-core:$ktor_version") api("net.sergeych:crypto2:0.8.3") } } val androidMain by getting { dependencies { implementation("io.ktor:ktor-client-okhttp:$ktor_version") } } val ktorSocketMain by creating { dependsOn(commonMain) dependencies { implementation("io.ktor:ktor-network:$ktor_version") } } val commonTest by getting { dependencies { implementation(kotlin("test")) implementation("org.slf4j:slf4j-simple:2.0.9") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.1") } } val ktorSocketTest by creating { dependsOn(commonTest) } val jvmMain by getting { dependencies { implementation("io.ktor:ktor-server-core:$ktor_version") implementation("io.ktor:ktor-server-core-jvm:$ktor_version") implementation("io.ktor:ktor-server-websockets-jvm:$ktor_version") implementation("io.ktor:ktor-server-netty:$ktor_version") api("io.ktor:ktor-client-cio:$ktor_version") } dependsOn(ktorSocketMain) } val jvmTest by getting { dependsOn(ktorSocketTest) } val jsMain by getting { dependencies { implementation("io.ktor:ktor-client-js:$ktor_version") } } val jsTest by getting // val macosArm64Main by getting { // dependsOn(ktorSocketMain) // } // val macosArm64Test by getting { // dependsOn(ktorSocketTest) // } // val macosX64Main by getting { // dependsOn(ktorSocketMain) // } // val iosX64Main by getting { // dependsOn(ktorSocketMain) // } // val iosX64Test by getting { // dependsOn(ktorSocketTest) // } // val iosArm64Main by getting { // dependsOn(ktorSocketMain) // } // val iosArm64Test by getting { // dependsOn(ktorSocketTest) // } val linuxArm64Main by getting { dependsOn(ktorSocketMain) } val linuxArm64Test by getting { dependsOn(ktorSocketTest) } val linuxX64Main by getting { dependsOn(ktorSocketMain) } val linuxX64Test by getting { dependsOn(ktorSocketTest) } } 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") } } } android { namespace = "net.sergeych.kiloparsec" compileSdk = 34 defaultConfig { minSdk = 24 } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } }