From af04a854ef7eebc8e75daeb9ababfd84582e0c89 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 25 Oct 2023 15:33:05 +0600 Subject: [PATCH] fixes --- RandomFileSenderBot/build.gradle | 4 +-- gradle.properties | 2 +- native_template.gradle | 52 +++++++++++--------------------- 3 files changed, 20 insertions(+), 38 deletions(-) diff --git a/RandomFileSenderBot/build.gradle b/RandomFileSenderBot/build.gradle index ffc31e6..d4e2f24 100644 --- a/RandomFileSenderBot/build.gradle +++ b/RandomFileSenderBot/build.gradle @@ -16,8 +16,6 @@ apply plugin: 'application' mainClassName="RandomFileSenderBotKt" -apply from: "$nativePartTemplate" - kotlin { jvm() @@ -32,3 +30,5 @@ kotlin { } } +apply from: "$nativePartTemplate" + diff --git a/gradle.properties b/gradle.properties index 09ee8e3..9a4a4a2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx2g kotlin_version=1.9.20-RC -telegram_bot_api_version=9.3.0-branch_9.3.0-RC-build1893-RC +telegram_bot_api_version=9.3.0-RC micro_utils_version=0.20.9-branch_0.20.9-build747 serialization_version=1.6.0 ktor_version=2.3.5 diff --git a/native_template.gradle b/native_template.gradle index 46c900c..ec5ec30 100644 --- a/native_template.gradle +++ b/native_template.gradle @@ -1,38 +1,20 @@ kotlin { -// def hostOs = System.getProperty("os.name") -// def isMingwX64 = hostOs.startsWith("Windows") -// def isArch64 = System.getProperty("os.arch") == "aarch64" -// -// def nativeTarget -// 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.") -// } -// } + def hostOs = System.getProperty("os.name") + def isMingwX64 = hostOs.startsWith("Windows") + def isArch64 = System.getProperty("os.arch") == "aarch64" -// sourceSets { -// nativeMain { -// dependencies { -// def engine -// -// if (hostOs == "Linux") if (isArch64) engine = "cio" else 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" -// } -// } -// } - - linuxX64() { binaries { executable() } } - mingwX64() { binaries { executable() } } - linuxArm64() { binaries { executable() } } + def nativeTarget + 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.") + } + } }