mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI-examples.git
synced 2025-09-05 08:09:37 +00:00
complete sample with native
This commit is contained in:
@@ -8,14 +8,45 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'kotlin'
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.multiplatform"
|
||||
}
|
||||
|
||||
apply plugin: 'application'
|
||||
|
||||
mainClassName="RandomFileSenderBotKt"
|
||||
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
kotlin {
|
||||
def hostOs = System.getProperty("os.name")
|
||||
def isMingwX64 = hostOs.startsWith("Windows")
|
||||
def nativeTarget
|
||||
if (hostOs == "Linux") 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.")
|
||||
|
||||
implementation "dev.inmo:tgbotapi:$telegram_bot_api_version"
|
||||
jvm()
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
implementation kotlin('stdlib')
|
||||
|
||||
api "dev.inmo:tgbotapi:$telegram_bot_api_version"
|
||||
}
|
||||
}
|
||||
|
||||
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.")
|
||||
|
||||
api "io.ktor:ktor-client-$engine:$ktor_version"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user