2025-09-29 01:56:32 +08:00
|
|
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
|
|
|
|
2025-09-29 01:43:17 +08:00
|
|
|
plugins {
|
2025-09-30 10:50:08 +08:00
|
|
|
kotlin("multiplatform") version "2.2.0"
|
2025-09-29 01:56:32 +08:00
|
|
|
id("maven-publish")
|
2025-09-29 01:43:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
group = "cn.rtast.nmdns"
|
2025-09-30 10:50:08 +08:00
|
|
|
version = "0.1.0"
|
2025-09-29 01:43:17 +08:00
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
|
mavenCentral()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
kotlin {
|
2025-09-29 06:30:39 +08:00
|
|
|
val nativeTargets = listOf(
|
|
|
|
|
linuxArm64(),
|
|
|
|
|
linuxX64(),
|
|
|
|
|
mingwX64(),
|
|
|
|
|
macosArm64()
|
|
|
|
|
)
|
2025-09-29 01:56:32 +08:00
|
|
|
jvm { compilerOptions { jvmTarget = JvmTarget.JVM_11 } }
|
2025-09-29 01:43:17 +08:00
|
|
|
|
2025-09-29 06:30:39 +08:00
|
|
|
nativeTargets.forEach {
|
|
|
|
|
it.binaries {
|
|
|
|
|
staticLib {
|
|
|
|
|
baseName = "nmdns"
|
|
|
|
|
}
|
|
|
|
|
sharedLib {
|
|
|
|
|
baseName = "nmdns"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-30 10:50:08 +08:00
|
|
|
compilerOptions { freeCompilerArgs.addAll("-Xexpect-actual-classes") }
|
|
|
|
|
|
|
|
|
|
explicitApi()
|
|
|
|
|
|
2025-09-29 01:43:17 +08:00
|
|
|
sourceSets {
|
|
|
|
|
commonMain.dependencies {
|
2025-09-30 10:50:08 +08:00
|
|
|
|
2025-09-29 01:43:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
commonTest.dependencies {
|
|
|
|
|
implementation(kotlin("test"))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-09-29 01:56:32 +08:00
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
|
repositories {
|
|
|
|
|
mavenLocal()
|
|
|
|
|
maven("https://repo.maven.rtast.cn/releases") {
|
|
|
|
|
name = "RTAST"
|
|
|
|
|
credentials {
|
|
|
|
|
username = "RTAkland"
|
|
|
|
|
password = System.getenv("PUBLISH_TOKEN")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-09-29 06:30:39 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* link all targets static lib
|
|
|
|
|
* Apple target can only be compiled on macos
|
|
|
|
|
*/
|
|
|
|
|
tasks.register("linkStaticLibrary") {
|
|
|
|
|
group = "nmdns"
|
|
|
|
|
dependsOn(tasks.named("linkReleaseStaticLinuxArm64"))
|
|
|
|
|
dependsOn(tasks.named("linkReleaseStaticLinuxX64"))
|
|
|
|
|
dependsOn(tasks.named("linkReleaseStaticMacosArm64"))
|
|
|
|
|
dependsOn(tasks.named("linkReleaseStaticMingwX64"))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* link all targrts to shared lib
|
|
|
|
|
* Apple target can only be compiled on macos
|
|
|
|
|
*/
|
|
|
|
|
tasks.register("linkSharedLibrary") {
|
|
|
|
|
group = "nmdns"
|
|
|
|
|
dependsOn(tasks.named("linkReleaseSharedLinuxArm64"))
|
|
|
|
|
dependsOn(tasks.named("linkReleaseSharedLinuxX64"))
|
|
|
|
|
dependsOn(tasks.named("linkReleaseSharedMacosArm64"))
|
|
|
|
|
dependsOn(tasks.named("linkReleaseSharedMingwX64"))
|
|
|
|
|
}
|