Skip to content

Commit

Permalink
7.7.0 (#318)
Browse files Browse the repository at this point in the history
* Added `ktorJvmEngine` parameter to plugin with option to choose ktor engine.
* Added `onHandlerException` for spring starter bot configuration, to cover exceptions thrown by update handler.
* Added extension for `String` for escaping formatting, `escapeFormatting(parseMode)`, `escapeMarkdown`,
  `escapeMarkdownV2`, `escapeHTML`.
  • Loading branch information
vendelieu authored Dec 31, 2024
1 parent 782078c commit c2a3aac
Show file tree
Hide file tree
Showing 54 changed files with 543 additions and 285 deletions.
41 changes: 35 additions & 6 deletions .github/workflows/ci.release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,41 @@ jobs:
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
shell: bash

documentation:
name: Publish documentation
needs: version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Setup gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: current

- name: Cache konan dependencies
uses: actions/cache@v4
with:
path: ~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.toml')}}
restore-keys: |
${{ runner.os }}-gradle-
- name: Generate docs
run: ./gradlew :docs:dokkaGenerate -PlibVersion=${{ needs.version.outputs.version }} --no-parallel

- name: Publish documentation
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
BRANCH: gh-pages
FOLDER: telegram-bot/docs/build/dokka

publish:
needs: version
runs-on: ubuntu-latest
Expand Down Expand Up @@ -58,12 +93,6 @@ jobs:
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{secrets.SONATYPE_PASSWORD}}
run: ./gradlew publishAllPublicationsToMavenCentralRepository -Psigning.secretKeyRingFile=/home/runner/work/secret.gpg -Psigning.keyId=${{secrets.SIGNING_KEYID}} -Psigning.password=${{secrets.SIGNING_PASSWORD}} -PlibVersion=${{ needs.version.outputs.version }} --no-parallel

- name: Publish documentation
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
BRANCH: gh-pages
FOLDER: telegram-bot/build/dokka

- name: Publish plugin
run: ./gradlew publishPlugins -PlibVersion=${{ needs.version.outputs.version }}
env:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Telegram-bot (KtGram) Changelog

## 7.7.0

* Added `ktorJvmEngine` parameter to plugin with option to choose ktor engine.
* Added `onHandlerException` for spring starter bot configuration, to cover exceptions thrown by update handler.
* Added extension for `String` for escaping formatting, `escapeFormatting(parseMode)`, `escapeMarkdown`,
`escapeMarkdownV2`, `escapeHTML`.

### 7.6.2

* Move all sealed structure serialization to unified approach.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
alias(libs.plugins.deteKT) apply false
}

