TelegramBotAPI-examples/ResenderBot/native_launcher/build.gradle

58 lines
1.4 KiB
Groovy
Raw Normal View History

2023-04-03 19:01:22 +00:00
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
plugins {
id "org.jetbrains.kotlin.multiplatform"
}
kotlin {
def hostOs = System.getProperty("os.name")
def isMingwX64 = hostOs.startsWith("Windows")
2023-10-20 16:29:59 +00:00
def isArch64 = System.getProperty("os.arch") == "aarch64"
2023-04-03 19:01:22 +00:00
def nativeTarget
2023-10-20 16:29:59 +00:00
if (hostOs == "Linux") {
if (isArch64) {
nativeTarget = linuxArm64("native") { binaries { executable() } }
} else {
nativeTarget = linuxX64("native") { binaries { executable() } }
}
} else {
if (isMingwX64) {
nativeTarget = mingwX64("native") { binaries { executable() } }
} else {
throw new GradleException("Host OS is not supported in Kotlin/Native.")
}
}
2023-04-03 19:01:22 +00:00
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib')
2023-04-19 14:20:11 +00:00
api project(":ResenderBot:ResenderBotLib")
2023-04-03 19:01:22 +00:00
}
}
nativeMain {
dependencies {
def engine
if (hostOs == "Linux") engine = "curl"
else if (isMingwX64) engine = "winhttp"
else throw new GradleException("Host OS is not supported in Kotlin/Native.")
2023-04-18 05:31:28 +00:00
api "io.ktor:ktor-client-$engine:$ktor_version"
2023-04-03 19:01:22 +00:00
}
}
}
}
2023-04-19 14:20:11 +00:00