diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 69d1cb8..0d62294 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,9 +11,9 @@ jobs: - name: Install dependencies run: | sudo apt install -y libcurl4-openssl-dev - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v1 with: - java-version: 11 + java-version: 17 - name: Build with Gradle run: ./gradlew build diff --git a/InlineQueriesBot/build.gradle b/InlineQueriesBot/build.gradle index a574fb8..bf06c00 100644 --- a/InlineQueriesBot/build.gradle +++ b/InlineQueriesBot/build.gradle @@ -16,15 +16,9 @@ apply plugin: 'application' mainClassName="InlineQueriesBotKt" +apply from: "$nativePartTemplate" 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.") - jvm() sourceSets { @@ -35,18 +29,6 @@ kotlin { 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" - } - } } } diff --git a/LiveLocationsBot/src/main/kotlin/LiveLocationsBot.kt b/LiveLocationsBot/src/main/kotlin/LiveLocationsBot.kt index e0ce8aa..2abfd27 100644 --- a/LiveLocationsBot/src/main/kotlin/LiveLocationsBot.kt +++ b/LiveLocationsBot/src/main/kotlin/LiveLocationsBot.kt @@ -2,6 +2,7 @@ import dev.inmo.micro_utils.coroutines.subscribeSafelyWithoutExceptions import dev.inmo.tgbotapi.extensions.api.EditLiveLocationInfo import dev.inmo.tgbotapi.extensions.api.chat.get.getChat import dev.inmo.tgbotapi.extensions.api.edit.edit +import dev.inmo.tgbotapi.extensions.api.edit.location.live.stopLiveLocation import dev.inmo.tgbotapi.extensions.api.handleLiveLocation import dev.inmo.tgbotapi.extensions.api.send.* import dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitMessageDataCallbackQuery @@ -75,7 +76,7 @@ suspend fun main(vararg args: String) { sendingJob.cancel() // ends live location currentMessageState.value ?.let { - edit(it, replyMarkup = null) // removing reply keyboard + stopLiveLocation(it, replyMarkup = null) } } allUpdatesFlow.subscribeSafelyWithoutExceptions(this) { println(it) } diff --git a/RandomFileSenderBot/build.gradle b/RandomFileSenderBot/build.gradle index 70327df..d4e2f24 100644 --- a/RandomFileSenderBot/build.gradle +++ b/RandomFileSenderBot/build.gradle @@ -16,15 +16,7 @@ apply plugin: 'application' mainClassName="RandomFileSenderBotKt" - 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.") - jvm() sourceSets { @@ -35,18 +27,8 @@ kotlin { 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" - } - } } } +apply from: "$nativePartTemplate" + diff --git a/ResenderBot/ResenderBotLib/build.gradle b/ResenderBot/ResenderBotLib/build.gradle index 0530296..092aa78 100644 --- a/ResenderBot/ResenderBotLib/build.gradle +++ b/ResenderBot/ResenderBotLib/build.gradle @@ -22,6 +22,7 @@ kotlin { } linuxX64() mingwX64() + linuxArm64() sourceSets { commonMain { diff --git a/ResenderBot/native_launcher/build.gradle b/ResenderBot/native_launcher/build.gradle index fa67557..0adba7a 100644 --- a/ResenderBot/native_launcher/build.gradle +++ b/ResenderBot/native_launcher/build.gradle @@ -12,15 +12,9 @@ plugins { id "org.jetbrains.kotlin.multiplatform" } +apply from: "$nativePartTemplate" 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.") - sourceSets { commonMain { dependencies { @@ -29,18 +23,6 @@ kotlin { api project(":ResenderBot:ResenderBotLib") } } - - 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" - } - } } } diff --git a/WebApp/src/jsMain/kotlin/main.kt b/WebApp/src/jsMain/kotlin/main.kt index c6d6bb2..2241dcc 100644 --- a/WebApp/src/jsMain/kotlin/main.kt +++ b/WebApp/src/jsMain/kotlin/main.kt @@ -71,7 +71,7 @@ fun main() { } } }) - appendText("Exit button") + appendText("Answer in chat button") } ?: window.alert("Unable to load body") document.body ?.appendElement("p", {}) diff --git a/WebApp/src/jvmMain/kotlin/WebAppServer.kt b/WebApp/src/jvmMain/kotlin/WebAppServer.kt index 5970521..4d61dc9 100644 --- a/WebApp/src/jvmMain/kotlin/WebAppServer.kt +++ b/WebApp/src/jvmMain/kotlin/WebAppServer.kt @@ -52,8 +52,13 @@ suspend fun main(vararg args: String) { } ) { routing { - staticFiles("", File("WebApp/build/distributions")) { - default("WebApp/build/distributions/index.html") + val baseJsFolder = File("WebApp/build/dist/js/") + baseJsFolder.list() ?.forEach { + if (it == "productionExecutable" || it == "developmentExecutable") { + staticFiles("", File(baseJsFolder, it)) { + default("WebApp/build/dist/js/$it/index.html") + } + } } post("inline") { val requestBody = call.receiveText() diff --git a/build.gradle b/build.gradle index 47c7e6b..f0319eb 100644 --- a/build.gradle +++ b/build.gradle @@ -10,6 +10,9 @@ buildscript { } allprojects { + ext { + nativePartTemplate = "${rootProject.projectDir.absolutePath}/native_template.gradle" + } repositories { mavenLocal() mavenCentral() @@ -23,6 +26,6 @@ allprojects { } } -// maven { url "https://git.inmo.dev/api/packages/InsanusMokrassar/maven" } + maven { url "https://git.inmo.dev/api/packages/InsanusMokrassar/maven" } } } diff --git a/gradle.properties b/gradle.properties index d4f5880..bf3c103 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,8 +4,8 @@ org.gradle.parallel=true org.gradle.jvmargs=-Xmx2g -kotlin_version=1.8.22 -telegram_bot_api_version=9.2.2 -micro_utils_version=0.19.9 -serialization_version=1.5.1 -ktor_version=2.3.4 +kotlin_version=1.9.20 +telegram_bot_api_version=9.3.0 +micro_utils_version=0.20.12 +serialization_version=1.6.0 +ktor_version=2.3.5 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4a71a62..4d6272d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip diff --git a/native_template.gradle b/native_template.gradle new file mode 100644 index 0000000..ec5ec30 --- /dev/null +++ b/native_template.gradle @@ -0,0 +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.") + } + } +}