tasks.create("prepareRelease") {
tasks.register("prepareRelease") {
dependsOn("telegram-bot:clean")
dependsOn("telegram-bot:kspCommonMainKotlinMetadata")
dependsOn("telegram-bot:apiCheck")
Expand Down
1 change: 1 addition & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
dependencies {
implementation(libs.kotlin.serialization)
implementation(libs.kotlin.gradlePlugin)
implementation(libs.dokka)
implementation(libs.publisher)
}

Expand Down
3 changes: 3 additions & 0 deletions buildSrc/src/main/kotlin/CommonResources.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
internal object CommonResources {
const val REPO_URL = "https://github.com/vendelieu/telegram-bot"
}
24 changes: 24 additions & 0 deletions buildSrc/src/main/kotlin/dokka.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import CommonResources.REPO_URL
import java.time.LocalDate

plugins {
id("org.jetbrains.dokka")
}

dokka {
moduleName = if (project.name != "docs") project.name else "KtGram"
dokkaSourceSets.configureEach {
sourceRoots.setFrom(project.projectDir.resolve("src/$name/kotlin"))
sourceLink {
localDirectory.set(file("src/$name/kotlin"))
remoteUrl("$REPO_URL/blob/master/${project.name}/src/$name/kotlin")
remoteLineSuffix.set("#L")
}
}

pluginsConfiguration.html {
customAssets.from(rootDir.resolve("assets/logo-icon.svg"))
footerMessage.set("© ${LocalDate.now().year} Vendelieu")
homepageLink.set(REPO_URL)
}
}
12 changes: 6 additions & 6 deletions buildSrc/src/main/kotlin/publish.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import CommonResources.REPO_URL
import com.vanniktech.maven.publish.JavadocJar
import com.vanniktech.maven.publish.KotlinJvm
import com.vanniktech.maven.publish.KotlinMultiplatform
Expand All @@ -18,8 +19,7 @@ mavenPublishing {
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, true)
if (releaseMode) signAllPublications()

val javaDoc = if (project.name == "telegram-bot" && releaseMode) JavadocJar.Dokka("dokkaHtml")
else JavadocJar.Empty()
val javaDoc = JavadocJar.Empty()

val platformArtifact = if (isMultiplatform) KotlinMultiplatform(javaDoc, true)
else KotlinJvm(JavadocJar.None(), true)
Expand All @@ -30,7 +30,7 @@ mavenPublishing {
name = libraryData.name
description = libraryData.description
inceptionYear = "2022"
url = "https://github.com/vendelieu/telegram-bot"
url = REPO_URL

licenses {
license {
Expand All @@ -48,12 +48,12 @@ mavenPublishing {
}
scm {
connection = "scm:git:github.com/vendelieu/telegram-bot.git"
developerConnection = "scm:git:ssh://github.com/vendelieu/telegram-bot.git"
url = "https://github.com/vendelieu/telegram-bot.git"
developerConnection = "scm:git:${REPO_URL.replace("https", "ssh")}.git"
url = "$REPO_URL.git"
}
issueManagement {
system = "Github"
url = "https://github.com/vendelieu/telegram-bot/issues"
url = "$REPO_URL/issues"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/resources/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"Array of String"
],
"required": false,
"description": "A JSON-serialized list of the update types you want your bot to receive. For example, specify [\"message\", \"edited_channel_post\", \"callback_query\"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used. Please note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time."
"description": "A JSON-serialized list of the update types you want your bot to receive. For example, specify [\"message\", \"edited_channel_post\", \"callback_query\"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used. Please note that this parameter doesn't affect updates created before the call to getUpdates, so unwanted updates may be received for a short period of time."
}
]
},
Expand Down
10 changes: 10 additions & 0 deletions docs/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
plugins {
kotlin("jvm") apply false
dokka
}

dependencies {
rootProject.subprojects.filter { it.name !in listOf("helper", "ksp", "ktgram-gradle-plugin", "docs") }.forEach {
dokka(project(":" + it.name))
}
}
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
org.gradle.jvmargs=-Xmx1g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.caching=true
kotlin.incremental=true
kotlin.incremental=true
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true
#org.jetbrains.dokka.experimental.tryK2=true
19 changes: 9 additions & 10 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
[versions]
ktor = "3.0.2"
ktor = "3.0.3"
redis = "0.1.7"
logback = "1.5.12"
logback = "1.5.15"

datetime = "0.6.0"
serialization = "1.7.3"
stately = "2.1.0"

kotlin = "2.1.0"
coroutines = "1.9.0"
dokka = "1.9.20"
coroutines = "1.10.1"
dokka = "2.0.0"
kotlinter = "5.0.1"
deteKT = "1.23.7"
toml = "0.4.0"

kotest = "5.9.1"
mockk = "1.13.13"
kover = "0.8.3"
mockk = "1.13.14"
kover = "0.9.0"
krypto = "4.0.10"
urlencoder = "1.6.0"
sslcontext = "8.3.7"
spring = "3.4.0"
spring = "3.4.1"

ksp = "2.1.0-1.0.29"
poet = "2.0.0"

binvalid = "0.16.3"
binvalid = "0.17.0"
publisher = "0.30.0"
gradle-publish = "1.3.0"
env = "1.0.4"
Expand Down Expand Up @@ -57,7 +57,7 @@ test-kotest-junit5 = { module = "io.kotest:kotest-runner-junit5", version.ref =
test-kotest-assertions = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest" }

coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
dokka-base = { module = "org.jetbrains.dokka:dokka-base", version.ref = "dokka" }
dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }

ksp = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" }
poet = { module = "com.squareup:kotlinpoet", version.ref = "poet" }
Expand All @@ -79,7 +79,6 @@ kotlin-js-plain-objects = { id = "org.jetbrains.kotlin.plugin.js-plain-objects",
kotlin-compatability-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binvalid" }
gradle-publish = { id = "com.gradle.plugin-publish", version.ref = "gradle-publish"}
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
ktlinter = { id = "org.jmailen.kotlinter", version.ref = "kotlinter" }
deteKT = { id = "io.gitlab.arturbosch.detekt", version.ref = "deteKT" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 1 addition & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
52 changes: 11 additions & 41 deletions kotlin-js-store/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
resolved "https://registry.yarnpkg.com/@js-joda/core/-/core-3.2.0.tgz#3e61e21b7b2b8a6be746df1335cf91d70db2a273"
integrity sha512-PMqgJ0sw5B7FKb2d5bWYIoxjri+QlW/Pys7+Rw82jSH0QN3rB05jZ/VrrsUdh1w4+i2kw9JOejXGq/KhDOX7Kg==

abort-controller@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392"
integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==
dependencies:
event-target-shim "^5.0.0"

ansi-colors@^4.1.3:
version "4.1.3"
resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b"
Expand Down Expand Up @@ -159,11 +152,6 @@ escape-string-regexp@^4.0.0:
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==

event-target-shim@^5.0.0:
version "5.0.1"
resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789"
integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==

fill-range@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
Expand Down Expand Up @@ -291,6 +279,13 @@ js-yaml@^4.1.0:
dependencies:
argparse "^2.0.1"

kotlin-web-helpers@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/kotlin-web-helpers/-/kotlin-web-helpers-2.0.0.tgz#b112096b273c1e733e0b86560998235c09a19286"
integrity sha512-xkVGl60Ygn/zuLkDPx+oHj7jeLR7hCvoNF99nhwXMn8a3ApB4lLiC9pk4ol4NHPjyoCbvQctBqvzUcp8pkqyWw==
dependencies:
format-util "^1.0.5"

locate-path@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286"
Expand All @@ -313,10 +308,10 @@ minimatch@^5.0.1, minimatch@^5.1.6:
dependencies:
brace-expansion "^2.0.1"

mocha@10.7.0:
version "10.7.0"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.7.0.tgz#9e5cbed8fa9b37537a25bd1f7fb4f6fc45458b9a"
integrity sha512-v8/rBWr2VO5YkspYINnvu81inSz2y3ODJrhO175/Exzor1RcEZZkizgE2A+w/CAXXoESS8Kys5E62dOHGHzULA==
mocha@10.7.3:
version "10.7.3"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.7.3.tgz#ae32003cabbd52b59aece17846056a68eb4b0752"
integrity sha512-uQWxAu44wwiACGqjbPYmjo7Lg8sFrS3dQe7PP2FQI+woptP4vZXSMcfMyFL/e1yFEeEpV4RtyTpZROOKmxis+A==
dependencies:
ansi-colors "^4.1.3"
browser-stdout "^1.3.1"
Expand Down Expand Up @@ -349,13 +344,6 @@ ms@^2.1.3:
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==

node-fetch@2.6.7:
version "2.6.7"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
dependencies:
whatwg-url "^5.0.0"

normalize-path@^3.0.0, normalize-path@~3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"
Expand Down Expand Up @@ -478,29 +466,11 @@ to-regex-range@^5.0.1:
dependencies:
is-number "^7.0.0"

tr46@~0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==

typescript@5.5.4:
version "5.5.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.4.tgz#d9852d6c82bad2d2eda4fd74a5762a8f5909e9ba"
integrity sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==

webidl-conversions@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==

whatwg-url@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==
dependencies:
tr46 "~0.0.3"
webidl-conversions "^3.0.0"

workerpool@^6.5.1:
version "6.5.1"
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.5.1.tgz#060f73b39d0caf97c6db64da004cd01b4c099544"
Expand Down
3 changes: 2 additions & 1 deletion ktgram-botctx-redis/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id("publish")
dokka
publish
}

onlyJvmConfiguredKotlin {
Expand Down
3 changes: 2 additions & 1 deletion ktgram-config-env/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id("publish")
dokka
publish
}

configuredKotlin {
Expand Down
3 changes: 2 additions & 1 deletion ktgram-config-toml/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id("publish")
dokka
publish
}

onlyJvmConfiguredKotlin {
Expand Down
Loading

0 comments on commit c2a3aac

Please sign in to comment.