118 lines
3.7 KiB
Plaintext
118 lines
3.7 KiB
Plaintext
|
|
plugins {
|
|
kotlin("multiplatform") version "2.0.0"
|
|
id("org.jetbrains.kotlin.plugin.serialization") version "2.0.0"
|
|
`maven-publish`
|
|
}
|
|
|
|
group = "net.sergeych"
|
|
version = "0.2.4"
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
mavenLocal()
|
|
maven("https://maven.universablockchain.com/")
|
|
maven("https://gitea.sergeych.net/api/packages/SergeychWorks/maven")
|
|
}
|
|
|
|
kotlin {
|
|
jvm()
|
|
js {
|
|
browser {
|
|
}
|
|
}
|
|
// val hostOs = System.getProperty("os.name")
|
|
// val isArm64 = System.getProperty("os.arch") == "aarch64"
|
|
// val isMingwX64 = hostOs.startsWith("Windows")
|
|
// @Suppress("UNUSED_VARIABLE")
|
|
// val nativeTarget = when {
|
|
// hostOs == "Mac OS X" && isArm64 -> macosArm64("native")
|
|
// hostOs == "Mac OS X" && !isArm64 -> macosX64("native")
|
|
// hostOs == "Linux" && isArm64 -> linuxArm64("native")
|
|
// hostOs == "Linux" && !isArm64 -> linuxX64("native")
|
|
// isMingwX64 -> mingwX64("native")
|
|
// else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
|
|
// }
|
|
|
|
macosArm64()
|
|
iosX64()
|
|
iosArm64()
|
|
iosSimulatorArm64()
|
|
linuxX64()
|
|
linuxArm64()
|
|
macosX64()
|
|
|
|
val ktor_version = "2.3.12"
|
|
|
|
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.7.3")
|
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1")
|
|
|
|
// api("com.ionspin.kotlin:bignum:0.3.9")
|
|
api("io.ktor:ktor-client-core:$ktor_version")
|
|
api("net.sergeych:crypto2:0.4.2")
|
|
}
|
|
}
|
|
// 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 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
|
|
val jsMain by getting {
|
|
dependencies {
|
|
implementation("io.ktor:ktor-client-js:$ktor_version")
|
|
}
|
|
}
|
|
val jsTest by getting
|
|
|
|
// for (pm in listOf(linuxMain, macosMain, iosMain, mingwMain))
|
|
// pm { dependsOn(ktorSocketMain) }
|
|
|
|
}
|
|
|
|
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)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|